Merge branch 'tracerestrict-sx' into jgrpp
# Conflicts: # src/train_cmd.cpp
This commit is contained in:
@@ -2198,6 +2198,7 @@ static void DoAcquireCompany(Company *c)
|
|||||||
|
|
||||||
DeleteCompanyWindows(ci);
|
DeleteCompanyWindows(ci);
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS, 0);
|
||||||
InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
|
InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
|
||||||
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
||||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
||||||
|
@@ -2083,6 +2083,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
|
|||||||
#endif /* ENABLE_NETWORK */
|
#endif /* ENABLE_NETWORK */
|
||||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window.
|
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window.
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window.
|
InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window.
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS);// Trace restrict slots window.
|
||||||
InvalidateWindowClassesData(WC_ROADVEH_LIST); // Road vehicle group window.
|
InvalidateWindowClassesData(WC_ROADVEH_LIST); // Road vehicle group window.
|
||||||
InvalidateWindowClassesData(WC_SHIPS_LIST); // Ship group window.
|
InvalidateWindowClassesData(WC_SHIPS_LIST); // Ship group window.
|
||||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST); // Aircraft group window.
|
InvalidateWindowClassesData(WC_AIRCRAFT_LIST); // Aircraft group window.
|
||||||
|
@@ -1599,15 +1599,20 @@ void TraceRestrictSlot::PreCleanPool()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Remove vehicle ID from all slot occupants */
|
/** Remove vehicle ID from all slot occupants */
|
||||||
void TraceRestrictRemoveVehicleFromAllSlots(VehicleID id)
|
void TraceRestrictRemoveVehicleFromAllSlots(VehicleID vehicle_id)
|
||||||
{
|
{
|
||||||
auto range = slot_vehicle_index.equal_range(id);
|
const auto range = slot_vehicle_index.equal_range(vehicle_id);
|
||||||
|
|
||||||
for (auto it = range.first; it != range.second; ++it) {
|
for (auto it = range.first; it != range.second; ++it) {
|
||||||
TraceRestrictSlot *slot = TraceRestrictSlot::Get(it->second);
|
auto slot = TraceRestrictSlot::Get(it->second);
|
||||||
container_unordered_remove(slot->occupants, id);
|
container_unordered_remove(slot->occupants, vehicle_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool anything_to_erase = range.first != range.second;
|
||||||
|
|
||||||
slot_vehicle_index.erase(range.first, range.second);
|
slot_vehicle_index.erase(range.first, range.second);
|
||||||
if (range.first != range.second) InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS);
|
|
||||||
|
if (anything_to_erase) InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Replace all instance of a vehicle ID with another, in all slot occupants */
|
/** Replace all instance of a vehicle ID with another, in all slot occupants */
|
||||||
|
@@ -1560,6 +1560,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
if (!HasBit(src->subtype, GVSF_VIRTUAL)) {
|
if (!HasBit(src->subtype, GVSF_VIRTUAL)) {
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, src->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, src->tile);
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We don't want to execute what we're just tried. */
|
/* We don't want to execute what we're just tried. */
|
||||||
@@ -1647,6 +1648,7 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint3
|
|||||||
if (!HasBit(v->subtype, GVSF_VIRTUAL)) {
|
if (!HasBit(v->subtype, GVSF_VIRTUAL)) {
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually delete the sold 'goods' */
|
/* Actually delete the sold 'goods' */
|
||||||
@@ -2268,6 +2270,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
|
|||||||
SetWindowDirty(WC_VEHICLE_DETAILS, front->index);
|
SetWindowDirty(WC_VEHICLE_DETAILS, front->index);
|
||||||
SetWindowDirty(WC_VEHICLE_VIEW, front->index);
|
SetWindowDirty(WC_VEHICLE_VIEW, front->index);
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* turn the whole train around */
|
/* turn the whole train around */
|
||||||
@@ -2492,6 +2495,7 @@ static bool CheckTrainStayInDepot(Train *v)
|
|||||||
/* force proceed was not pressed */
|
/* force proceed was not pressed */
|
||||||
if (++v->wait_counter < 37) {
|
if (++v->wait_counter < 37) {
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2501,6 +2505,7 @@ static bool CheckTrainStayInDepot(Train *v)
|
|||||||
if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) {
|
if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) {
|
||||||
/* Full and no PBS signal in block or depot reserved, can't exit. */
|
/* Full and no PBS signal in block or depot reserved, can't exit. */
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2520,6 +2525,7 @@ static bool CheckTrainStayInDepot(Train *v)
|
|||||||
if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == TFP_NONE) {
|
if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == TFP_NONE) {
|
||||||
/* No path and no force proceed. */
|
/* No path and no force proceed. */
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
MarkTrainAsStuck(v);
|
MarkTrainAsStuck(v);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2529,6 +2535,7 @@ static bool CheckTrainStayInDepot(Train *v)
|
|||||||
|
|
||||||
VehicleServiceInDepot(v);
|
VehicleServiceInDepot(v);
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
v->PlayLeaveStationSound();
|
v->PlayLeaveStationSound();
|
||||||
|
|
||||||
v->track = TRACK_BIT_X;
|
v->track = TRACK_BIT_X;
|
||||||
@@ -5023,6 +5030,7 @@ void Train::OnNewDay()
|
|||||||
|
|
||||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsEngine() || IsMultiheaded()) {
|
if (IsEngine() || IsMultiheaded()) {
|
||||||
|
@@ -50,6 +50,7 @@ void CcBuildWagon(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p
|
|||||||
/* put the new wagon at the end of the loco. */
|
/* put the new wagon at the end of the loco. */
|
||||||
DoCommandP(0, _new_vehicle_id, found->index, CMD_MOVE_RAIL_VEHICLE);
|
DoCommandP(0, _new_vehicle_id, found->index, CMD_MOVE_RAIL_VEHICLE);
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1992,6 +1992,7 @@ void VehicleEnterDepot(Vehicle *v)
|
|||||||
case VEH_TRAIN: {
|
case VEH_TRAIN: {
|
||||||
Train *t = Train::From(v);
|
Train *t = Train::From(v);
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
/* Clear path reservation */
|
/* Clear path reservation */
|
||||||
SetDepotReservation(t->tile, false);
|
SetDepotReservation(t->tile, false);
|
||||||
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile, ZOOM_LVL_DRAW_MAP);
|
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile, ZOOM_LVL_DRAW_MAP);
|
||||||
@@ -3658,6 +3659,7 @@ void VehiclesYearlyLoop()
|
|||||||
}
|
}
|
||||||
GroupStatistics::UpdateProfits();
|
GroupStatistics::UpdateProfits();
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
|
SetWindowClassesDirty(WC_TRACE_RESTRICT_SLOTS);
|
||||||
SetWindowClassesDirty(WC_SHIPS_LIST);
|
SetWindowClassesDirty(WC_SHIPS_LIST);
|
||||||
SetWindowClassesDirty(WC_ROADVEH_LIST);
|
SetWindowClassesDirty(WC_ROADVEH_LIST);
|
||||||
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
||||||
|
@@ -1210,6 +1210,7 @@ void ChangeWindowOwner(Owner old_owner, Owner new_owner)
|
|||||||
case WC_FINANCES:
|
case WC_FINANCES:
|
||||||
case WC_STATION_LIST:
|
case WC_STATION_LIST:
|
||||||
case WC_TRAINS_LIST:
|
case WC_TRAINS_LIST:
|
||||||
|
case WC_TRACE_RESTRICT_SLOTS:
|
||||||
case WC_ROADVEH_LIST:
|
case WC_ROADVEH_LIST:
|
||||||
case WC_SHIPS_LIST:
|
case WC_SHIPS_LIST:
|
||||||
case WC_AIRCRAFT_LIST:
|
case WC_AIRCRAFT_LIST:
|
||||||
|
Reference in New Issue
Block a user