|
@@ -292,13 +292,13 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
|
|
|
}
|
|
|
|
|
|
VehicleMove(v, false);
|
|
|
|
|
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
|
|
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
|
|
InvalidateWindow(WC_COMPANY, v->owner);
|
|
|
SetWindowDirty(WC_COMPANY, v->owner);
|
|
|
if (IsLocalCompany()) {
|
|
|
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
|
|
|
}
|
|
|
|
|
|
Company::Get(_current_company)->num_engines[p1]++;
|
|
|
|
|
@@ -617,13 +617,13 @@ static void RoadVehCrash(RoadVehicle *v)
|
|
|
|
|
|
MarkSingleVehicleDirty(u);
|
|
|
}
|
|
|
|
|
|
ClearSlot(v);
|
|
|
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
|
|
|
AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING));
|
|
|
|
|
|
SetDParam(0, pass);
|
|
|
AddVehicleNewsItem(
|
|
|
(pass == 1) ?
|
|
@@ -660,14 +660,14 @@ static void HandleBrokenRoadVeh(RoadVehi
|
|
|
v->breakdown_ctr = 1;
|
|
|
v->cur_speed = 0;
|
|
|
|
|
|
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);
|
|
|
|
|
|
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
|
|
|
SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
|
|
|
SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
|
|
|
}
|
|
|
|
|
@@ -677,13 +677,13 @@ static void HandleBrokenRoadVeh(RoadVehi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ((v->tick_counter & 1) == 0) {
|
|
|
if (--v->breakdown_delay == 0) {
|
|
|
v->breakdown_ctr = 0;
|
|
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
|
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
TileIndex RoadVehicle::GetOrderStationLocation(StationID station)
|
|
|
{
|
|
@@ -833,13 +833,13 @@ static int RoadVehAccelerate(RoadVehicle
|
|
|
v->cur_speed = min(v->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed * 2);
|
|
|
}
|
|
|
|
|
|
/* Update statusbar only if speed has changed to save CPU time */
|
|
|
if (oldspeed != v->cur_speed) {
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Speed is scaled in the same manner as for trains. @see train_cmd.cpp */
|
|
|
int scaled_spd = spd * 3 >> 2;
|
|
|
|
|
@@ -1727,13 +1727,13 @@ again:
|
|
|
|
|
|
DEBUG(ms, 2, " force a slot clearing");
|
|
|
ClearSlot(v);
|
|
|
}
|
|
|
|
|
|
StartRoadVehSound(v);
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
}
|
|
|
|
|
|
/* Check tile position conditions - i.e. stop position in depot,
|
|
|
* entry onto bridge or into tunnel */
|
|
|
uint32 r = VehicleEnterTile(v, v->tile, x, y);
|
|
|
if (HasBit(r, VETS_CANNOT_ENTER)) {
|
|
@@ -1842,13 +1842,13 @@ static void CheckIfRoadVehNeedsService(R
|
|
|
if (rfdd.best_length == UINT_MAX || rfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
|
|
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
|
|
/* If we were already heading for a depot but it has
|
|
|
* suddenly moved farther away, we continue our normal
|
|
|
* schedule? */
|
|
|
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);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
DepotID depot = GetDepotIndex(rfdd.tile);
|
|
|
|
|
@@ -1860,13 +1860,13 @@ static void CheckIfRoadVehNeedsService(R
|
|
|
|
|
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
|
|
ClearSlot(v);
|
|
|
|
|
|
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
|
|
|
v->dest_tile = rfdd.tile;
|
|
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
|
|
}
|
|
|
|
|
|
void RoadVehicle::OnNewDay()
|
|
|
{
|
|
|
if (!this->IsRoadVehFront()) return;
|
|
|
|
|
@@ -1954,14 +1954,14 @@ void RoadVehicle::OnNewDay()
|
|
|
|
|
|
this->profit_this_year -= cost.GetCost();
|
|
|
this->running_ticks = 0;
|
|
|
|
|
|
SubtractMoneyFromCompanyFract(this->owner, cost);
|
|
|
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
|
|
|
InvalidateWindowClasses(WC_ROADVEH_LIST);
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
|
|
SetWindowClassesDirty(WC_ROADVEH_LIST);
|
|
|
}
|
|
|
|
|
|
Trackdir RoadVehicle::GetVehicleTrackdir() const
|
|
|
{
|
|
|
if (this->vehstatus & VS_CRASHED) return INVALID_TRACKDIR;
|
|
|
|
|
@@ -2066,14 +2066,14 @@ CommandCost CmdRefitRoadVeh(TileIndex ti
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
v->cargo_cap = capacity;
|
|
|
v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
|
|
|
v->cargo_type = new_cid;
|
|
|
v->cargo_subtype = new_subtype;
|
|
|
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_ROADVEH_LIST, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (flags & DC_EXEC) RoadVehUpdateCache(RoadVehicle::Get(p1)->First());
|
|
|
|