Define the WormRailManager class which handles trains.
More...
Public Member Functions |
constructor | WormRailManager () |
| Create an instance of WormRailManager and initialize our variables.
|
function | UpdateRailType () |
| Updates the current rail type of the AI based on the maximum number of cargoes transportable.
|
function | BuildRailway () |
| Main function for building a railway which decides all the details.
|
function | RegisterRoute (route_data, station_data, vehtype, group) |
| Register the new route into the database.
|
Static Public Member Functions |
static function | SetGroupName (group, crg, stasrc) |
| Set the name of a vehicle group.
|
static function | IsRectangleWithinTownInfluence (tile, town_id, width, height) |
| Checks whether a given rectangle is within the influence of a given town.
|
static function | SetRailType () |
| Sets the current rail type of the AI based on the maximum number of cargoes transportable.
|
Detailed Description
Define the WormRailManager class which handles trains.
Constructor & Destructor Documentation
constructor WormRailManager::WormRailManager |
( |
| ) |
|
|
inline |
Member Function Documentation
function WormRailManager::BuildRailway |
( |
| ) |
|
Main function for building a railway which decides all the details.
- Todo:
- replace number by a definied constant or variable depending on date and other factors
- Todo:
- DeleteRailStation
- Todo:
- DeleteRailStation
- Todo:
- DeleteRailStation
- Todo:
- DeleteRailStation
- Todo:
- DeleteRailStation, RemoveRailLine
- Todo:
- DeleteRailStation, RemoveRailLine
- Todo:
- DeleteRailStation, RemoveRailLine
- Todo:
- DeleteRailStation
- Todo:
- If building trains fails because of lack of money we should try again after a little wait...
- Note
- This is probably something that is done in manager or RegisteRoute by SimpleAI. Check this!
- Todo:
- check first if we are below max no. of trains...
- Todo:
- if we're short on money we should'nt try but wait longer before trying again.
function WormRailManager::IsRectangleWithinTownInfluence |
( |
tile |
, |
|
|
town_id |
, |
|
|
width |
, |
|
|
height |
|
|
) |
| |
|
static |
Checks whether a given rectangle is within the influence of a given town.
- Parameters
-
tile | The topmost tile of the rectangle. |
town_id | The TownID of the town to be checked. |
width | The width of the rectangle. |
height | The height of the rectangle. |
- Returns
- True if the rectangle is within the influence of the town.
- Todo:
- Needs to be moved to a different unit. (Town?)
- Note
- Taken from SimpleAI.
function WormRailManager::RegisterRoute |
( |
route_data |
, |
|
|
station_data |
, |
|
|
vehtype |
, |
|
|
group |
|
|
) |
| |
Register the new route into the database.
- Parameters
-
route_data | A WormRoute class object containing info about the route. |
station_data | A WormStation class object containing info about the station. |
vehtype | The type of vehicle using this route. Currently always VT_RAIL. |
group | The vehicle group for the vehicles using this route. |
- Returns
- The new route registered.
function WormRailManager::SetGroupName |
( |
group |
, |
|
|
crg |
, |
|
|
stasrc |
|
|
) |
| |
|
static |
Set the name of a vehicle group.
- Parameters
-
group | The GroupID of the group. |
crg | The cargo transported. |
stasrc | The source station. |
- Note
- Taken from SimpleAI.
- Todo:
- Move to a different unit, should be accessible from other managers too.
- Parameters
-
group | The GroupID of the group. |
crg | The cargo transported. |
stasrc | The source station. |
function WormRailManager::SetRailType |
( |
| ) |
|
|
static |
Sets the current rail type of the AI based on the maximum number of cargoes transportable.
- Returns
- The new railtype that has been set.
- Todo:
- Possible better evaluation what rail type is the most profitable.
The documentation for this class was generated from the following file: