7 #include "../entity/Npc.hpp"
8 #include "../entity/PlayerCharacter.hpp"
9 #include "../object/Object.hpp"
23 std::vector<std::shared_ptr<PlayerCharacter>>&
getPlayers();
25 std::shared_ptr<PlayerCharacter>
getPlayer(
unsigned int playerId);
61 std::vector<std::shared_ptr<Npc>>&
getNpcs();
69 std::shared_ptr<Npc>
getNpc(
unsigned int npcId);
77 std::shared_ptr<Entity>
getEntity(
unsigned int entityId);
84 std::map<std::string, std::shared_ptr<Object>>&
getObjects();
91 std::map<Coordinates, std::vector<std::shared_ptr<Item>>>&
getItems();
123 std::vector<std::shared_ptr<PlayerCharacter>>
playersM;
126 std::vector<std::shared_ptr<Npc>>
npcsM;
128 std::map<std::string, std::shared_ptr<Object>>
objectsM;
130 std::map<Coordinates, std::vector<std::shared_ptr<Item>>>
itemsM;
GameWorld class. It contains all the player, npc, object and item instances.
Definition: GameWorld.hpp:16
void addNpc(Npc npc)
Adds npc to the game world.
Definition: GameWorld.cpp:60
void addPlayer(std::string playerName, unsigned int playerId, int baseDamage, int baseAccuracy, SpawnCoordinateBounds spawnCoordinateBounds, Coordinates location)
Adds player to the game world.
Definition: GameWorld.cpp:16
bool removePlayer(unsigned int playerId)
Removes player from the game world.
Definition: GameWorld.cpp:21
std::vector< std::shared_ptr< PlayerCharacter > > playersM
Definition: GameWorld.hpp:123
std::vector< std::shared_ptr< Npc > > & getNpcs()
Get all npcs.
Definition: GameWorld.cpp:65
std::mutex & getPlayersMutex()
Definition: GameWorld.cpp:229
std::mutex itemsMutexM
Definition: GameWorld.hpp:131
std::shared_ptr< PlayerCharacter > getPlayer(unsigned int playerId)
Definition: GameWorld.cpp:41
std::shared_ptr< Entity > getEntity(unsigned int entityId)
Get entity by id.
Definition: GameWorld.cpp:210
GameWorld()
Definition: GameWorld.cpp:14
void addItem(Coordinates location, std::shared_ptr< Item >)
Add item to the game world.
Definition: GameWorld.cpp:93
std::mutex & getItemsMutex()
Definition: GameWorld.cpp:234
std::map< std::string, std::shared_ptr< Object > > objectsM
Definition: GameWorld.hpp:128
void initWorld()
Initializes the game world. Loads assets and map. Adds npcs and objects to the world.
Definition: GameWorld.cpp:137
std::map< Coordinates, std::vector< std::shared_ptr< Item > > > itemsM
Definition: GameWorld.hpp:130
std::map< std::string, std::shared_ptr< Object > > & getObjects()
Get all objects.
Definition: GameWorld.cpp:83
std::vector< std::shared_ptr< PlayerCharacter > > & getPlayers()
Definition: GameWorld.cpp:36
std::shared_ptr< Npc > getNpc(unsigned int npcId)
Get npc by id.
Definition: GameWorld.cpp:70
Map mapM
Definition: GameWorld.hpp:133
std::map< Coordinates, std::vector< std::shared_ptr< Item > > > & getItems()
Get all items.
Definition: GameWorld.cpp:88
Map & getMap()
Definition: GameWorld.cpp:55
std::shared_ptr< Item > removeItem(Coordinates location, int itemId)
Remove item from the game world.
Definition: GameWorld.cpp:106
void updateGameWorld()
Updates the game world. Updates all the npcs and players.
Definition: GameWorld.cpp:124
std::mutex playersMutexM
Definition: GameWorld.hpp:124
std::vector< std::shared_ptr< Npc > > npcsM
Definition: GameWorld.hpp:126
Static class representing the map of the game world. Map contains information about which tiles are a...
Definition: Map.hpp:17
Base NPC class. It represents a peaceful NPC that does not attack the player under any circumstances.
Definition: Npc.hpp:11
Struct for coordinates.
Definition: Coordinates.hpp:7
Contains the spawn coordinate bounds for a character.
Definition: CharacterReader.hpp:10