|
@@ -430,13 +430,13 @@ CommandCost CmdBuildAircraft(TileIndex t
|
|
|
u->SetNext(w);
|
|
|
VehicleMove(w, false);
|
|
|
}
|
|
|
|
|
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
|
|
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
|
|
InvalidateWindow(WC_COMPANY, v->owner);
|
|
|
SetWindowDirty(WC_COMPANY, v->owner);
|
|
|
if (IsLocalCompany())
|
|
|
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window
|
|
|
|
|
|
Company::Get(_current_company)->num_engines[p1]++;
|
|
|
}
|
|
|
|
|
@@ -577,14 +577,14 @@ CommandCost CmdRefitAircraft(TileIndex t
|
|
|
v->cargo.Truncate(v->cargo_type == new_cid ? pass : 0);
|
|
|
u->cargo.Truncate(v->cargo_type == new_cid ? mail : 0);
|
|
|
v->cargo_type = new_cid;
|
|
|
v->cargo_subtype = new_subtype;
|
|
|
v->colourmap = PAL_NONE; // invalidate vehicle colour map
|
|
|
v->InvalidateNewGRFCacheOfChain();
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
|
|
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
|
|
|
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
|
|
}
|
|
|
|
|
|
return cost;
|
|
|
}
|
|
|
|
|
@@ -603,16 +603,16 @@ static void CheckIfAircraftNeedsService(
|
|
|
|
|
|
/* only goto depot if the target airport has terminals (eg. it is airport) */
|
|
|
if (st->airport_tile != INVALID_TILE && st->Airport()->terminals != NULL) {
|
|
|
// printf("targetairport = %d, st->index = %d\n", v->targetairport, st->index);
|
|
|
// v->targetairport = st->index;
|
|
|
v->current_order.MakeGoToDepot(st->index, ODTFB_SERVICE);
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
} else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
|
|
v->current_order.MakeDummy();
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Money Aircraft::GetRunningCost() const
|
|
|
{
|
|
|
return GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running;
|
|
@@ -636,14 +636,14 @@ void Aircraft::OnNewDay()
|
|
|
|
|
|
this->profit_this_year -= cost.GetCost();
|
|
|
this->running_ticks = 0;
|
|
|
|
|
|
SubtractMoneyFromCompanyFract(this->owner, cost);
|
|
|
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
|
|
|
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
|
|
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
|
|
}
|
|
|
|
|
|
static void HelicopterTickHandler(Aircraft *v)
|
|
|
{
|
|
|
Aircraft *u = v->Next()->Next();
|
|
|
|
|
@@ -813,13 +813,13 @@ static int UpdateAircraftSpeed(Aircraft
|
|
|
if (v->vehstatus & VS_AIRCRAFT_BROKEN) spd = min(spd, SPEED_LIMIT_BROKEN);
|
|
|
|
|
|
/* updates statusbar only if speed have changed to save CPU time */
|
|
|
if (spd != v->cur_speed) {
|
|
|
v->cur_speed = spd;
|
|
|
if (_settings_client.gui.vehicle_speed)
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
}
|
|
|
|
|
|
/* Adjust distance moved by plane speed setting */
|
|
|
if (_settings_game.vehicle.plane_speed > 1) spd /= _settings_game.vehicle.plane_speed;
|
|
|
|
|
|
if (!(v->direction & 1)) spd = spd * 3 / 4;
|
|
@@ -1216,14 +1216,14 @@ static void HandleBrokenAircraft(Aircraf
|
|
|
if (v->breakdown_ctr != 1) {
|
|
|
v->breakdown_ctr = 1;
|
|
|
v->vehstatus |= VS_AIRCRAFT_BROKEN;
|
|
|
|
|
|
if (v->breakdowns_since_last_service != 255)
|
|
|
v->breakdowns_since_last_service++;
|
|
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
static void HandleAircraftSmoke(Aircraft *v)
|
|
|
{
|
|
@@ -1313,13 +1313,13 @@ static void CrashAirplane(Aircraft *v)
|
|
|
{
|
|
|
v->vehstatus |= VS_CRASHED;
|
|
|
v->crashed_counter = 0;
|
|
|
|
|
|
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
|
|
|
|
|
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
|
|
|
|
|
uint amt = 2;
|
|
|
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count();
|
|
|
SetDParam(0, amt);
|
|
|
|
|
|
v->cargo.Truncate(0);
|
|
@@ -1436,13 +1436,13 @@ void AircraftLeaveHangar(Aircraft *v)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
VehicleServiceInDepot(v);
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
|
|
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
|
|
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
|
|
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
|
|
}
|
|
|
|
|
|
/** Checks if an aircraft should head towards a hangar because it needs replacement
|
|
|
* @param *v the vehicle to test
|
|
|
* @return true if the aircraft should head towards a hangar
|
|
|
*/
|
|
@@ -1547,13 +1547,13 @@ static void AircraftEventHandler_AtTermi
|
|
|
if (_settings_game.order.serviceathelipad) {
|
|
|
if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
|
|
|
/* an exerpt of ServiceAircraft, without the invisibility stuff */
|
|
|
v->date_of_last_service = _date;
|
|
|
v->breakdowns_since_last_service = 0;
|
|
|
v->reliability = Engine::Get(v->engine_type)->reliability;
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
|
|
}
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (v->current_order.IsType(OT_NOTHING)) return;
|