Avoid unnecessary redrawing of vehicle list windows

Redraw info section every tick if values have changed
This commit is contained in:
Jonathan G Rennison
2020-10-03 22:28:20 +01:00
parent 2c4808e239
commit bd2649c19e
15 changed files with 79 additions and 52 deletions

View File

@@ -24,6 +24,7 @@
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "vehicle_gui.h"
#include "sound_func.h"
#include "ai/ai.hpp"
#include "game/game.hpp"
@@ -254,7 +255,7 @@ void Ship::OnNewDay()
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
/* we need this for the profit */
SetWindowClassesDirty(WC_SHIPS_LIST);
DirtyVehicleListWindowForVehicle(this);
}
Trackdir Ship::GetVehicleTrackdir() const
@@ -414,7 +415,7 @@ static bool CheckShipLeaveDepot(Ship *v)
PlayShipSound(v);
VehicleServiceInDepot(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
SetWindowClassesDirty(WC_SHIPS_LIST);
DirtyVehicleListWindowForVehicle(v);
return false;
}