forked from mirror/OpenTTD
(svn r6424) -Codechange: [autoreplace] removed a loop though all vehicles from each time the window is redrawn
To do this, the player struct contains an array, that contains the count of each engine type that the player owns Those arrays are updated each time a vehicle is build or deleted and is calculated on load (it's not saved) It's possible to access the arrays outside of the autoreplace GUI, so feel free to read from them in other patches as well
This commit is contained in:
@@ -396,6 +396,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
w->u.air.state = HRS_ROTOR_STOPPED;
|
||||
VehiclePositionChanged(w);
|
||||
}
|
||||
GetPlayer(_current_player)->num_engines[p1]++;
|
||||
|
||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||
RebuildVehicleLists();
|
||||
|
Reference in New Issue
Block a user