Do not charge vehicle running costs when waiting in depot due to timetable

See: #202
This commit is contained in:
Jonathan G Rennison 2020-11-05 22:58:16 +00:00
parent 81ec419046
commit 53af61fc9e
5 changed files with 9 additions and 4 deletions

View File

@ -2152,7 +2152,7 @@ bool Aircraft::Tick()
this->tick_counter++;
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
if (!((this->vehstatus & VS_STOPPED) || this->IsWaitingInDepot())) this->running_ticks++;
if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);

View File

@ -2119,7 +2119,7 @@ bool RoadVehicle::Tick()
UpdateStateChecksum((((uint64) this->x_pos) << 32) | this->y_pos);
UpdateStateChecksum((((uint64) this->state) << 32) | this->frame);
if (this->IsFrontEngine()) {
if (!(this->IsRoadVehicleStopped())) this->running_ticks++;
if (!(this->IsRoadVehicleStopped() || this->IsWaitingInDepot())) this->running_ticks++;
return RoadVehController(this);
}

View File

@ -972,7 +972,7 @@ reverse_direction:
bool Ship::Tick()
{
UpdateStateChecksum((((uint64) this->x_pos) << 32) | this->y_pos);
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
if (!((this->vehstatus & VS_STOPPED) || this->IsWaitingInDepot())) this->running_ticks++;
ShipController(this);

View File

@ -5162,7 +5162,7 @@ bool Train::Tick()
{
UpdateStateChecksum((((uint64) this->x_pos) << 32) | (this->y_pos << 16) | this->track );
if (this->IsFrontEngine()) {
if (!(this->vehstatus & VS_STOPPED) || this->cur_speed > 0) this->running_ticks++;
if (!((this->vehstatus & VS_STOPPED) || this->IsWaitingInDepot()) || this->cur_speed > 0) this->running_ticks++;
this->current_order_time++;

View File

@ -584,6 +584,11 @@ public:
return this->IsChainInDepot();
}
bool IsWaitingInDepot() const {
assert(this == this->First());
return this->current_order.IsType(OT_WAITING) && this->IsChainInDepot();
}
/**
* Calls the tick handler of the vehicle
* @return is this vehicle still valid?