#include <mainsim.h>
Inheritance diagram for MainSim:
Public Types | |
enum | OPENCITY_MICROSIM { OC_MICROSIM_RES = 0, OC_MICROSIM_COM, OC_MICROSIM_IND, OC_MICROSIM_ELE, OC_MICROSIM_TRA, OC_MICROSIM_MAX, OC_MICROSIM_DEFAULT } |
Public Member Functions | |
MainSim (SDL_mutex *mutex, BuildingLayer *pblayer, Map *pmap) | |
~MainSim () | |
void | SaveTo (std::fstream &rfs) |
void | LoadFrom (std::fstream &rfs) |
int | Main () |
void | AddStructure (const uint w1, const uint l1, const uint w2, const uint l2, const OPENCITY_MICROSIM sim=OC_MICROSIM_DEFAULT) |
void | RemoveStructure (const uint w1, const uint l1, const uint w2, const uint l2, const OPENCITY_MICROSIM sim=OC_MICROSIM_DEFAULT) |
void | Run () |
void | Stop () |
void | Return () |
void | RefreshSimValue () |
const int | GetValue (const OPENCITY_MICROSIM sim) const |
Private Attributes | |
Simulator * | _tpSimulator [OC_MICROSIM_MAX] |
Table of pointers to Simulator object. |
Definition at line 31 of file mainsim.h.
|
Each enumeration corresponds to a specific micro simulator |
|
Constructs a new MainSim object.
Definition at line 34 of file mainsim.cpp. References _tpSimulator, GlobalVar::gpMoveMgr, GlobalVar::gpPathFinder, OC_MICROSIM_COM, OC_MICROSIM_ELE, OC_MICROSIM_IND, OC_MICROSIM_RES, and OC_MICROSIM_TRA. |
|
Destructs a MainSim object. Definition at line 52 of file mainsim.cpp. References _tpSimulator, and OC_MICROSIM_MAX. |
|
Notifies the micro simulators that a new structure has been added to the system
Definition at line 112 of file mainsim.cpp. Referenced by City::_Load(). |
|
Return the global total value of the micro simulator
Definition at line 264 of file mainsim.cpp. |
|
Overload the base method in order to call all other microsims' method
Reimplemented from Simulator. Definition at line 74 of file mainsim.cpp. References _tpSimulator, Simulator::LoadFrom(), and OC_MICROSIM_MAX. Referenced by City::_Load(). |
|
The main method of the simulator Implements Simulator. Definition at line 84 of file mainsim.cpp. References _tpSimulator, Simulator::Main(), OC_MICROSIM_MAX, Simulator::RCIDelay(), and RefreshSimValue(). |
|
Refresh the values of all the micro simulators. This method is called automatically by Run() every 3 turns
Definition at line 184 of file mainsim.cpp. References _tpSimulator, Structure::GetCode(), Structure::GetLevel(), BuildingLayer::GetLinearStructure(), Layer::GetMaxLinear(), Structure::IsSet(), OC_MICROSIM_COM, OC_MICROSIM_ELE, OC_MICROSIM_IND, OC_MICROSIM_RES, and Simulator::SetValue(). Referenced by City::_Load(), and Main(). |
|
Notify the micro simulators that a structure has been removed from the system
Definition at line 132 of file mainsim.cpp. |
|
Overload the parent's method
Reimplemented from Simulator. Definition at line 173 of file mainsim.cpp. References _tpSimulator, OC_MICROSIM_MAX, and Simulator::Return(). Referenced by City::_DeleteSimulator(). |
|
Overload the parent's method
Reimplemented from Simulator. Definition at line 151 of file mainsim.cpp. References _tpSimulator, OC_MICROSIM_MAX, and Simulator::Run(). Referenced by City::_CreateSimulator(). |
|
Overload the base method in order to call all other microsims' method
Reimplemented from Simulator. Definition at line 64 of file mainsim.cpp. References _tpSimulator, OC_MICROSIM_MAX, and Simulator::SaveTo(). Referenced by City::_Save(). |
|
Overload the parent's method
Reimplemented from Simulator. Definition at line 162 of file mainsim.cpp. References _tpSimulator, OC_MICROSIM_MAX, and Simulator::Stop(). |