OpenTTD

Tasklist

FS#1783 - NoAI patch for revision 12180, makes most methods static + some new

Attached to Project: OpenTTD
Opened by Bram Ridder (Morloth) - Monday, 18 February 2008, 19:44 GMT
Type Patch
Category Script → NoAI
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This patch makes virtually all methods of the NoAI API static, as they should be. There is no reason why most of these methods should be non-static member functions. This makes programming a lot simpler as you can simply call:
AICargo.GetCargoLabel(id);

Instead of:
local cargo = AICargo();
cargo.GetCargoLabel

Additional changes:

* AITile
Changes:
- GetCargoAcceptence and GetCargoProduction now both return a boolean value instead of an integer. The values it would return previously didn't have much meaning (for GetCargoAcceptence, lower then 8 means it isn't accepted, higher is better !?). It would be better if GetCargoProduction would return the total production of all industries around, perhaps something for a subsequent patch.

New methods:
IndustryID GetIndustryID(TileIndex); Returns the id of the industry located on this tile (-1 otherwise)

* AIEngine

New methods:
int32 GetMaxAge(EngineID); This function was already in AIVehicle but could only be called AFTER a vehicle was constructed, as AI has a lot to do with planning you want this information beforehand
Money GetRunningCost(EngineID); Gets the running cost of this vehicle per year

Bram
This task depends upon

Closed by  Loïc GUILLOUX (glx)
Friday, 22 February 2008, 14:06 GMT
Reason for closing:  Implemented
Additional comments about closing:  In r12212 and r12216.

Loading...