(svn r9683) -Fix [FS#423]: improved loading does not use a huge amount of processing power anymore when having a lot of trains.

This commit is contained in:
rubidium
2007-04-20 08:00:30 +00:00
parent 12ddcd0a24
commit 1951817f3b
5 changed files with 27 additions and 7 deletions

View File

@@ -570,6 +570,10 @@ bool IsEngineCountable(const Vehicle *v)
void DestroyVehicle(Vehicle *v)
{
if (v->last_station_visited != INVALID_STATION) {
GetStation(v->last_station_visited)->loading_vehicles.remove(v);
}
if (IsEngineCountable(v)) {
GetPlayer(v->owner)->num_engines[v->engine_type]--;
if (v->owner == _local_player) InvalidateAutoreplaceWindow(v->engine_type);
@@ -2903,6 +2907,7 @@ void Vehicle::BeginLoading()
{
assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
current_order.type = OT_LOADING;
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
}
void Vehicle::LeaveStation()
@@ -2911,4 +2916,5 @@ void Vehicle::LeaveStation()
assert(current_order.type == OT_LOADING);
current_order.type = OT_LEAVESTATION;
current_order.flags = 0;
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
}