Define the WormMoney class containing money related functions.
More...
Static Public Attributes |
static | WM_SILENT = true |
static | WM_SHOWINFO = false |
Money related functions |
static function | HasMoney (money) |
| Check if we have enough money (via loan and on bank).
|
static function | GetMoney (money, silent=false) |
| Get the amount of money requested, loan if needed.
|
static function | InflationCorrection (money) |
| Compute the amount of money corrected for inflation.
|
function | GetMinimumCashNeeded () |
| Calculates the minimum amount of cash needed to be at hand.
|
function | GetMaxBankBalance () |
| Calculates how much cash will be on hand if the maximum loan is taken.
|
Detailed Description
Define the WormMoney class containing money related functions.
Member Function Documentation
function WormMoney::GetMaxBankBalance |
( |
| ) |
|
Calculates how much cash will be on hand if the maximum loan is taken.
- Returns
- The maximum amount of money.
- Note
- Taken from SimpleAI.
function WormMoney::GetMinimumCashNeeded |
( |
| ) |
|
Calculates the minimum amount of cash needed to be at hand.
This is used to avoid going bankrupt because of station maintenance costs.
- Note
- Taken from SimpleAI.
- Todo:
- Think of a better computation than stationcount * 50 since I think maintenance costs don't increase linearly.
- Returns
- 10000 pounds plus the expected station maintenance costs.
- Todo:
- Maybe also use InflationCorrection on GetLoanInterval or is that already corrected for inflation?
function WormMoney::GetMoney |
( |
money |
, |
|
|
silent |
= false |
|
) |
| |
|
static |
Get the amount of money requested, loan if needed.
- Parameters
-
money | The amount of money we need. |
silent | (false by default) Whether or not we should show info about failure to get money or getting a loan. |
- Returns
- Boolean saying if we got the needed money or not.
function WormMoney::HasMoney |
( |
money |
| ) |
|
|
static |
Check if we have enough money (via loan and on bank).
- Parameters
-
money | The amount of money we need. |
- Returns
- Boolean saying if we do or don't have enough money.
function WormMoney::InflationCorrection |
( |
money |
| ) |
|
|
static |
Compute the amount of money corrected for inflation.
- Parameters
-
money | The uncorrected amount of money. |
- Returns
- The inflation corrected amount of money.
- Note
- Adapted from SuperLib.Money.Inflate: Computes GetInflationRate only once.
The documentation for this class was generated from the following file: