Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DorpsGek opened this issue Feb 18, 2008 · 1 comment
Closed
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

Morloth opened the ticket and wrote:

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

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/1783
@DorpsGek
Copy link
Member Author

glx closed the ticket.

Reason for closing: Implemented

In r12212 and r12216.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1783

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant