summaryrefslogtreecommitdiff
path: root/roadveh_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-08 10:47:39 +0000
committerbjarni <bjarni@openttd.org>2006-09-08 10:47:39 +0000
commit00a08601c9631282fc921b863843880d30e6fadc (patch)
tree6807547e48700a8903229c58abafc50330747e2c /roadveh_cmd.c
parentf01e761f80ce7f17239a2e477a241a3a18a8c5d2 (diff)
downloadopenttd-00a08601c9631282fc921b863843880d30e6fadc.tar.xz
(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
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index a01e04931..ef3cf4e10 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -191,6 +191,7 @@ int32 CmdBuildRoadVeh(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();