From 732845440a15f0c627b6cca08dabff51beac735a Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 30 Aug 2007 21:11:12 +0000 Subject: (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. --- src/water_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/water_cmd.cpp') 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 */ -- cgit v1.2.3-54-g00ecf