Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

GameState Class Reference

#include <GameState.h>

Collaboration diagram for GameState:

Collaboration graph
[legend]
List of all members.

Static Public Methods

vector< Player * > & players ()
 The global list of players.

vector< MilitaryUnit * > & units ()
 The global list of military units.

vector< MilitaryUnit * > & selectedUnits ()
 The list of units currently selected.

vector< City * > & cities ()
 The global list of cities.

vector< DrawableObject * > & drawables ()
 The global list of drawable objects. (list of units and cities).

void addMilitaryUnit (MilitaryUnit *unit)
 Add a unit to the game state.

MilitaryUnitgetMilitaryUnit (uint uniqueID)
 returns a pointer to the military unit with the uniqueID given or NULL if no unit exists.

void addCity (City *city)
 Add a city to the game state.

CitygetCity (uint uniqueID)
 returns a pointer to the city with the uniqueID given or NULL if no city exists.

PlayerfindPlayer (const Vec3D &teamColor)
 Find a player given the team color.

vector< BattleEntry * > & battles ()
 The battles happening in the game.

BattleEntryactiveBattle ()
 The currently active battle.

void setActiveBattle (BattleEntry *battle)
 Set the active battle.

BattleEntrygetBattle (uint uniqueID)
 returns a pointer to the battle with the uniqueID given or NULL if no battle exists.

MessagesReceived & messagesReceived (void)
 For printing chat messages received over the network.

Vec3DcamTarget ()
 The camera target, the point where the camera is centered.

void setWorldMap (const Map::WorldMap &map)
 Set the world map, contains bounds the units must be contained in.

const Map::WorldMapworldMap ()
PlayerconsolePlayer ()
 Gets and sets for the player sitting at the console. i.e. physically at the machine the game is running on.

void setConsolePlayer (Player *consolePlayer)
ControlMode controlMode ()
 Get and set for the control mode: NORMAL --> player can only control their side GOD --> player can control all sides.

void setControlMode (ControlMode mode)
vector< int > & availableRFM ()

Private Methods

 GameState ()

Static Private Attributes

BattleEntrym_activeBattle
Map::WorldMap m_worldMap
Playerm_consolePlayer
ControlMode m_controlMode

Constructor & Destructor Documentation

GameState::GameState   [private]
 


Member Function Documentation

BattleEntry * GameState::activeBattle   [static]
 

The currently active battle.

Definition at line 123 of file GameState.cpp.

References m_activeBattle.

Referenced by BattleGroup::destroyUnit(), Overhead::doCollisionDetection(), BattleGroup::fire(), BattleJets::fireAntiAirMissiles(), BattleJets::fireAntiSurfaceMissiles(), Overhead::overhead_render(), Overhead::overhead_update(), Overhead::processInput(), HUD::processOverheadInput(), HUD::render(), sendReinforcement(), HUD::switchToNextBattle(), HUD::switchToPrevBattle(), BattleJets::takeHit(), and Overhead::updateBattleEntries().

00124 {
00125   return m_activeBattle;
00126 }

void GameState::addCity City   city [static]
 

Add a city to the game state.

Definition at line 70 of file GameState.cpp.

References cities(), and drawables().

Referenced by Overhead::loadMap().

00071 {
00072         cities().push_back(city);
00073         drawables().push_back(city);
00074 }

void GameState::addMilitaryUnit MilitaryUnit   unit [static]
 

Add a unit to the game state.

Definition at line 54 of file GameState.cpp.

References drawables(), and units().

Referenced by Overhead::loadMap(), City::update(), and Overhead::updateBattleEntries().

00055 {
00056         units().push_back(unit);
00057         drawables().push_back(unit);
00058 }

vector< int > & GameState::availableRFM   [static]
 

Definition at line 171 of file GameState.cpp.

Referenced by Overhead::overhead_init(), Overhead::overhead_update(), and HUD::render().

00172 {
00173         static vector<int> availableRFMVec;
00174         return availableRFMVec;
00175 }

vector< BattleEntry * > & GameState::battles   [static]
 

The battles happening in the game.

Definition at line 92 of file GameState.cpp.

Referenced by Overhead::doTutorial(), Overhead::doVictoryTest(), getBattle(), Overhead::overheadRender(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), HUD::processOverheadInput(), HUD::renderMiniMap(), HUD::switchToNextBattle(), HUD::switchToPrevBattle(), and Helper::totalUnitsForPlayer().

00093 {
00094         static vector<BattleEntry*> theBattles;
00095         return theBattles;
00096 }

Vec3D & GameState::camTarget   [static]
 

The camera target, the point where the camera is centered.

Definition at line 114 of file GameState.cpp.

References Vec3D.

Referenced by Overhead::overhead_init(), Overhead::overhead_update(), HUD::processMiniMapInput(), and Overhead::processOverheadInput().

00115 {
00116   static Vec3D m_camTarget(0.0f, 0.0f, 0.0f);
00117   return m_camTarget;
00118 }

vector< City * > & GameState::cities   [static]
 

The global list of cities.

Definition at line 42 of file GameState.cpp.

Referenced by addCity(), Overhead::doVictoryTest(), getCity(), Jet::goal(), Overhead::overhead_init(), Globals::OverheadCollisionWithCity(), HUD::renderMiniMap(), Helper::totalCitiesForPlayer(), and Helper::totalUnitsBeingBuiltForPlayer().

00043 {
00044         static vector<City*> m_cities;
00045         return m_cities;
00046 }

Player * GameState::consolePlayer   [static]
 

Gets and sets for the player sitting at the console. i.e. physically at the machine the game is running on.

Definition at line 149 of file GameState.cpp.

References m_consolePlayer.

Referenced by Overhead::amIInThisBattle(), Overhead::doCollisionDetection(), Overhead::doVictoryTest(), BattleGroup::fire(), BattleEntry::initBattle(), Overhead::overhead_update(), Overhead::processCommand(), NetworkSubsystem::processNetworkData(), Overhead::processOverheadInput(), HUD::processOverheadInput(), HUD::render(), City::trainUnit(), and City::update().

00150 {
00151   return m_consolePlayer;
00152 }

ControlMode GameState::controlMode   [static]
 

Get and set for the control mode: NORMAL --> player can only control their side GOD --> player can control all sides.

Definition at line 161 of file GameState.cpp.

References ControlMode, and m_controlMode.

Referenced by BattleEntry::inputSelectGroups(), and Overhead::processOverheadInput().

00162 { 
00163   return m_controlMode;
00164 }

vector< DrawableObject * > & GameState::drawables   [static]
 

The global list of drawable objects. (list of units and cities).

Definition at line 48 of file GameState.cpp.

Referenced by addCity(), and addMilitaryUnit().

00049 {
00050         static vector<DrawableObject*> m_drawables;
00051         return m_drawables;
00052 }

Player * GameState::findPlayer const Vec3D   teamColor [static]
 

Find a player given the team color.

Definition at line 85 of file GameState.cpp.

References players().

Referenced by Overhead::updateBattleEntries().

00086 {
00087         for(size_t i=0; i < players().size(); ++i)
00088                 if( players()[i]->color() == teamColor) return players()[i];
00089         return 0;
00090 }

BattleEntry * GameState::getBattle uint    uniqueID [static]
 

returns a pointer to the battle with the uniqueID given or NULL if no battle exists.

Definition at line 98 of file GameState.cpp.

References battles().

00099 {
00100         for(vector<BattleEntry*>::iterator iter = battles().begin(); iter != battles().end(); ++iter)
00101         {
00102                 BattleEntry* battle = *iter;
00103                 if((*iter)->uniqueID() == uniqueID) return *iter;
00104         }
00105         return 0;
00106 }

City * GameState::getCity uint    uniqueID [static]
 

returns a pointer to the city with the uniqueID given or NULL if no city exists.

Definition at line 76 of file GameState.cpp.

References cities().

Referenced by Jet::goal(), Jet::Jet(), Overhead::updateBattleEntries(), and Jet::~Jet().

00077 {
00078         for(vector<City*>::iterator iter = cities().begin(); iter != cities().end(); ++iter)
00079         {
00080                 if ((*iter)->uniqueID() == uniqueID) return *iter;
00081         }
00082         return 0;
00083 }

MilitaryUnit * GameState::getMilitaryUnit uint    uniqueID [static]
 

returns a pointer to the military unit with the uniqueID given or NULL if no unit exists.

:

Definition at line 60 of file GameState.cpp.

References units().

00061 {
00063         for(vector<MilitaryUnit*>::iterator iter = units().begin(); iter != units().end(); ++iter)
00064         {
00065                 if((*iter)->uniqueID() == uniqueID) return *iter;
00066         }
00067         return 0;
00068 }

MessagesReceived & GameState::messagesReceived void    [static]
 

For printing chat messages received over the network.

Definition at line 108 of file GameState.cpp.

Referenced by City::changeOwner(), Overhead::doCollisionDetection(), Overhead::overhead_init(), Overhead::overhead_render(), Overhead::overhead_update(), Overhead::printPlayerList(), Overhead::processCommand(), NetworkSubsystem::processNetworkData(), and City::trainUnit().

00109 {
00110         static MessagesReceived theMessagesReceived;
00111         return theMessagesReceived;
00112 }

vector< Player * > & GameState::players   [static]
 

The global list of players.

Definition at line 24 of file GameState.cpp.

Referenced by findPlayer(), Helper::playerNumberToPlayerPointer(), and NetworkSubsystem::processNetworkData().

00025 {
00026         static vector<Player*> m_players;
00027         return m_players;
00028 }

vector< MilitaryUnit * > & GameState::selectedUnits   [static]
 

The list of units currently selected.

Definition at line 36 of file GameState.cpp.

Referenced by HUD::processMiniMapInput().

00037 {
00038   static vector<MilitaryUnit*> m_selectedUnits;
00039   return m_selectedUnits;
00040 }

void GameState::setActiveBattle BattleEntry   battle [static]
 

Set the active battle.

Definition at line 128 of file GameState.cpp.

References m_activeBattle.

Referenced by Overhead::doCollisionDetection(), Overhead::overhead_update(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), HUD::switchToNextBattle(), HUD::switchToOverhead(), HUD::switchToPrevBattle(), and Overhead::updateBattleEntries().

00129 {
00130   m_activeBattle = battle;
00131 }

void GameState::setConsolePlayer Player   consolePlayer [static]
 

Definition at line 154 of file GameState.cpp.

References m_consolePlayer.

Referenced by Overhead::overhead_init().

00155 {
00156   m_consolePlayer = cp;
00157 }

void GameState::setControlMode ControlMode    mode [static]
 

Definition at line 166 of file GameState.cpp.

References m_controlMode.

Referenced by Overhead::overhead_init(), and Overhead::processCommand().

00167 {
00168   m_controlMode = mode;
00169 }

void GameState::setWorldMap const Map::WorldMap   map [static]
 

Set the world map, contains bounds the units must be contained in.

Definition at line 136 of file GameState.cpp.

References m_worldMap.

Referenced by Overhead::loadMap().

00137 {
00138   m_worldMap = map;
00139 }

vector< MilitaryUnit * > & GameState::units   [static]
 

The global list of military units.

Definition at line 30 of file GameState.cpp.

Referenced by addMilitaryUnit(), City::changeOwner(), Overhead::doVictoryTest(), getMilitaryUnit(), Overhead::getSelectedUnits(), Overhead::getSurroundingUnits(), Overhead::overhead_update(), Globals::OverheadCollisonWithIdleUnit(), HUD::renderMiniMap(), sendReinforcement(), Overhead::setSelectedUnits(), Helper::totalUnitsForPlayer(), and Overhead::updateBattleEntries().

00031 {
00032         static vector<MilitaryUnit*> m_units;
00033         return m_units;
00034 }

const Map::WorldMap & GameState::worldMap   [static]
 

Definition at line 141 of file GameState.cpp.

References m_worldMap.

Referenced by MilitaryUnit::move(), HUD::processMiniMapInput(), and Overhead::processOverheadInput().

00142 {
00143   return m_worldMap;
00144 }


Member Data Documentation

BattleEntry * GameState::m_activeBattle [static, private]
 

Definition at line 121 of file GameState.cpp.

Referenced by activeBattle(), and setActiveBattle().

Player * GameState::m_consolePlayer [static, private]
 

Definition at line 147 of file GameState.cpp.

Referenced by consolePlayer(), and setConsolePlayer().

ControlMode GameState::m_controlMode [static, private]
 

Referenced by controlMode(), and setControlMode().

Map::WorldMap GameState::m_worldMap [static, private]
 

Definition at line 134 of file GameState.cpp.

Referenced by setWorldMap(), and worldMap().


The documentation for this class was generated from the following files:
Generated on Wed Apr 23 05:52:06 2003 for Modern Warfare by doxygen1.3-rc2