OpenTTD

Tasklist

FS#6059 - Simplify GetOrderCmdFromTile

Attached to Project: OpenTTD
Opened by Juanjo (juanjo) - Thursday, 10 July 2014, 12:33 GMT
Last edited by frosch (frosch) - Wednesday, 16 July 2014, 21:07 GMT
Type Patch
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

First, IsDepotTypeTile can also work for TRANSPORT_AIR. It doesn't introduce problems. In all calls to this function, IsDepotTypeTile is never called for air transport at the moment.

If that first patch can be accepted, then GetOrderCmdFromTile can be simplified for depots. Unfortunately, there is one line I have problems with. I don't know how to convert a VehicleTypeByte directly into a TransportType type:
if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsTileOwner(tile, _local_company)) {
I would appreciate help from developers in this point.

The rest of the patch are minor codechanges:
If we need the index of a rail waypoint, we don't need the waypoint itself.
To be consistent with the rest of the funciton, user cannot create an order to a waypoint of another company. (Keep in mind buoys have no owner)
Lastly, there is no need to "free" ("do nothing" order) at the end, as the order is already "free" from the beginning.
This task depends upon

Closed by  frosch (frosch)
Wednesday, 16 July 2014, 21:07 GMT
Reason for closing:  Implemented
Additional comments about closing:  in r26692 and r26693

Loading...