Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::system::World Class Reference

System for managing the current map and previous maps. More...

#include <World.hpp>

+ Inheritance diagram for core::system::World:

Public Member Functions

 World (Systems &systems)
 Creates the world system. More...
 
virtual ~World ()=default
 Destroys the system. More...
 
bool switchMaps (const std::string &newMap, int spawnId)
 Switches the current map to the map in the given file. More...
 
void whiteout (const std::string &newMap, int spawnId)
 Switches to the new map and resets the last map to empty. More...
 
map::MapactiveMap ()
 Returns a reference to the active map. More...
 
const map::MapactiveMap () const
 Returns a const reference to the active map. More...
 
virtual void observe (const event::GameSaveInitializing &save) override
 Adds saved world data to the save file. More...
 
virtual void observe (const event::GameSaveLoaded &load) override
 Initializes world state from the loading game save. More...
 
void setWhiteoutMap (unsigned int spawn)
 Sets the respawn point to the given spawn in the current map. More...
 

Detailed Description

System for managing the current map and previous maps.

Definition at line 21 of file World.hpp.

Constructor & Destructor Documentation

◆ World()

core::system::World::World ( Systems systems)

Creates the world system.

Parameters
systemsA reference to the parent Systems object

Definition at line 16 of file World.cpp.

◆ ~World()

virtual core::system::World::~World ( )
virtualdefault

Destroys the system.

Member Function Documentation

◆ activeMap() [1/2]

map::Map & core::system::World::activeMap ( )

Returns a reference to the active map.

Definition at line 84 of file World.cpp.

◆ activeMap() [2/2]

const map::Map & core::system::World::activeMap ( ) const

Returns a const reference to the active map.

Definition at line 86 of file World.cpp.

◆ observe() [1/2]

void core::system::World::observe ( const event::GameSaveInitializing save)
overridevirtual

Adds saved world data to the save file.

Definition at line 92 of file World.cpp.

◆ observe() [2/2]

void core::system::World::observe ( const event::GameSaveLoaded load)
overridevirtual

Initializes world state from the loading game save.

Definition at line 100 of file World.cpp.

◆ setWhiteoutMap()

void core::system::World::setWhiteoutMap ( unsigned int  spawn)

Sets the respawn point to the given spawn in the current map.

Parameters
spawnThe spawn to respawn at

Definition at line 79 of file World.cpp.

◆ switchMaps()

bool core::system::World::switchMaps ( const std::string &  newMap,
int  spawnId 
)

Switches the current map to the map in the given file.

Parameters
newMapFilename of new map, or "LastMap" for previous map
spawnIdThe id to spawn at. Ignored if "LastMap" is specified
Returns
True if the new map could be loaded and switched to, false on error

Definition at line 26 of file World.cpp.

◆ whiteout()

void core::system::World::whiteout ( const std::string &  newMap,
int  spawnId 
)

Switches to the new map and resets the last map to empty.

Parameters
newMapThe map to whiteout into
spawnIdWhere to spawn

Definition at line 72 of file World.cpp.


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