From 00a08601c9631282fc921b863843880d30e6fadc Mon Sep 17 00:00:00 2001 From: bjarni Date: Fri, 8 Sep 2006 10:47:39 +0000 Subject: (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 --- ship_cmd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ship_cmd.c') diff --git a/ship_cmd.c b/ship_cmd.c index ea8f6fdda..371a51e7f 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -914,6 +914,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) v->random_bits = VehicleRandomBits(); VehiclePositionChanged(v); + GetPlayer(_current_player)->num_engines[p1]++; InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); -- cgit v1.2.3-70-g09d2