OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | List of all members
OpenXcom::SavedBattleGame Class Reference

The battlescape data that gets written to disk when the game is saved. More...

#include <SavedBattleGame.h>

Public Member Functions

 SavedBattleGame ()
 Creates a new battle save, based on the current generic save. More...
 
 ~SavedBattleGame ()
 Cleans up the saved game. More...
 
void load (const YAML::Node &node, Mod *mod, SavedGame *savedGame)
 Loads a saved battle game from YAML. More...
 
YAML::Node save () const
 Saves a saved battle game to YAML. More...
 
void initMap (int mapsize_x, int mapsize_y, int mapsize_z, bool resetTerrain=true)
 Sets the dimensions of the map and initializes it. More...
 
void initUtilities (Mod *mod)
 Initialises the pathfinding and tileengine. More...
 
std::vector< MapDataSet * > * getMapDataSets ()
 Gets the game's mapdatafiles. More...
 
void setMissionType (const std::string &missionType)
 Sets the mission type. More...
 
std::string getMissionType () const
 Gets the mission type. More...
 
void setGlobalShade (int shade)
 Sets the global shade. More...
 
int getGlobalShade () const
 Gets the global shade. More...
 
Tile ** getTiles () const
 Gets a pointer to the tiles, a tile is the smallest component of battlescape. More...
 
std::vector< Node * > * getNodes ()
 Gets a pointer to the list of nodes. More...
 
std::vector< BattleItem * > * getItems ()
 Gets a pointer to the list of items. More...
 
std::vector< BattleUnit * > * getUnits ()
 Gets a pointer to the list of units. More...
 
int getMapSizeX () const
 Gets terrain size x. More...
 
int getMapSizeY () const
 Gets terrain size y. More...
 
int getMapSizeZ () const
 Gets terrain size z. More...
 
int getMapSizeXYZ () const
 Gets terrain x*y*z. More...
 
int getTileIndex (Position pos) const
 Converts coordinates into a unique index. More...
 
void getTileCoords (int index, int *x, int *y, int *z) const
 Converts a tile index to its coordinates. More...
 
TilegetTile (Position pos) const
 Gets the Tile at a given position on the map. More...
 
BattleUnitgetSelectedUnit () const
 Gets the currently selected unit. More...
 
void setSelectedUnit (BattleUnit *unit)
 Sets the currently selected unit. More...
 
BattleUnitselectPreviousPlayerUnit (bool checkReselect=false, bool setReselect=false, bool checkInventory=false)
 Selects the previous soldier. More...
 
BattleUnitselectNextPlayerUnit (bool checkReselect=false, bool setReselect=false, bool checkInventory=false)
 Selects the next soldier. More...
 
BattleUnitselectUnit (Position pos)
 Selects the unit with position on map. More...
 
PathfindinggetPathfinding () const
 Gets the pathfinding object. More...
 
TileEnginegetTileEngine () const
 Gets a pointer to the tileengine. More...
 
UnitFaction getSide () const
 Gets the playing side. More...
 
int getTurn () const
 Gets the turn number. More...
 
void endTurn ()
 Ends the turn. More...
 
void setDebugMode ()
 Sets debug mode. More...
 
bool getDebugMode () const
 Gets debug mode. More...
 
void loadMapResources (Mod *mod)
 Load map resources. More...
 
void resetUnitTiles ()
 Resets tiles units are standing on. More...
 
void removeItem (BattleItem *item)
 Removes an item from the game. More...
 
void setAborted (bool flag)
 Sets whether the mission was aborted. More...
 
bool isAborted () const
 Checks if the mission was aborted. More...
 
void setObjectiveCount (int counter)
 Sets how many objectives need to be destroyed. More...
 
void addDestroyedObjective ()
 increments the objective counter. More...
 
bool allObjectivesDestroyed () const
 Checks if all the objectives are destroyed. More...
 
int * getCurrentItemId ()
 Gets the current item ID. More...
 
NodegetSpawnNode (int nodeRank, BattleUnit *unit)
 Gets a spawn node. More...
 
NodegetPatrolNode (bool scout, BattleUnit *unit, Node *fromNode)
 Gets a patrol node. More...
 
void prepareNewTurn ()
 Carries out new turn preparations. More...
 
void reviveUnconsciousUnits ()
 Revives unconscious units (healthcheck). More...
 
void removeUnconsciousBodyItem (BattleUnit *bu)
 Removes the body item that corresponds to the unit.
 
bool setUnitPosition (BattleUnit *bu, Position position, bool testOnly=false)
 Sets or tries to set a unit of a certain size on a certain position of the map. More...
 
bool addFallingUnit (BattleUnit *unit)
 Adds this unit to the vector of falling units. More...
 
std::list< BattleUnit * > * getFallingUnits ()
 Gets the vector of falling units. More...
 
void setUnitsFalling (bool fall)
 Toggles the switch that says "there are units falling, start the fall state". More...
 
bool getUnitsFalling () const
 Checks the status of the switch that says "there are units falling". More...
 
BattlescapeStategetBattleState ()
 Gets a pointer to the BattlescapeState. More...
 
BattlescapeGamegetBattleGame ()
 Gets a pointer to the BattlescapeGame. More...
 
void setBattleState (BattlescapeState *bs)
 Sets the pointer to the BattlescapeState. More...
 
BattleUnitgetHighestRankedXCom ()
 Gets the highest ranked, living XCom unit. More...
 
int getMoraleModifier (BattleUnit *unit=0)
 Gets the morale modifier for XCom based on the highest ranked, living XCom unit, or the modifier for the unit passed to this function. More...
 
bool eyesOnTarget (UnitFaction faction, BattleUnit *unit)
 Checks whether a particular faction has eyes on *unit (whether any unit on that faction sees *unit). More...
 
bool placeUnitNearPosition (BattleUnit *unit, const Position &entryPoint, bool largeFriend)
 Attempts to place a unit on or near entryPoint. More...
 
void resetTurnCounter ()
 Resets the turn counter.
 
void resetTiles ()
 Resets the visibility of all tiles on the map. More...
 
const std::vector< Position > & getTileSearch () const
 get an 11x11 grid of positions (-10 to +10) to check. More...
 
bool isCheating () const
 check if the AI has engaged cheat mode. More...
 
BattleActionType getTUReserved () const
 get the reserved fire mode. More...
 
void setTUReserved (BattleActionType reserved)
 set the reserved fire mode. More...
 
bool getKneelReserved () const
 get whether we are reserving TUs to kneel. More...
 
void setKneelReserved (bool reserved)
 set whether we are reserving TUs to kneel. More...
 
std::vector< Position > & getStorageSpace ()
 give me access to the storage tiles vector. More...
 
void randomizeItemLocations (Tile *t)
 move all the leftover items to random locations in the storage tiles vector. More...
 
std::vector< std::vector< std::pair< int, int > > > & getModuleMap ()
 get a reference to the baseModules map. More...
 
void calculateModuleMap ()
 calculate the number of map modules remaining More...
 
SavedGamegetGeoscapeSave ()
 a shortcut to the geoscape save. More...
 
int getDepth () const
 get the depth of the battlescape game. More...
 
void setDepth (int depth)
 set the depth of the battlescape game. More...
 
void setPaletteByDepth (State *state)
 uses the depth variable to set a palette. More...
 
void setAmbientSound (int sound)
 sets the ambient sound effect; More...
 
int getAmbientSound () const
 gets the ambient sound effect; More...
 
std::vector< BattleItem * > * getGuaranteedRecoveredItems ()
 gets the list of items we're guaranteed. More...
 
std::vector< BattleItem * > * getConditionalRecoveredItems ()
 gets the list of items we MIGHT get. More...
 
std::string & getMusic ()
 Get the name of the music track. More...
 
void setMusic (const std::string &track)
 Set the name of the music track. More...
 
void setObjectiveType (int type)
 Sets the objective type for this mission. More...
 
SpecialTileType getObjectiveType () const
 Gets the objective type of this mission. More...
 
void setAmbientVolume (double volume)
 sets the ambient sound effect; More...
 
double getAmbientVolume () const
 gets the ambient sound effect; More...
 
int getTurnLimit () const
 Gets the turn limit for this mission. More...
 
ChronoTrigger getChronoTrigger () const
 Gets the action that triggers when the timer runs out. More...
 
void setTurnLimit (int limit)
 Sets the turn limit for this mission. More...
 
void setChronoTrigger (ChronoTrigger trigger)
 Sets the action that triggers when the timer runs out. More...
 
void setCheatTurn (int turn)
 Sets the turn to start the aliens cheating. More...
 
bool isBeforeGame () const
 Check whether the battle has actually commenced or not.
 
bool isItemUsable (RuleItem *item) const
 Checks if an item is usable on this map. More...
 
void resetUnitHitStates ()
 Reset all the unit hit state flags. More...
 

Detailed Description

The battlescape data that gets written to disk when the game is saved.

A saved game holds all the variable info in a game like mapdata, soldiers, items, etc.

Constructor & Destructor Documentation

◆ SavedBattleGame()

OpenXcom::SavedBattleGame::SavedBattleGame ( )

Creates a new battle save, based on the current generic save.

Initializes a brand new battlescape saved game.

◆ ~SavedBattleGame()

OpenXcom::SavedBattleGame::~SavedBattleGame ( )

Cleans up the saved game.

Deletes the game content from memory.

Member Function Documentation

◆ addDestroyedObjective()

void OpenXcom::SavedBattleGame::addDestroyedObjective ( )

increments the objective counter.

Sets whether the objective is destroyed.

◆ addFallingUnit()

bool OpenXcom::SavedBattleGame::addFallingUnit ( BattleUnit unit)

Adds this unit to the vector of falling units.

Adds this unit to the vector of falling units, if it doesn't already exist.

Parameters
unitThe unit.
Returns
Was the unit added?

◆ allObjectivesDestroyed()

bool OpenXcom::SavedBattleGame::allObjectivesDestroyed ( ) const

Checks if all the objectives are destroyed.

Returns whether the objectives are destroyed.

Returns
True if the objectives are destroyed.

◆ calculateModuleMap()

void OpenXcom::SavedBattleGame::calculateModuleMap ( )

calculate the number of map modules remaining

calculate the number of map modules remaining by counting the map objects on the top floor who have the baseModule flag set.

we store this data in the grid as outlined in the comments above, in pairs representing initial and current values.

◆ endTurn()

void OpenXcom::SavedBattleGame::endTurn ( )

Ends the turn.

Ends the current turn and progresses to the next one.

◆ eyesOnTarget()

bool OpenXcom::SavedBattleGame::eyesOnTarget ( UnitFaction  faction,
BattleUnit unit 
)

Checks whether a particular faction has eyes on *unit (whether any unit on that faction sees *unit).

Checks whether anyone on a particular faction is looking at the unit.

Similar to getSpottingUnits() but returns a bool and stops searching if one positive hit is found.

Parameters
factionFaction to check through.
unitWhom to spot.
Returns
True when the unit can be seen

◆ getAmbientSound()

int OpenXcom::SavedBattleGame::getAmbientSound ( ) const

gets the ambient sound effect;

get the ambient battlescape sound effect.

Returns
the intended sound.

◆ getAmbientVolume()

double OpenXcom::SavedBattleGame::getAmbientVolume ( ) const

gets the ambient sound effect;

Gets the ambient sound effect volume.

Returns
the ambient sound volume.

◆ getBattleGame()

BattlescapeGame * OpenXcom::SavedBattleGame::getBattleGame ( )

Gets a pointer to the BattlescapeGame.

Gets the BattlescapeState.

Returns
Pointer to the BattlescapeState.

◆ getBattleState()

BattlescapeState * OpenXcom::SavedBattleGame::getBattleState ( )

Gets a pointer to the BattlescapeState.

Gets the BattlescapeState.

Returns
Pointer to the BattlescapeState.

◆ getChronoTrigger()

ChronoTrigger OpenXcom::SavedBattleGame::getChronoTrigger ( ) const

Gets the action that triggers when the timer runs out.

Gets the action type to perform when the timer expires.

Returns
the action type to perform.

◆ getConditionalRecoveredItems()

std::vector< BattleItem * > * OpenXcom::SavedBattleGame::getConditionalRecoveredItems ( )

gets the list of items we MIGHT get.

get the list of items we're not guaranteed to take with us (ie: items that were NOT in the skyranger)

Returns
the list of items we might get.

◆ getCurrentItemId()

int * OpenXcom::SavedBattleGame::getCurrentItemId ( )

Gets the current item ID.

Returns
Current item ID pointer.

◆ getDebugMode()

bool OpenXcom::SavedBattleGame::getDebugMode ( ) const

Gets debug mode.

Gets the current debug mode.

Returns
Debug mode.

◆ getDepth()

int OpenXcom::SavedBattleGame::getDepth ( ) const

get the depth of the battlescape game.

check the depth of the battlescape.

Returns
depth.

◆ getFallingUnits()

std::list< BattleUnit * > * OpenXcom::SavedBattleGame::getFallingUnits ( )

Gets the vector of falling units.

Gets all units in the battlescape that are falling.

Returns
The falling units in the battlescape.

◆ getGeoscapeSave()

SavedGame * OpenXcom::SavedBattleGame::getGeoscapeSave ( )

a shortcut to the geoscape save.

get a pointer to the geoscape save

Returns
a pointer to the geoscape save.

◆ getGlobalShade()

int OpenXcom::SavedBattleGame::getGlobalShade ( ) const

Gets the global shade.

Returns
The global shade.

◆ getGuaranteedRecoveredItems()

std::vector< BattleItem * > * OpenXcom::SavedBattleGame::getGuaranteedRecoveredItems ( )

gets the list of items we're guaranteed.

get the list of items we're guaranteed to take with us (ie: items that were in the skyranger)

Returns
the list of items we're garaunteed.

◆ getHighestRankedXCom()

BattleUnit * OpenXcom::SavedBattleGame::getHighestRankedXCom ( )

Gets the highest ranked, living XCom unit.

Returns
The highest ranked, living XCom unit.

◆ getItems()

std::vector< BattleItem * > * OpenXcom::SavedBattleGame::getItems ( )

Gets a pointer to the list of items.

Gets the list of items.

Returns
Pointer to the list of items.

◆ getKneelReserved()

bool OpenXcom::SavedBattleGame::getKneelReserved ( ) const

get whether we are reserving TUs to kneel.

Gets the kneel reservation setting.

Returns
Should we reserve an extra 4 TUs to kneel?

◆ getMapDataSets()

std::vector< MapDataSet * > * OpenXcom::SavedBattleGame::getMapDataSets ( )

Gets the game's mapdatafiles.

Gets the array of mapblocks.

Returns
Pointer to the array of mapblocks.

◆ getMapSizeX()

int OpenXcom::SavedBattleGame::getMapSizeX ( ) const

Gets terrain size x.

Gets the map width.

Returns
The map width (Size X) in tiles.

◆ getMapSizeXYZ()

int OpenXcom::SavedBattleGame::getMapSizeXYZ ( ) const

Gets terrain x*y*z.

Gets the map size in tiles.

Returns
The map size.

◆ getMapSizeY()

int OpenXcom::SavedBattleGame::getMapSizeY ( ) const

Gets terrain size y.

Gets the map length.

Returns
The map length (Size Y) in tiles.

◆ getMapSizeZ()

int OpenXcom::SavedBattleGame::getMapSizeZ ( ) const

Gets terrain size z.

Gets the map height.

Returns
The map height (Size Z) in layers.

◆ getMissionType()

std::string OpenXcom::SavedBattleGame::getMissionType ( ) const

Gets the mission type.

Returns
The mission type.

◆ getModuleMap()

std::vector< std::vector< std::pair< int, int > > > & OpenXcom::SavedBattleGame::getModuleMap ( )

get a reference to the baseModules map.

Return a reference to the base module destruction map this map contains information on how many destructible base modules remain at any given grid reference in the basescape, using [x][y] format.

-1 for "no items" 0 for "destroyed" and any actual number represents how many left.

Returns
the base module damage map.

◆ getMoraleModifier()

int OpenXcom::SavedBattleGame::getMoraleModifier ( BattleUnit unit = 0)

Gets the morale modifier for XCom based on the highest ranked, living XCom unit, or the modifier for the unit passed to this function.

Gets the morale modifier for.

  • either XCom based on the highest ranked, living XCom unit,
  • or the unit passed to this function.
    Parameters
    unitUnit.
    Returns
    The morale modifier.

◆ getMusic()

std::string & OpenXcom::SavedBattleGame::getMusic ( )

Get the name of the music track.

Get the music track for the current battle.

Returns
the name of the music track.

◆ getNodes()

std::vector< Node * > * OpenXcom::SavedBattleGame::getNodes ( )

Gets a pointer to the list of nodes.

Gets the list of nodes.

Returns
Pointer to the list of nodes.

◆ getObjectiveType()

SpecialTileType OpenXcom::SavedBattleGame::getObjectiveType ( ) const

Gets the objective type of this mission.

Get the objective type for the current battle.

Returns
the objective type.

◆ getPathfinding()

Pathfinding * OpenXcom::SavedBattleGame::getPathfinding ( ) const

Gets the pathfinding object.

Returns
Pointer to the pathfinding object.

◆ getPatrolNode()

Node * OpenXcom::SavedBattleGame::getPatrolNode ( bool  scout,
BattleUnit unit,
Node fromNode 
)

Gets a patrol node.

Finds a fitting node where a unit can patrol to.

Parameters
scoutIs the unit scouting?
unitPointer to the unit (to get its position).
fromNodePointer to the node the unit is at.
Returns
Pointer to the chosen node.

◆ getSelectedUnit()

BattleUnit * OpenXcom::SavedBattleGame::getSelectedUnit ( ) const

Gets the currently selected unit.

Returns
Pointer to BattleUnit.

◆ getSide()

UnitFaction OpenXcom::SavedBattleGame::getSide ( ) const

Gets the playing side.

Gets the side currently playing.

Returns
The unit faction currently playing.

◆ getSpawnNode()

Node * OpenXcom::SavedBattleGame::getSpawnNode ( int  nodeRank,
BattleUnit unit 
)

Gets a spawn node.

Finds a fitting node where a unit can spawn.

Parameters
nodeRankRank of the node (this is not the rank of the alien!).
unitPointer to the unit (to get its position).
Returns
Pointer to the chosen node.

◆ getStorageSpace()

std::vector< Position > & OpenXcom::SavedBattleGame::getStorageSpace ( )

give me access to the storage tiles vector.

Gives access to the "storage space" vector, for distribution of items in base defense missions.

Returns
Vector of storage positions.

◆ getTile()

Tile* OpenXcom::SavedBattleGame::getTile ( Position  pos) const
inline

Gets the Tile at a given position on the map.

This method is called over 50mil+ times per turn so it seems useful to inline it.

Parameters
posMap position.
Returns
Pointer to the tile at that position.

◆ getTileCoords()

void OpenXcom::SavedBattleGame::getTileCoords ( int  index,
int *  x,
int *  y,
int *  z 
) const

Converts a tile index to its coordinates.

Converts a tile index to coordinates.

Parameters
indexThe (unique) tileindex.
xPointer to the X coordinate.
yPointer to the Y coordinate.
zPointer to the Z coordinate.

◆ getTileEngine()

TileEngine * OpenXcom::SavedBattleGame::getTileEngine ( ) const

Gets a pointer to the tileengine.

Gets the terrain modifier object.

Returns
Pointer to the terrain modifier object.

◆ getTileIndex()

int OpenXcom::SavedBattleGame::getTileIndex ( Position  pos) const
inline

Converts coordinates into a unique index.

getTile() calls this every time, so should be inlined along with it.

Parameters
posThe position to convert.
Returns
A unique index.

◆ getTiles()

Tile ** OpenXcom::SavedBattleGame::getTiles ( ) const

Gets a pointer to the tiles, a tile is the smallest component of battlescape.

Gets the array of tiles.

Returns
A pointer to the Tile array.

◆ getTileSearch()

const std::vector< Position > & OpenXcom::SavedBattleGame::getTileSearch ( ) const

get an 11x11 grid of positions (-10 to +10) to check.

Returns
the tilesearch vector for use in AI functions.

◆ getTUReserved()

BattleActionType OpenXcom::SavedBattleGame::getTUReserved ( ) const

get the reserved fire mode.

Gets the TU reserved type.

Returns
A battleactiontype.

◆ getTurn()

int OpenXcom::SavedBattleGame::getTurn ( ) const

Gets the turn number.

Gets the current turn number.

Returns
The current turn.

◆ getTurnLimit()

int OpenXcom::SavedBattleGame::getTurnLimit ( ) const

Gets the turn limit for this mission.

Gets the maximum number of turns we have before this mission ends.

Returns
the turn limit.

◆ getUnits()

std::vector< BattleUnit * > * OpenXcom::SavedBattleGame::getUnits ( )

Gets a pointer to the list of units.

Gets the list of units.

Returns
Pointer to the list of units.

◆ getUnitsFalling()

bool OpenXcom::SavedBattleGame::getUnitsFalling ( ) const

Checks the status of the switch that says "there are units falling".

Returns whether there are any units falling in the battlescape.

Returns
True if there are any units falling in the battlescape.

◆ initMap()

void OpenXcom::SavedBattleGame::initMap ( int  mapsize_x,
int  mapsize_y,
int  mapsize_z,
bool  resetTerrain = true 
)

Sets the dimensions of the map and initializes it.

Initializes the array of tiles and creates a pathfinding object.

Parameters
mapsize_x
mapsize_y
mapsize_z

◆ initUtilities()

void OpenXcom::SavedBattleGame::initUtilities ( Mod mod)

Initialises the pathfinding and tileengine.

Initializes the map utilities.

Parameters
modPointer to mod.

◆ isAborted()

bool OpenXcom::SavedBattleGame::isAborted ( ) const

Checks if the mission was aborted.

Returns whether the mission was aborted or successful.

Returns
True, if the mission was aborted, or false, if the mission was successful.

◆ isCheating()

bool OpenXcom::SavedBattleGame::isCheating ( ) const

check if the AI has engaged cheat mode.

is the AI allowed to cheat?

Returns
true if cheating.

◆ isItemUsable()

bool OpenXcom::SavedBattleGame::isItemUsable ( RuleItem item) const

Checks if an item is usable on this map.

Checks if an item can be used in the current battlescape conditions.

Returns
True if it's usable, False otherwise.

◆ load()

void OpenXcom::SavedBattleGame::load ( const YAML::Node &  node,
Mod mod,
SavedGame savedGame 
)

Loads a saved battle game from YAML.

Loads the saved battle game from a YAML file.

Parameters
nodeYAML node.
modfor the saved game.
savedGamePointer to saved game.

◆ loadMapResources()

void OpenXcom::SavedBattleGame::loadMapResources ( Mod mod)

Load map resources.

Loads the resources required by the map in the battle save.

Parameters
modPointer to the mod.

◆ placeUnitNearPosition()

bool OpenXcom::SavedBattleGame::placeUnitNearPosition ( BattleUnit unit,
const Position entryPoint,
bool  largeFriend 
)

Attempts to place a unit on or near entryPoint.

Places a unit on or near a position.

Parameters
unitThe unit to place.
entryPointThe position around which to attempt to place the unit.
Returns
True if the unit was successfully placed.

◆ prepareNewTurn()

void OpenXcom::SavedBattleGame::prepareNewTurn ( )

Carries out new turn preparations.

Carries out new turn preparations such as fire and smoke spreading.

◆ randomizeItemLocations()

void OpenXcom::SavedBattleGame::randomizeItemLocations ( Tile t)

move all the leftover items to random locations in the storage tiles vector.

Move all the leftover items in base defense missions to random locations in the storage facilities.

Parameters
tthe tile where all our goodies are initially stored.

◆ removeItem()

void OpenXcom::SavedBattleGame::removeItem ( BattleItem item)

Removes an item from the game.

Eg. when ammo item is depleted.

Parameters
itemThe Item to remove.

◆ resetTiles()

void OpenXcom::SavedBattleGame::resetTiles ( )

Resets the visibility of all tiles on the map.

Resets visibility of all the tiles on the map.

◆ resetUnitHitStates()

void OpenXcom::SavedBattleGame::resetUnitHitStates ( )

Reset all the unit hit state flags.

Resets all unit hit state flags.

◆ resetUnitTiles()

void OpenXcom::SavedBattleGame::resetUnitTiles ( )

Resets tiles units are standing on.

Resets all the units to their current standing tile(s).

◆ reviveUnconsciousUnits()

void OpenXcom::SavedBattleGame::reviveUnconsciousUnits ( )

Revives unconscious units (healthcheck).

Checks for units that are unconscious and revives them if they shouldn't be.

Revived units need a tile to stand on. If the unit's current position is occupied, then all directions around the tile are searched for a free tile to place the unit in. If no free tile is found the unit stays unconscious.

◆ save()

YAML::Node OpenXcom::SavedBattleGame::save ( ) const

Saves a saved battle game to YAML.

Saves the saved battle game to a YAML file.

Returns
YAML node.

◆ selectNextPlayerUnit()

BattleUnit * OpenXcom::SavedBattleGame::selectNextPlayerUnit ( bool  checkReselect = false,
bool  setReselect = false,
bool  checkInventory = false 
)

Selects the next soldier.

Selects the next player unit.

Parameters
checkReselectWhether to check if we should reselect a unit.
setReselectDon't reselect a unit.
checkInventoryWhether to check if the unit has an inventory.
Returns
Pointer to new selected BattleUnit, NULL if none can be selected.
See also
selectPlayerUnit

◆ selectPreviousPlayerUnit()

BattleUnit * OpenXcom::SavedBattleGame::selectPreviousPlayerUnit ( bool  checkReselect = false,
bool  setReselect = false,
bool  checkInventory = false 
)

Selects the previous soldier.

Selects the previous player unit.

Parameters
checkReselectWhether to check if we should reselect a unit.
setReselectDon't reselect a unit.
checkInventoryWhether to check if the unit has an inventory.
Returns
Pointer to new selected BattleUnit, NULL if none can be selected.
See also
selectPlayerUnit

◆ selectUnit()

BattleUnit * OpenXcom::SavedBattleGame::selectUnit ( Position  pos)

Selects the unit with position on map.

Selects the unit at the given position on the map.

Parameters
posPosition.
Returns
Pointer to a BattleUnit, or 0 when none is found.

◆ setAborted()

void OpenXcom::SavedBattleGame::setAborted ( bool  flag)

Sets whether the mission was aborted.

Sets whether the mission was aborted or successful.

Parameters
flagTrue, if the mission was aborted, or false, if the mission was successful.

◆ setAmbientSound()

void OpenXcom::SavedBattleGame::setAmbientSound ( int  sound)

sets the ambient sound effect;

set the ambient battlescape sound effect.

Parameters
soundthe intended sound.

◆ setAmbientVolume()

void OpenXcom::SavedBattleGame::setAmbientVolume ( double  volume)

sets the ambient sound effect;

Sets the ambient sound effect volume.

Parameters
volumethe ambient volume.

◆ setBattleState()

void OpenXcom::SavedBattleGame::setBattleState ( BattlescapeState bs)

Sets the pointer to the BattlescapeState.

Sets the BattlescapeState.

Parameters
bsA Pointer to a BattlescapeState.

◆ setCheatTurn()

void OpenXcom::SavedBattleGame::setCheatTurn ( int  turn)

Sets the turn to start the aliens cheating.

Sets the turn at which the players become exposed to the AI.

Parameters
turnthe turn to start cheating.

◆ setChronoTrigger()

void OpenXcom::SavedBattleGame::setChronoTrigger ( ChronoTrigger  trigger)

Sets the action that triggers when the timer runs out.

Sets the action type to occur when the timer runs out.

Parameters
triggerthe action type to perform.

◆ setDebugMode()

void OpenXcom::SavedBattleGame::setDebugMode ( )

Sets debug mode.

Turns on debug mode.

◆ setDepth()

void OpenXcom::SavedBattleGame::setDepth ( int  depth)

set the depth of the battlescape game.

Parameters
depththe intended depth 0-3.

◆ setGlobalShade()

void OpenXcom::SavedBattleGame::setGlobalShade ( int  shade)

Sets the global shade.

Parameters
shadeThe global shade.

◆ setKneelReserved()

void OpenXcom::SavedBattleGame::setKneelReserved ( bool  reserved)

set whether we are reserving TUs to kneel.

Sets the kneel reservation setting.

Parameters
reservedShould we reserve an extra 4 TUs to kneel?

◆ setMissionType()

void OpenXcom::SavedBattleGame::setMissionType ( const std::string &  missionType)

Sets the mission type.

Parameters
missionTypeThe mission type.

◆ setMusic()

void OpenXcom::SavedBattleGame::setMusic ( const std::string &  track)

Set the name of the music track.

Set the music track for this battle.

Parameters
trackthe track name.

◆ setObjectiveCount()

void OpenXcom::SavedBattleGame::setObjectiveCount ( int  counter)

Sets how many objectives need to be destroyed.

increments the number of objectives to be destroyed.

◆ setObjectiveType()

void OpenXcom::SavedBattleGame::setObjectiveType ( int  type)

Sets the objective type for this mission.

Set the objective type for the current battle.

Parameters
theobjective type.

◆ setPaletteByDepth()

void OpenXcom::SavedBattleGame::setPaletteByDepth ( State state)

uses the depth variable to set a palette.

uses the depth variable to choose a palette.

Parameters
statethe state to set the palette for.

◆ setSelectedUnit()

void OpenXcom::SavedBattleGame::setSelectedUnit ( BattleUnit unit)

Sets the currently selected unit.

Parameters
unitPointer to BattleUnit.

◆ setTUReserved()

void OpenXcom::SavedBattleGame::setTUReserved ( BattleActionType  reserved)

set the reserved fire mode.

Sets the TU reserved type.

Parameters
reservedA battleactiontype.

◆ setTurnLimit()

void OpenXcom::SavedBattleGame::setTurnLimit ( int  limit)

Sets the turn limit for this mission.

Parameters
limitthe turn limit.

◆ setUnitPosition()

bool OpenXcom::SavedBattleGame::setUnitPosition ( BattleUnit bu,
Position  position,
bool  testOnly = false 
)

Sets or tries to set a unit of a certain size on a certain position of the map.

Places units on the map.

Handles large units that are placed on multiple tiles.

Parameters
buThe unit to be placed.
positionThe position to place the unit.
testOnlyIf true then just checks if the unit can be placed at the position.
Returns
True if the unit could be successfully placed.

◆ setUnitsFalling()

void OpenXcom::SavedBattleGame::setUnitsFalling ( bool  fall)

Toggles the switch that says "there are units falling, start the fall state".

Parameters
fallTrue if there are any units falling in the battlescape.

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