(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:
rubidium
2007-08-30 21:11:12 +00:00
parent 8a6cc3aa10
commit aba867d78d
10 changed files with 101 additions and 132 deletions

View File

@@ -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;
}