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

EconData Class Reference

#include <EconData.h>

Inheritance diagram for EconData:

Inheritance graph
[legend]
Collaboration diagram for EconData:

Collaboration graph
[legend]
List of all members.

Public Methods

void initData (istream &in)
 Initialzes the data from a stream.

int unitAmount (int unitType) const
 Gets the cost associated with each unit type.

int unitTrainingTime (int unitType) const
 The time it takes a city to train a unit.

DWORD depositInterval () const
 How frequently a city deposits money in a players bank.

int depositPerCity (int econLevel) const
 How much money a city deposits.

int econUpgradeCost (int currentLevel) const
 the cost to upgrade econ from currentLevel to next

int econUpgradeTime (int currentLevel) const
void shutdown ()
 releases all resources


Static Public Methods

EconData & getObj ()

Static Public Attributes

const string TOK_BEGIN_DATA = "BEGIN ECON DATA"
 Tokens that delimit the data in the data file.

const string TOK_END_DATA = "END ECON DATA"

Static Protected Methods

void releaseObj ()
 should only be called by the class that inherits the Singleton functionality after the subclasses releases all its necessary resources


Private Attributes

int m_unitCosts [UnitTypes::COUNT]
int m_unitTrainingTime [UnitTypes::COUNT]
DWORD m_depositInterval
int m_depositPerCity [5]
int m_econUpgradeCost [5]
int m_econUpgradeTime [5]

Member Function Documentation

DWORD EconData::depositInterval   const
 

How frequently a city deposits money in a players bank.

:

Definition at line 48 of file EconData.cpp.

References DWORD, and m_depositInterval.

Referenced by HUD::render(), and City::update().

00048 { return m_depositInterval; }

int EconData::depositPerCity int    econLevel const
 

How much money a city deposits.

Definition at line 50 of file EconData.cpp.

References m_depositPerCity.

Referenced by HUD::render(), and City::update().

00050 { assert(econLevel>=1 && econLevel<=5); return m_depositPerCity[econLevel-1]; }

int EconData::econUpgradeCost int    currentLevel const
 

the cost to upgrade econ from currentLevel to next

Definition at line 54 of file EconData.cpp.

References m_econUpgradeCost.

Referenced by HUD::render().

00055 {
00056         assert(currentLevel>=1 && currentLevel<=5);
00057         return m_econUpgradeCost[currentLevel-1];
00058 }

int EconData::econUpgradeTime int    currentLevel const
 

Definition at line 60 of file EconData.cpp.

References m_econUpgradeTime.

00061 {
00062         assert(currentLevel>=1 && currentLevel<=5);
00063         return m_econUpgradeTime[currentLevel-1];
00064 }

EconData& Singleton< EconData >::getObj   [static, inherited]
 

Referenced by Overhead::initData(), Overhead::overhead_shutdown(), HUD::render(), and City::update().

void EconData::initData istream &    in
 

Initialzes the data from a stream.

Definition at line 26 of file EconData.cpp.

References m_depositInterval, m_depositPerCity, m_econUpgradeCost, m_econUpgradeTime, m_unitCosts, and m_unitTrainingTime.

Referenced by Overhead::initData().

00027 {
00028   for(int i=0; i < UnitTypes::COUNT; ++i)
00029     in >> m_unitCosts[i];
00030   for(int i=0; i < UnitTypes::COUNT; ++i)
00031     in >> m_unitTrainingTime[i];
00032 
00033   in >> m_depositInterval;
00034   for( int level=1; level<=5; level++ )
00035         in >> m_depositPerCity[level-1];
00036 
00037   for( int econLevel=1; econLevel<=5; econLevel++ )
00038           in >> m_econUpgradeCost[econLevel-1];
00039 
00040   for( int econLevel=1; econLevel<=5; econLevel++ )
00041           in >> m_econUpgradeTime[econLevel-1];
00042 }

void Singleton< EconData >::releaseObj   [static, protected, inherited]
 

should only be called by the class that inherits the Singleton functionality after the subclasses releases all its necessary resources

Referenced by shutdown().

void EconData::shutdown  
 

releases all resources

Definition at line 52 of file EconData.cpp.

References Singleton< EconData >::releaseObj().

Referenced by Overhead::overhead_shutdown().

00052 { this->releaseObj(); }

int EconData::unitAmount int    unitType const
 

Gets the cost associated with each unit type.

Definition at line 44 of file EconData.cpp.

References m_unitCosts.

Referenced by HUD::render().

00044 { return m_unitCosts[type]; }

int EconData::unitTrainingTime int    unitType const
 

The time it takes a city to train a unit.

Definition at line 46 of file EconData.cpp.

References m_unitTrainingTime.

Referenced by City::update().

00046 { return m_unitTrainingTime[type]; }


Member Data Documentation

DWORD EconData::m_depositInterval [private]
 

Definition at line 60 of file EconData.h.

Referenced by depositInterval(), and initData().

int EconData::m_depositPerCity[5] [private]
 

Definition at line 61 of file EconData.h.

Referenced by depositPerCity(), and initData().

int EconData::m_econUpgradeCost[5] [private]
 

Definition at line 62 of file EconData.h.

Referenced by econUpgradeCost(), and initData().

int EconData::m_econUpgradeTime[5] [private]
 

Definition at line 63 of file EconData.h.

Referenced by econUpgradeTime(), and initData().

int EconData::m_unitCosts[UnitTypes::COUNT] [private]
 

Definition at line 58 of file EconData.h.

Referenced by initData(), and unitAmount().

int EconData::m_unitTrainingTime[UnitTypes::COUNT] [private]
 

Definition at line 59 of file EconData.h.

Referenced by initData(), and unitTrainingTime().

const string EconData::TOK_BEGIN_DATA = "BEGIN ECON DATA" [static]
 

Tokens that delimit the data in the data file.

Definition at line 23 of file EconData.cpp.

Referenced by Overhead::initData().

const string EconData::TOK_END_DATA = "END ECON DATA" [static]
 

Definition at line 24 of file EconData.cpp.


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