Merge branch 'tracerestrict-sx' into jgrpp
This commit is contained in:
@@ -1497,8 +1497,11 @@ void TraceRestrictSlot::DeIndex(VehicleID id)
|
|||||||
auto range = slot_vehicle_index.equal_range(id);
|
auto range = slot_vehicle_index.equal_range(id);
|
||||||
for (auto it = range.first; it != range.second; ++it) {
|
for (auto it = range.first; it != range.second; ++it) {
|
||||||
if (it->second == this->index) {
|
if (it->second == this->index) {
|
||||||
|
bool is_first_in_range = (it == range.first);
|
||||||
|
|
||||||
auto next = slot_vehicle_index.erase(it);
|
auto next = slot_vehicle_index.erase(it);
|
||||||
if (it == range.first && next == range.second) {
|
|
||||||
|
if (is_first_in_range && next == range.second) {
|
||||||
/* Only one item, which we've just erased, clear the vehicle flag */
|
/* Only one item, which we've just erased, clear the vehicle flag */
|
||||||
ClrBit(Train::Get(id)->flags, VRF_HAVE_SLOT);
|
ClrBit(Train::Get(id)->flags, VRF_HAVE_SLOT);
|
||||||
}
|
}
|
||||||
|
@@ -2995,6 +2995,7 @@ public:
|
|||||||
case WID_TRSL_ALL_VEHICLES: // All vehicles button
|
case WID_TRSL_ALL_VEHICLES: // All vehicles button
|
||||||
if (this->vli.index != ALL_TRAINS_TRACE_RESTRICT_SLOT_ID) {
|
if (this->vli.index != ALL_TRAINS_TRACE_RESTRICT_SLOT_ID) {
|
||||||
this->vli.index = ALL_TRAINS_TRACE_RESTRICT_SLOT_ID;
|
this->vli.index = ALL_TRAINS_TRACE_RESTRICT_SLOT_ID;
|
||||||
|
this->slot_sel = INVALID_TRACE_RESTRICT_SLOT_ID;
|
||||||
this->vehicles.ForceRebuild();
|
this->vehicles.ForceRebuild();
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
@@ -3053,12 +3054,14 @@ public:
|
|||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_TRSL_ALL_VEHICLES: // All vehicles
|
case WID_TRSL_ALL_VEHICLES: // All vehicles
|
||||||
|
if (this->slot_sel != INVALID_TRACE_RESTRICT_SLOT_ID) {
|
||||||
DoCommandP(0, this->slot_sel, this->vehicle_sel, CMD_REMOVE_VEHICLE_TRACERESTRICT_SLOT | CMD_MSG(STR_TRACE_RESTRICT_ERROR_SLOT_CAN_T_REMOVE_VEHICLE));
|
DoCommandP(0, this->slot_sel, this->vehicle_sel, CMD_REMOVE_VEHICLE_TRACERESTRICT_SLOT | CMD_MSG(STR_TRACE_RESTRICT_ERROR_SLOT_CAN_T_REMOVE_VEHICLE));
|
||||||
|
|
||||||
this->vehicle_sel = INVALID_VEHICLE;
|
this->vehicle_sel = INVALID_VEHICLE;
|
||||||
this->slot_over = INVALID_GROUP;
|
this->slot_over = INVALID_GROUP;
|
||||||
|
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_TRSL_LIST_SLOTS: { // Matrix slot
|
case WID_TRSL_LIST_SLOTS: { // Matrix slot
|
||||||
|
Reference in New Issue
Block a user