80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
#ifndef OGLG_GAMEBOARD_H_
|
|
#define OGLG_GAMEBOARD_H_
|
|
|
|
#include "PlayerMove.h"
|
|
#include "pc/astuple.h"
|
|
#include "pc/commcode.h"
|
|
#include "pc/pctypes.h"
|
|
#include <cstdint>
|
|
#include <deque>
|
|
#include <set>
|
|
#include <vector>
|
|
|
|
struct PlayerState {
|
|
Player id;
|
|
Team team;
|
|
bool is_defeated;
|
|
std::deque<PlayerMove> orders;
|
|
|
|
PlayerState();
|
|
};
|
|
|
|
class ImportedTerrain;
|
|
|
|
class GameBoard {
|
|
public:
|
|
GameBoard(pos_t w, pos_t h, const InitInfo& info);
|
|
|
|
friend ImportedTerrain;
|
|
|
|
bool isTeammate(Player x, Player y) const;
|
|
Team teamOf(Player x) const;
|
|
bool isDefeated(Player x) const;
|
|
|
|
std::uint8_t numPlayers() const;
|
|
std::uint8_t numTeams() const;
|
|
|
|
void appendOrderQueue(const PlayerMove& p);
|
|
void clearOrderQueue(Player p);
|
|
void popOrderQueue(Player p);
|
|
void setOffline(Player p);
|
|
|
|
std::vector<Tile> getViewOf(Team x) const;
|
|
GameState tick();
|
|
|
|
private:
|
|
const Tile& at(pos_t x, pos_t y) const;
|
|
Tile& at(pos_t x, pos_t y);
|
|
void setOwner(pos_t x, pos_t y, Player p);
|
|
|
|
bool attack(const PlayerMove& o);
|
|
void capitalCaptured(Player target, Player source);
|
|
|
|
void turnUpdate();
|
|
void roundUpdate();
|
|
void updatedPosition(pos_t x, pos_t y);
|
|
|
|
void offline(Player p);
|
|
|
|
std::vector<TeamRanking> leaderboard() const;
|
|
|
|
TeamViewDiff teamViewDiff(Team team);
|
|
|
|
std::uint8_t n, t;
|
|
std::vector<PlayerState> players;
|
|
|
|
pos_t w, h, view_radius;
|
|
std::vector<Tile> board;
|
|
|
|
std::uint32_t halfturn_id;
|
|
|
|
std::vector<std::vector<std::vector<std::uint8_t>>> cover;
|
|
std::vector<std::set<Point>> diff_tiles;
|
|
|
|
std::vector<Player> new_offline_players;
|
|
std::set<Point> updated_tiles;
|
|
std::vector<Player> new_defeated_players;
|
|
};
|
|
|
|
#endif
|