forked from mirror/OpenTTD
(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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user