mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move VehicleEnteredDepotThisTick call to a more suitable position. (#14065)
parent
7d03cee512
commit
98445088b1
|
@ -1311,11 +1311,6 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, uint16_t base_r
|
|||
|
||||
void TriggerVehicle(Vehicle *v, VehicleTrigger trigger)
|
||||
{
|
||||
if (trigger == VEHICLE_TRIGGER_DEPOT) {
|
||||
/* store that the vehicle entered a depot this tick */
|
||||
VehicleEnteredDepotThisTick(v);
|
||||
}
|
||||
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
DoTriggerVehicle(v, trigger, 0, true);
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
|
|
|
@ -925,7 +925,7 @@ Vehicle::~Vehicle()
|
|||
* Adds a vehicle to the list of vehicles that visited a depot this tick
|
||||
* @param *v vehicle to add
|
||||
*/
|
||||
void VehicleEnteredDepotThisTick(Vehicle *v)
|
||||
static void VehicleEnteredDepotThisTick(Vehicle *v)
|
||||
{
|
||||
/* Vehicle should stop in the depot if it was in 'stopping' state */
|
||||
_vehicles_to_autoreplace[v->index] = !v->vehstatus.Test(VehState::Stopped);
|
||||
|
@ -1610,6 +1610,9 @@ void VehicleEnterDepot(Vehicle *v)
|
|||
|
||||
VehicleServiceInDepot(v);
|
||||
|
||||
/* Store that the vehicle entered a depot this tick */
|
||||
VehicleEnteredDepotThisTick(v);
|
||||
|
||||
/* After a vehicle trigger, the graphics and properties of the vehicle could change. */
|
||||
TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
|
||||
v->MarkDirty();
|
||||
|
|
|
@ -74,7 +74,6 @@ void CheckVehicleBreakdown(Vehicle *v);
|
|||
void EconomyAgeVehicle(Vehicle *v);
|
||||
void AgeVehicle(Vehicle *v);
|
||||
void RunVehicleCalendarDayProc();
|
||||
void VehicleEnteredDepotThisTick(Vehicle *v);
|
||||
|
||||
UnitID GetFreeUnitNumber(VehicleType type);
|
||||
|
||||
|
|
Loading…
Reference in New Issue