56 lines
1.0 KiB
C++
56 lines
1.0 KiB
C++
#ifndef OGLG_GAMEBOARD_H_
|
|
#define OGLG_GAMEBOARD_H_
|
|
|
|
#include <vector>
|
|
#include <cstdint>
|
|
#include <deque>
|
|
#include <set>
|
|
#include "PlayerMove.h"
|
|
#include "pc/pctypes.h"
|
|
#include "pc/commcode.h"
|
|
#include "pc/astuple.h"
|
|
|
|
struct PlayerState {
|
|
Player id;
|
|
Team team;
|
|
bool is_defeated;
|
|
std::deque<PlayerMove> tasks;
|
|
|
|
PlayerState();
|
|
};
|
|
|
|
class GameBoard {
|
|
public:
|
|
GameBoard(pos_t w, pos_t h, const InitInfo &info);
|
|
|
|
const Tile& at(pos_t x, pos_t y) const;
|
|
Tile& at(pos_t x, pos_t y);
|
|
|
|
bool attack(const PlayerMove &o);
|
|
|
|
void turnUpdate();
|
|
void roundUpdate();
|
|
|
|
std::vector<TeamRanking> leaderboard() const;
|
|
|
|
bool isTeammate(Player x, Player y) const;
|
|
Team teamOf(Player x) const;
|
|
std::uint8_t numPlayers() const;
|
|
std::uint8_t numTeams() const;
|
|
|
|
private:
|
|
void capitalCaptured(Player target, Player source);
|
|
void updatedPosition(pos_t x, pos_t y);
|
|
|
|
std::uint8_t n, t;
|
|
std::vector<PlayerState> players;
|
|
|
|
pos_t w, h;
|
|
std::vector<Tile> board;
|
|
std::set<Point> updated_tiles;
|
|
std::set<Player> defeated_players;
|
|
};
|
|
|
|
#endif
|
|
|