Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

City Class Reference

#include <city.h>

Inheritance diagram for City:

Persistence UI List of all members.

Public Member Functions

 City (const uint width=OC_CITY_W, const uint length=OC_CITY_L, const OC_DATE foundedDate=0, const int difficulty=2)
void SaveTo (std::fstream &rfs)
void LoadFrom (std::fstream &rfs)
void uiKeyboard (const SDL_KeyboardEvent &rcsSDLKeyboardEvent)
void uiMouseMotion (const SDL_MouseMotionEvent &rcsSDLMouseMotionEvent)
void uiMouseButton (const SDL_MouseButtonEvent &rcsSDLMouseButtonEvent)
void uiExpose (const SDL_ExposeEvent &rcsSDLExposeEvent)
void uiResize (const SDL_ResizeEvent &rcsSDLResizeEvent)
void SetCurrentLayer (OPENCITY_CITY_LAYER enumNewLayer)
void Run (OPENCITY_CITY_SPEED enumSpeed=LAST_SPEED)
LayerGetLayer (OPENCITY_CITY_LAYER enumLayer) const
const void GetWL (uint &w, uint &l) const

Private Member Functions

void _CreateSimulator ()
void _DeleteSimulator ()
void _CreateGUI ()
void _DeleteGUI ()
void _DoTool (const SDL_MouseButtonEvent &sdlMBEvent)
bool _HandleKeyPressed ()
void _DoBill (const OPENCITY_PROPERTY_CODE &)
void _HandleGUIClick ()
void _HandleMouseXY ()
void _TestPathfinding ()
void _BuildPreview ()
bool _Save (const string &strFilename)
bool _Load (const string &strFilename)

Private Attributes

string strCityName
 The name of the city.
int iDifficulty
 The difficulty of current game.
string strFileName
 The fileName of current city.
OC_DATE cityFoundedDate
OC_LINT _liCityFund
 Money, money, money !
bool boolModified
uint _uiDay
uint _uiMonth
uint _uiYear
OC_CHAR _cTool
 Tool hotkey.
uint _uiWidth
 City's width, length.
uint _uiLength
int iWinWidth
 Windows' width, height.
int iWinHeight
bool boolLMBPressed
uint uiMapW1
uint uiMapL1
uint uiMapW2
uint uiMapL2
bool booltabKeyPressed [KEY_NUMBER]
OPENCITY_CITY_LAYER enumCurrentLayer
OPENCITY_CITY_SPEED enumCurrentSpeed
OPENCITY_TOOL_CODE enumCurrentTool
LayerptabLayer [4]
bool boolPathGo
uint uiPathStartW
uint uiPathStartH
uint uiPathStopW
uint uiPathStopH
GUIContainerpctrPath
GUIButtonpbtnPathStart
GUIButtonpbtnPathStop1
GUIButtonpbtnPathStop2
GUIButtonpbtnTestBuilding
Vehiclepvehicle
uint uiVehicleType
GUIContainerpctrMAS
GUIButtonpbtnMAS
GUIButtonpbtnMASPolice
GUIButtonpbtnMASDemonstrator
GUIButtonpbtnMASRobber
MainSim_pMSim
SDL_Thread * _pthreadMSim
GUIButtonpbtnSplash
GUIContainerpctr
GUIContainerpctrMain
GUIContainerpctrL
GUIContainerpctrT
GUIContainerpctrQ
GUIContainerpctrZ
GUIContainerpctrG
GUIContainerpctrN
GUIContainerpctrS
GUIButtonpbtnZ
GUIButtonpbtnS
GUIButtonpbtnL
GUIButtonpbtnP
GUIButtonpbtnX
GUIButtonpbtnG
GUIButtonpbtnZB
GUIButtonpbtnZR
GUIButtonpbtnZC
GUIButtonpbtnZI
GUIButtonpbtnLB
GUIButtonpbtnLL
GUIButtonpbtnLE
GUIButtonpbtnTB
GUIButtonpbtnTU
GUIButtonpbtnTD
GUIButtonpbtnTX
GUIButtonpbtnTQ
GUIButtonpbtnGB
GUIButtonpbtnGP
GUIButtonpbtnGE
GUIButtonpbtnGH
GUIButtonpbtnGL
GUIButtonpbtnGF
GUIButtonpbtnNB
GUIButtonpbtnNP
GUIButtonpbtnNT
GUIButtonpbtnSB
GUIButtonpbtnSS
GUIButtonpbtnSL

Detailed Description

The game is here ! This class controls all other classes.

Definition at line 44 of file city.h.


Member Function Documentation

void City::_CreateGUI  )  [private]
 

Create the Graphic User Interface or ToolCircle

See also:
_DeleteGUI()

Definition at line 823 of file city.cpp.

References GUIContainer::Add().

void City::_CreateSimulator  )  [private]
 

Create all the threads which handle the simulation aspect

See also:
_DeleteSimulator()

Definition at line 786 of file city.cpp.

References GlobalVar::gpMapMgr, GlobalVar::gpmutexSim, and MainSim::Run().

void City::_DeleteGUI  )  [private]
 

Free the memory used by the GUI

See also:
_CreateGUI()

Definition at line 941 of file city.cpp.

void City::_DeleteSimulator  )  [private]
 

Wait for the simulation thread's exit

See also:
_CreateSimulator()

Definition at line 806 of file city.cpp.

References MainSim::Return().

bool City::_Load const string &  strFilename  )  [private]
 

Save the game

Returns:
true if everything goes fine, false otherwise

Definition at line 1815 of file city.cpp.

References _uiWidth, MainSim::AddStructure(), Renderer::boolHeightChange, GlobalVar::gpMapMgr, GlobalVar::gpMoveMgr, GlobalVar::gpmutexSim, GlobalVar::gpRenderer, MainSim::LoadFrom(), Persistence::LoadFrom(), Map::LoadFrom(), LoadFrom(), MainSim::RefreshSimValue(), and MovementManager::Remove().

bool City::_Save const string &  strFilename  )  [private]
 

Save the game

Returns:
true if everything goes fine, false otherwise

Definition at line 1780 of file city.cpp.

References GlobalVar::gpMapMgr, GlobalVar::gpmutexSim, MainSim::SaveTo(), Persistence::SaveTo(), Map::SaveTo(), and SaveTo().

void City::LoadFrom std::fstream &  rfs  )  [virtual]
 

Load the data from the specified stream

Parameters:
rfs A reference to a file stream which is ready for reading

Implements Persistence.

Definition at line 158 of file city.cpp.

References _liCityFund, and _uiWidth.

Referenced by _Load().

void City::SaveTo std::fstream &  rfs  )  [virtual]
 

Save the data to the specified fstream

Parameters:
rfs A reference to a file stream which is ready for writing

Implements Persistence.

Definition at line 143 of file city.cpp.

References _liCityFund, and _uiWidth.

Referenced by _Save().


The documentation for this class was generated from the following files:
Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2