mirror of https://github.com/OpenTTD/OpenTTD
(svn r25223) -Change: [NewGRF] Unify the behaviour of Aircraft::tick_counter with other vehicle types and increment it once per tick. (instead of twice like before, or six times like in r0)
parent
65855af084
commit
341a6f6e95
|
@ -1066,7 +1066,12 @@ static bool HandleCrashedAircraft(Aircraft *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void HandleAircraftSmoke(Aircraft *v)
|
/**
|
||||||
|
* Handle smoke of broken aircraft.
|
||||||
|
* @param v Aircraft
|
||||||
|
* @param mode Is this the non-first call for this vehicle in this tick?
|
||||||
|
*/
|
||||||
|
static void HandleAircraftSmoke(Aircraft *v, bool mode)
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
int8 x;
|
int8 x;
|
||||||
|
@ -1084,13 +1089,15 @@ static void HandleAircraftSmoke(Aircraft *v)
|
||||||
|
|
||||||
if (!(v->vehstatus & VS_AIRCRAFT_BROKEN)) return;
|
if (!(v->vehstatus & VS_AIRCRAFT_BROKEN)) return;
|
||||||
|
|
||||||
|
/* Stop smoking when landed */
|
||||||
if (v->cur_speed < 10) {
|
if (v->cur_speed < 10) {
|
||||||
v->vehstatus &= ~VS_AIRCRAFT_BROKEN;
|
v->vehstatus &= ~VS_AIRCRAFT_BROKEN;
|
||||||
v->breakdown_ctr = 0;
|
v->breakdown_ctr = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v->tick_counter & 0x1F) == 0) {
|
/* Spawn effect et most once per Tick, i.e. !mode */
|
||||||
|
if (!mode && (v->tick_counter & 0x0F) == 0) {
|
||||||
CreateEffectVehicleRel(v,
|
CreateEffectVehicleRel(v,
|
||||||
smoke_pos[v->direction].x,
|
smoke_pos[v->direction].x,
|
||||||
smoke_pos[v->direction].y,
|
smoke_pos[v->direction].y,
|
||||||
|
@ -1893,8 +1900,6 @@ static void AircraftHandleDestTooFar(Aircraft *v, bool too_far)
|
||||||
|
|
||||||
static bool AircraftEventHandler(Aircraft *v, int loop)
|
static bool AircraftEventHandler(Aircraft *v, int loop)
|
||||||
{
|
{
|
||||||
v->tick_counter++;
|
|
||||||
|
|
||||||
if (v->vehstatus & VS_CRASHED) {
|
if (v->vehstatus & VS_CRASHED) {
|
||||||
return HandleCrashedAircraft(v);
|
return HandleCrashedAircraft(v);
|
||||||
}
|
}
|
||||||
|
@ -1903,7 +1908,7 @@ static bool AircraftEventHandler(Aircraft *v, int loop)
|
||||||
|
|
||||||
v->HandleBreakdown();
|
v->HandleBreakdown();
|
||||||
|
|
||||||
HandleAircraftSmoke(v);
|
HandleAircraftSmoke(v, loop != 0);
|
||||||
ProcessOrders(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading(loop != 0);
|
v->HandleLoading(loop != 0);
|
||||||
|
|
||||||
|
@ -1933,6 +1938,8 @@ bool Aircraft::Tick()
|
||||||
{
|
{
|
||||||
if (!this->IsNormalAircraft()) return true;
|
if (!this->IsNormalAircraft()) return true;
|
||||||
|
|
||||||
|
this->tick_counter++;
|
||||||
|
|
||||||
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
|
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
|
||||||
|
|
||||||
if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
|
if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
|
||||||
|
|
Loading…
Reference in New Issue