OpenTTD

Tasklist

FS#1785 - NoAI patch for revision 12187, makes most methods static

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

Details

These patches make most methods found in the NoAI API static as they should be. There is no reason why the member functions should be non-static. It makes calling these functions more easy as you can now call:

AICargo.GetCargoLabel(id);

Instead of:
local cargoAI = AICargo();
cargoAI.GetCargoLabel(id);

I've made a different patch file for every class that needs to be modified in the NoAI API. Some might also include changes to the cpp file, as some would contain calls like: 'this->DoCommand(...)'; These are now replaced by 'DoCommand(...);' which does the same, only removes the dependency of an actual class instance.

- Bram
This task depends upon

Closed by  Loïc GUILLOUX (glx)
Friday, 22 February 2008, 13:59 GMT
Reason for closing:  Implemented
Additional comments about closing:  In r12216.
Comment by Loïc GUILLOUX (glx) - Tuesday, 19 February 2008, 18:25 GMT
We usually add /* static */ in .cpp for static functions. It helps to understand why there are no "this->".
Comment by Bram Ridder (Morloth) - Tuesday, 19 February 2008, 19:25 GMT
Ok, fixed this in these patches.

Loading...