Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
WorldState Class Reference

Represents the state of the world in the game, including the map size, tile contents, players, eggs, and teams. More...

#include <WorldState.hpp>

+ Collaboration diagram for WorldState:

Public Member Functions

Resourcesat (int x, int y)
 Accesses the resources at a specific tile coordinate (x, y).
 
const Resourcesat (int x, int y) const
 Accesses the resources at a specific tile coordinate (x, y).
 
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.
 
void purgeDyingPlayers () const
 

Public Attributes

int width
 
int height
 
std::vector< Resourcestiles
 
std::unordered_map< int, Playerplayers
 
std::unordered_map< int, PlayerdyingPlayers
 
std::unordered_map< int, Eggeggs
 
std::vector< std::string > teams
 

Detailed Description

Represents the state of the world in the game, including the map size, tile contents, players, eggs, and teams.

Definition at line 63 of file WorldState.hpp.

Member Function Documentation

◆ at() [1/2]

Resources & WorldState::at ( int  x,
int  y 
)
inline

Accesses the resources at a specific tile coordinate (x, y).

Definition at line 76 of file WorldState.hpp.

References tiles, and width.

Referenced by GameState::_applyPlayerResourceDrop(), GameState::_applyPlayerResourceTake(), GameState::_applyTileContent(), EntityTooltipWidget::_rebuild(), and RaylibRenderer::_render3D().

+ Here is the caller graph for this function:

◆ at() [2/2]

const Resources & WorldState::at ( int  x,
int  y 
) const
inline

Accesses the resources at a specific tile coordinate (x, y).

Definition at line 81 of file WorldState.hpp.

References tiles, and width.

◆ eggExists()

bool WorldState::eggExists ( int  id) const
inline

Checks if an egg with the given ID exists in the world.

Definition at line 91 of file WorldState.hpp.

References eggs.

Referenced by EntityTooltipWidget::_rebuild().

+ Here is the caller graph for this function:

◆ playerExists()

bool WorldState::playerExists ( int  id) const
inline

Checks if a player with the given ID exists in the world.

Definition at line 86 of file WorldState.hpp.

References players.

Referenced by CameraController::_followTarget(), EntityTooltipWidget::_isPlayerCase(), and EntityTooltipWidget::_rebuild().

+ Here is the caller graph for this function:

◆ purgeDyingPlayers()

void WorldState::purgeDyingPlayers ( ) const
inline

Definition at line 93 of file WorldState.hpp.

References dyingPlayers.

Referenced by RaylibRenderer::_render3D().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dyingPlayers

std::unordered_map<int, Player> WorldState::dyingPlayers
mutable

◆ eggs

◆ height

◆ players

◆ teams

std::vector<std::string> WorldState::teams

◆ tiles

std::vector<Resources> WorldState::tiles

Definition at line 67 of file WorldState.hpp.

Referenced by GameState::_applyMapSize(), at(), and at().

◆ width


The documentation for this class was generated from the following file: