WormAIDev  Worm SELF_VERSION
 All Classes Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | List of all members
WormRailManager Class Reference

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

Create an instance of WormRailManager and initialize our variables.

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
tileThe topmost tile of the rectangle.
town_idThe TownID of the town to be checked.
widthThe width of the rectangle.
heightThe 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_dataA WormRoute class object containing info about the route.
station_dataA WormStation class object containing info about the station.
vehtypeThe type of vehicle using this route. Currently always VT_RAIL.
groupThe 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
groupThe GroupID of the group.
crgThe cargo transported.
stasrcThe source station.
Note
Taken from SimpleAI.
Todo:
Move to a different unit, should be accessible from other managers too.
Parameters
groupThe GroupID of the group.
crgThe cargo transported.
stasrcThe 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: