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

Structure Class Reference

#include <structure.h>

Inheritance diagram for Structure:

Persistence PathStructure RCIStructure TreeStructure WEGStructure List of all members.

Public Member Functions

 Structure (const OPENCITY_STRUCTURE_CODE enumStructCode)
 Structure (const OPENCITY_STRUCTURE_CODE enumStructCode, Structure *pMain)
void SaveTo (std::fstream &rfs)
void LoadFrom (std::fstream &rfs)
void Set (const uint wegBit)
void Unset (const uint wegBit)
const bool IsSet (const uint wegBit) const
const OPENCITY_GRAPHIC_CODE GetGraphicCode () const
const OPENCITY_GRAPHIC_CODE GetBaseGraphicCode () const
virtual const OPENCITY_GRAPHIC_CODE GetNextLevelGraphicCode () const
virtual const OPENCITY_GRAPHIC_CODE GetPreviousLevelGraphicCode () const
const OPENCITY_STRUCTURE_CODE GetCode () const
StructureGetMain () const
void SetMain (Structure *const pstruct)
virtual const bool LevelUp ()
virtual const bool LevelDown ()
const uint GetLevel () const
void SetLevel (const uint uiLevel)
const OPENCITY_STRUCTURE_TYPE GetType () const

Static Public Member Functions

static const uint & GetNumber ()
static void SetNumber (const uint &rcuiNb)

Protected Attributes

OPENCITY_GRAPHIC_CODE _eGC
 Graphic code.
OPENCITY_STRUCTURE_CODE _eSC
 Structure code.
OPENCITY_STRUCTURE_TYPE _eType
 Structure type.
uint _uiStatus
uint _uiLevel
Structure_pstructureMain

Static Private Attributes

static uint uiNumberStructure = 0
 The total of the structures created so far.

Detailed Description

The base class for all stuctures including roads, rails, buildings, etc ...

Definition at line 44 of file structure.h.


Member Function Documentation

const OPENCITY_GRAPHIC_CODE Structure::GetBaseGraphicCode  )  const
 

Returns the first base GRAPHIC_CODE of the structure depending on its structure type

Definition at line 174 of file structure.cpp.

References _eSC.

Referenced by RCIStructure::GetNextLevelGraphicCode(), and RCIStructure::GetPreviousLevelGraphicCode().

const OPENCITY_STRUCTURE_CODE Structure::GetCode  )  const
 

Returns the current STRUCTURE_CODE of the structure. This is different from the GRAPHIC_CODE. The structure code is the _type_ of the structure where as the graphic code defines the model which is displayed by the renderer.

Definition at line 222 of file structure.cpp.

References _eSC.

Referenced by BuildingLayer::_BuildPathStructure(), BuildingLayer::_DestroyStructure(), Simulator::CheckLevelDown(), Simulator::CheckLevelUp(), BuildingLayer::ContainStructure(), BuildingLayer::ContainStructureOnly(), PathFinder::findShortestPath(), BuildingLayer::GetRandomStructure(), MainSim::RefreshSimValue(), and BuildingLayer::ResizeStructure().

const OPENCITY_GRAPHIC_CODE Structure::GetGraphicCode  )  const
 

Returns the current GRAPHIC_CODE of the structure

Definition at line 166 of file structure.cpp.

References _eGC.

Referenced by BuildingLayer::_DestroyStructure(), BuildingLayer::_LoadStructure(), Simulator::CheckLevelDown(), Simulator::CheckLevelUp(), GraphicManager::DisplayStructure(), and BuildingLayer::ResizeStructure().

const OPENCITY_GRAPHIC_CODE Structure::GetNextLevelGraphicCode  )  const [virtual]
 

Returns the GRAPHIC_CODE of the next level

Reimplemented in RCIStructure.

Definition at line 203 of file structure.cpp.

References _eGC.

Referenced by Simulator::CheckLevelUp().

const uint & Structure::GetNumber  )  [static]
 

Return the number of structures created so far

Returns:
The number of structures created

Definition at line 31 of file structure.cpp.

References uiNumberStructure.

Referenced by Simulator::RCIDelay().

const OPENCITY_GRAPHIC_CODE Structure::GetPreviousLevelGraphicCode  )  const [virtual]
 

Returns the GRAPHIC_CODE of the previous level

Reimplemented in RCIStructure.

Definition at line 213 of file structure.cpp.

References _eGC.

Referenced by Simulator::CheckLevelDown().

const OPENCITY_STRUCTURE_TYPE Structure::GetType  )  const
 

The type of the structure is useful for un/serialization

Definition at line 290 of file structure.cpp.

References _eType.

Referenced by BuildingLayer::SaveTo().

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

Load the data from the specified stream

Note:
The pointer to the main structured is _not_ loaded. It's up to the user to remap the pointer to the main structured correctly.
Parameters:
rfs A reference to a file stream which is ready for reading
See also:
Persistence

Implements Persistence.

Reimplemented in PathStructure.

Definition at line 121 of file structure.cpp.

References _eGC, _eSC, and _eType.

Referenced by PathStructure::LoadFrom(), and BuildingLayer::LoadFrom().

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

Save the data to the specified fstream

Note:
The pointer to the main structured is _not_ saved. It's up to the user to remap the pointer to the main structured correctly.
Parameters:
rfs A reference to a file stream which is ready for writing
See also:
Persistence

Implements Persistence.

Reimplemented in PathStructure.

Definition at line 107 of file structure.cpp.

References _eGC, _eSC, and _eType.

Referenced by PathStructure::SaveTo(), and BuildingLayer::SaveTo().

void Structure::Set const uint  wegBit  ) 
 

Set the properties of the structure to wegBit

Parameters:
wegBit The desired properties. You can combine them by using the OR operator.

Definition at line 136 of file structure.cpp.

Referenced by PathFinder::findShortestPath(), and BuildingLayer::StructureSet().

void Structure::SetNumber const uint &  rcuiNb  )  [static]
 

Set the number of created structures

Parameters:
rcuiNb Number of structures

Definition at line 39 of file structure.cpp.

References uiNumberStructure.

Referenced by BuildingLayer::LoadFrom().


Member Data Documentation

Structure* Structure::_pstructureMain [protected]
 

Pointer of the main structure IF this is just a part of a bigger structure ELSE equal to NULL

Definition at line 194 of file structure.h.


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