summaryrefslogtreecommitdiff
path: root/src/order_gui.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
commitaba867d78dd52154bb7874a6998a3002dab57684 (patch)
treeb205fc9b323290f091d73bfe7f40c7ed002d44cc /src/order_gui.cpp
parent8a6cc3aa104b5f8631dcb74343dcd68ffa3308ec (diff)
downloadopenttd-aba867d78dd52154bb7874a6998a3002dab57684.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/order_gui.cpp')
-rw-r--r--src/order_gui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index c77fe32f0..0bf98f240 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -356,7 +356,7 @@ static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w)
if (u->type != v->type) return false;
if (u->HasFront() && !u->IsPrimaryVehicle()) {
- u = GetFirstVehicleInChain(u);
+ u = u->First();
if (!u->IsPrimaryVehicle()) return false;
}