summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-30 21:11:12 +0000
committerrubidium <rubidium@openttd.org>2007-08-30 21:11:12 +0000
commit732845440a15f0c627b6cca08dabff51beac735a (patch)
treeb205fc9b323290f091d73bfe7f40c7ed002d44cc /src/water_cmd.cpp
parent5ff81aca1873824af8b00eeb74ddedfce9dfef4a (diff)
downloadopenttd-732845440a15f0c627b6cca08dabff51beac735a.tar.xz
(svn r11011) -Fix [FS#1129]: GetFirstVehicleInChain did change the game state while being marked const.
-Codechange: do not brute force determine the first vehicle in the chain or previous vehicle, but do it by properly accounting the previous and first pointers when updating the next pointer. This gives a performance increase of about 15% when there are a lot of vehicles in the game.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index a3e97c734..428cd5f4b 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -658,7 +658,7 @@ static void FloodVehicle(Vehicle *v)
}
Vehicle *u;
- if (v->type != VEH_AIRCRAFT) v = GetFirstVehicleInChain(v);
+ if (v->type != VEH_AIRCRAFT) v = v->First();
u = v;
/* crash all wagons, and count passengers */