5#include <unordered_map>
23 bool incanting =
false;
24 bool incantationEnded =
false;
25 bool incantationSuccess =
false;
31 os <<
"Player " << player.
id <<
":\n"
32 <<
" From team " << player.team <<
", level " << player.
level <<
"\n"
33 <<
" At " << player.
x <<
", " << player.
y <<
", facing " << player.
orientation <<
"\n"
34 <<
" Inventory: " << player.
inventory <<
"\n"
35 <<
" Incanting: " << (player.incanting ?
"yes" :
"no");
47 float rotation =
static_cast<float>(rand() % 360);
53 os <<
"Egg " << egg.
id <<
":\n"
54 <<
" From team " << egg.team <<
"\n"
55 <<
" At " << egg.
x <<
", " << egg.
y;
70 std::unordered_map<int, Egg>
eggs;
96 it = it->second.visual.behaviors.empty() ?
dyingPlayers.erase(it) : ++it;
std::ostream & operator<<(std::ostream &os, const Player &player)
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...
Represents the state of the world in the game, including the map size, tile contents,...
Resources & at(int x, int y)
Accesses the resources at a specific tile coordinate (x, y).
std::vector< std::string > teams
std::vector< Resources > tiles
std::unordered_map< int, Player > dyingPlayers
bool playerExists(int id) const
Checks if a player with the given ID exists in the world.
bool eggExists(int id) const
Checks if an egg with the given ID exists in the world.
std::unordered_map< int, Egg > eggs
std::unordered_map< int, Player > players
void purgeDyingPlayers() const
const Resources & at(int x, int y) const
Accesses the resources at a specific tile coordinate (x, y).