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

Bank Class Reference

#include <Bank.h>

List of all members.


Detailed Description

Controls economic assets for each player.

Definition at line 25 of file Bank.h.

Public Methods

 Bank (int startingFunds)
int balance ()
void deposit (int amount)
bool withdraw (int amount)

Private Attributes

int m_funds


Constructor & Destructor Documentation

Bank::Bank int    startingFunds
 

Definition at line 25 of file Bank.cpp.

00025 : m_funds(startingFunds) {}


Member Function Documentation

int Bank::balance  
 

Definition at line 27 of file Bank.cpp.

References m_funds.

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

00027 { return m_funds; }

void Bank::deposit int    amount
 

Definition at line 29 of file Bank.cpp.

References m_funds, and Globals::MAX_MONEY().

Referenced by NetworkSubsystem::processNetworkData(), and City::update().

00030 { 
00031         m_funds += amount;
00032         if (m_funds > MAX_MONEY) m_funds = MAX_MONEY;
00033 }

bool Bank::withdraw int    amount
 

Definition at line 35 of file Bank.cpp.

References m_funds.

Referenced by Overhead::processCommand(), City::trainUnit(), and City::upgradeEcon().

00036 {
00037   if( amount <= m_funds )
00038   {
00039     m_funds -= amount;
00040     return true;
00041   }
00042   else
00043   {
00044     return false;
00045   }
00046 
00047 }


Member Data Documentation

int Bank::m_funds [private]
 

Definition at line 35 of file Bank.h.

Referenced by balance(), deposit(), and withdraw().


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