Add current order (station, waypoint or depot) condition variable.
Adjust item bit allocations: * Increase cond flags from 2 bits to 3 bits, for future expansion. * Use 2 bits remaining in adjacent gap for an auxiliary type field. This is used for the type (station, waypoint, etc.) of order tests. Perform a linear scan of the program pool when deleting a station, waypoint or depot.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#include "core/pool_func.hpp"
|
#include "core/pool_func.hpp"
|
||||||
#include "vehicle_gui.h"
|
#include "vehicle_gui.h"
|
||||||
#include "vehiclelist.h"
|
#include "vehiclelist.h"
|
||||||
|
#include "tracerestrict.h"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@ Depot::~Depot()
|
|||||||
/* Clear the depot from all order-lists */
|
/* Clear the depot from all order-lists */
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
||||||
|
|
||||||
|
TraceRestrictRemoveDestinationID(TROCAF_DEPOT, this->index);
|
||||||
|
|
||||||
/* Delete the depot-window */
|
/* Delete the depot-window */
|
||||||
DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
|
DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
|
||||||
|
|
||||||
|
@@ -2384,9 +2384,14 @@ STR_TRACE_RESTRICT_CONDITIONAL_ELSE :Else
|
|||||||
STR_TRACE_RESTRICT_CONDITIONAL_ENDIF :End if
|
STR_TRACE_RESTRICT_CONDITIONAL_ENDIF :End if
|
||||||
STR_TRACE_RESTRICT_VARIABLE_TRAIN_LENGTH :train length
|
STR_TRACE_RESTRICT_VARIABLE_TRAIN_LENGTH :train length
|
||||||
STR_TRACE_RESTRICT_VARIABLE_MAX_SPEED :max speed
|
STR_TRACE_RESTRICT_VARIABLE_MAX_SPEED :max speed
|
||||||
|
STR_TRACE_RESTRICT_VARIABLE_CURRENT_ORDER :current order
|
||||||
STR_TRACE_RESTRICT_VARIABLE_UNDEFINED :undefined
|
STR_TRACE_RESTRICT_VARIABLE_UNDEFINED :undefined
|
||||||
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_INTEGER :{STRING} {STRING} {STRING} {COMMA} then
|
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_INTEGER :{STRING} {STRING} {STRING} {COMMA} then
|
||||||
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_SPEED :{STRING} {STRING} {STRING} {VELOCITY} then
|
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_SPEED :{STRING} {STRING} {STRING} {VELOCITY} then
|
||||||
|
STR_TRACE_RESTRICT_CONDITIONAL_ORDER_STATION :{STRING} {STRING} {STRING} {STATION} then
|
||||||
|
STR_TRACE_RESTRICT_CONDITIONAL_ORDER_WAYPOINT :{STRING} {STRING} {STRING} {WAYPOINT} then
|
||||||
|
STR_TRACE_RESTRICT_CONDITIONAL_ORDER_DEPOT :{STRING} {STRING} {STRING} {DEPOT} then
|
||||||
|
STR_TRACE_RESTRICT_CONDITIONAL_UNDEFINED :{STRING} {STRING} {STRING} {RED}undefined {BLACK}{STRING}then
|
||||||
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_UNDEFINED :{STRING} {RED}undefined {BLACK}{STRING}then
|
STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_UNDEFINED :{STRING} {RED}undefined {BLACK}{STRING}then
|
||||||
STR_TRACE_RESTRICT_PF_PENALTY_ITEM :Add pathfinder penalty: {COMMA}
|
STR_TRACE_RESTRICT_PF_PENALTY_ITEM :Add pathfinder penalty: {COMMA}
|
||||||
STR_TRACE_RESTRICT_WHITE :{WHITE}
|
STR_TRACE_RESTRICT_WHITE :{WHITE}
|
||||||
@@ -2409,6 +2414,7 @@ STR_TRACE_RESTRICT_RESET :{BLACK}Reset
|
|||||||
STR_TRACE_RESTRICT_COPY :{BLACK}Copy
|
STR_TRACE_RESTRICT_COPY :{BLACK}Copy
|
||||||
STR_TRACE_RESTRICT_SHARE :{BLACK}Share
|
STR_TRACE_RESTRICT_SHARE :{BLACK}Share
|
||||||
STR_TRACE_RESTRICT_UNSHARE :{BLACK}Unshare
|
STR_TRACE_RESTRICT_UNSHARE :{BLACK}Unshare
|
||||||
|
STR_TRACE_RESTRICT_SELECT_TARGET :{BLACK}Select Target
|
||||||
STR_TRACE_RESTRICT_INSERT_TOOLTIP :{BLACK}Insert an instruction
|
STR_TRACE_RESTRICT_INSERT_TOOLTIP :{BLACK}Insert an instruction
|
||||||
STR_TRACE_RESTRICT_REMOVE_TOOLTIP :{BLACK}Remove the selected instruction
|
STR_TRACE_RESTRICT_REMOVE_TOOLTIP :{BLACK}Remove the selected instruction
|
||||||
STR_TRACE_RESTRICT_RESET_TOOLTIP :{BLACK}Reset the current signal (without affecting shared programs)
|
STR_TRACE_RESTRICT_RESET_TOOLTIP :{BLACK}Reset the current signal (without affecting shared programs)
|
||||||
@@ -2416,6 +2422,7 @@ STR_TRACE_RESTRICT_COPY_TOOLTIP :{BLACK}Copy pro
|
|||||||
STR_TRACE_RESTRICT_SHARE_TOOLTIP :{BLACK}Share program with another signal
|
STR_TRACE_RESTRICT_SHARE_TOOLTIP :{BLACK}Share program with another signal
|
||||||
STR_TRACE_RESTRICT_UNSHARE_TOOLTIP :{BLACK}Stop sharing program with other signals, create a copy of the program
|
STR_TRACE_RESTRICT_UNSHARE_TOOLTIP :{BLACK}Stop sharing program with other signals, create a copy of the program
|
||||||
STR_TRACE_RESTRICT_SIGNAL_GUI_TOOLTIP :{BLACK}Routefinding restriction
|
STR_TRACE_RESTRICT_SIGNAL_GUI_TOOLTIP :{BLACK}Routefinding restriction
|
||||||
|
STR_TRACE_RESTRICT_INSTRUCTION_LIST_TOOLTIP :{BLACK}Click an instruction to select it{}Ctrl+Click to scroll to the instruction's target (if any)
|
||||||
STR_TRACE_RESTRICT_ERROR_CAN_T_INSERT_ITEM :{WHITE}Can't insert instruction
|
STR_TRACE_RESTRICT_ERROR_CAN_T_INSERT_ITEM :{WHITE}Can't insert instruction
|
||||||
STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM :{WHITE}Can't modify instruction
|
STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM :{WHITE}Can't modify instruction
|
||||||
STR_TRACE_RESTRICT_ERROR_CAN_T_REMOVE_ITEM :{WHITE}Can't remove instruction
|
STR_TRACE_RESTRICT_ERROR_CAN_T_REMOVE_ITEM :{WHITE}Can't remove instruction
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "core/random_func.hpp"
|
#include "core/random_func.hpp"
|
||||||
#include "linkgraph/linkgraph.h"
|
#include "linkgraph/linkgraph.h"
|
||||||
#include "linkgraph/linkgraphschedule.h"
|
#include "linkgraph/linkgraphschedule.h"
|
||||||
|
#include "tracerestrict.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
@@ -137,6 +138,8 @@ Station::~Station()
|
|||||||
/* Now delete all orders that go to the station */
|
/* Now delete all orders that go to the station */
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
|
||||||
|
|
||||||
|
TraceRestrictRemoveDestinationID(TROCAF_STATION, this->index);
|
||||||
|
|
||||||
/* Remove all news items */
|
/* Remove all news items */
|
||||||
DeleteStationNews(this->index);
|
DeleteStationNews(this->index);
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "company_func.h"
|
#include "company_func.h"
|
||||||
#include "viewport_func.h"
|
#include "viewport_func.h"
|
||||||
#include "window_func.h"
|
#include "window_func.h"
|
||||||
|
#include "order_base.h"
|
||||||
#include "pathfinder/yapf/yapf_cache.h"
|
#include "pathfinder/yapf/yapf_cache.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -131,6 +132,45 @@ static bool TestCondition(uint16 value, TraceRestrictCondOp condop, uint16 condv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Test order condition
|
||||||
|
/// order may be NULL
|
||||||
|
static bool TestOrderCondition(const Order *order, TraceRestrictItem item)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (order) {
|
||||||
|
DestinationID condvalue = GetTraceRestrictValue(item);
|
||||||
|
switch (static_cast<TraceRestrictOrderCondAuxField>(GetTraceRestrictAuxField(item))) {
|
||||||
|
case TROCAF_STATION:
|
||||||
|
result = order->IsType(OT_GOTO_STATION) && order->GetDestination() == condvalue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TROCAF_WAYPOINT:
|
||||||
|
result = order->IsType(OT_GOTO_WAYPOINT) && order->GetDestination() == condvalue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_GOTO_DEPOT:
|
||||||
|
result = order->IsType(OT_GOTO_DEPOT) && order->GetDestination() == condvalue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (GetTraceRestrictCondOp(item)) {
|
||||||
|
case TRCO_IS:
|
||||||
|
return result;
|
||||||
|
|
||||||
|
case TRCO_ISNOT:
|
||||||
|
return !result;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Execute program on train and store results in out
|
/// Execute program on train and store results in out
|
||||||
void TraceRestrictProgram::Execute(const Train* v, TraceRestrictProgramResult& out) const
|
void TraceRestrictProgram::Execute(const Train* v, TraceRestrictProgramResult& out) const
|
||||||
{
|
{
|
||||||
@@ -174,6 +214,10 @@ void TraceRestrictProgram::Execute(const Train* v, TraceRestrictProgramResult& o
|
|||||||
result = TestCondition(v->GetDisplayMaxSpeed(), condop, condvalue);
|
result = TestCondition(v->GetDisplayMaxSpeed(), condop, condvalue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TRIT_COND_CURRENT_ORDER:
|
||||||
|
result = TestOrderCondition(&(v->current_order), item);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
@@ -266,6 +310,12 @@ void SetTraceRestrictValueDefault(TraceRestrictItem &item, TraceRestrictValueTyp
|
|||||||
case TRVT_DENY:
|
case TRVT_DENY:
|
||||||
case TRVT_SPEED:
|
case TRVT_SPEED:
|
||||||
SetTraceRestrictValue(item, 0);
|
SetTraceRestrictValue(item, 0);
|
||||||
|
SetTraceRestrictAuxField(item, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TRVT_ORDER:
|
||||||
|
SetTraceRestrictValue(item, INVALID_STATION);
|
||||||
|
SetTraceRestrictAuxField(item, TROCAF_STATION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -679,3 +729,22 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag
|
|||||||
|
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceRestrictRemoveDestinationID(TraceRestrictOrderCondAuxField type, uint16 index)
|
||||||
|
{
|
||||||
|
TraceRestrictProgram *prog;
|
||||||
|
|
||||||
|
FOR_ALL_TRACE_RESTRICT_PROGRAMS(prog) {
|
||||||
|
for (size_t i = 0; i < prog->items.size(); i++) {
|
||||||
|
TraceRestrictItem &item = prog->items[i]; // note this is a reference,
|
||||||
|
if (GetTraceRestrictType(item) == TRIT_COND_CURRENT_ORDER) {
|
||||||
|
if (GetTraceRestrictAuxField(item) == type && GetTraceRestrictValue(item) == index) {
|
||||||
|
SetTraceRestrictValueDefault(item, TRVT_ORDER); // this updates the instruction in-place
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update windows
|
||||||
|
InvalidateWindowClassesData(WC_TRACE_RESTRICT);
|
||||||
|
}
|
||||||
|
@@ -59,10 +59,11 @@ enum TraceRestrictItemFlagAllocation {
|
|||||||
|
|
||||||
/* 3 bits reserved for future use */
|
/* 3 bits reserved for future use */
|
||||||
|
|
||||||
TRIFA_COND_FLAGS_COUNT = 2,
|
TRIFA_COND_FLAGS_COUNT = 3,
|
||||||
TRIFA_COND_FLAGS_OFFSET = 8,
|
TRIFA_COND_FLAGS_OFFSET = 8,
|
||||||
|
|
||||||
/* 3 bits reserved for future use */
|
TRIFA_AUX_FIELD_COUNT = 2,
|
||||||
|
TRIFA_AUX_FIELD_OFFSET = 11,
|
||||||
|
|
||||||
TRIFA_COND_OP_COUNT = 3,
|
TRIFA_COND_OP_COUNT = 3,
|
||||||
TRIFA_COND_OP_OFFSET = 13,
|
TRIFA_COND_OP_OFFSET = 13,
|
||||||
@@ -81,6 +82,7 @@ enum TraceRestrictItemType {
|
|||||||
TRIT_COND_UNDEFINED = 9, ///< This condition has no type defined (evaluate as false)
|
TRIT_COND_UNDEFINED = 9, ///< This condition has no type defined (evaluate as false)
|
||||||
TRIT_COND_TRAIN_LENGTH = 10, ///< Test train length
|
TRIT_COND_TRAIN_LENGTH = 10, ///< Test train length
|
||||||
TRIT_COND_MAX_SPEED = 11, ///< Test train max speed
|
TRIT_COND_MAX_SPEED = 11, ///< Test train max speed
|
||||||
|
TRIT_COND_CURRENT_ORDER = 12, ///< Test train current order (station, waypoint or depot)
|
||||||
/* space up to 31 */
|
/* space up to 31 */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -88,6 +90,7 @@ enum TraceRestrictItemType {
|
|||||||
enum TraceRestrictCondFlags {
|
enum TraceRestrictCondFlags {
|
||||||
TRCF_ELSE = 1 << 0,
|
TRCF_ELSE = 1 << 0,
|
||||||
TRCF_OR = 1 << 1,
|
TRCF_OR = 1 << 1,
|
||||||
|
/* 1 bit spare */
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(TraceRestrictCondFlags)
|
DECLARE_ENUM_AS_BIT_SET(TraceRestrictCondFlags)
|
||||||
|
|
||||||
@@ -107,6 +110,13 @@ enum TraceRestrictCondOp {
|
|||||||
/* space up to 7 */
|
/* space up to 7 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TraceRestrictOrderCondAuxField {
|
||||||
|
TROCAF_STATION = 0,
|
||||||
|
TROCAF_WAYPOINT = 1,
|
||||||
|
TROCAF_DEPOT = 2,
|
||||||
|
/* space up to 7 */
|
||||||
|
};
|
||||||
|
|
||||||
enum TraceRestrictProgramResultFlags {
|
enum TraceRestrictProgramResultFlags {
|
||||||
TRPRF_DENY = 1 << 0,
|
TRPRF_DENY = 1 << 0,
|
||||||
};
|
};
|
||||||
@@ -155,6 +165,11 @@ static inline TraceRestrictCondOp GetTraceRestrictCondOp(TraceRestrictItem item)
|
|||||||
return static_cast<TraceRestrictCondOp>(GB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT));
|
return static_cast<TraceRestrictCondOp>(GB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint8 GetTraceRestrictAuxField(TraceRestrictItem item)
|
||||||
|
{
|
||||||
|
return GB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
static inline uint16 GetTraceRestrictValue(TraceRestrictItem item)
|
static inline uint16 GetTraceRestrictValue(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return static_cast<uint16>(GB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT));
|
return static_cast<uint16>(GB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT));
|
||||||
@@ -170,6 +185,11 @@ static inline void SetTraceRestrictCondOp(TraceRestrictItem &item, TraceRestrict
|
|||||||
SB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT, condop);
|
SB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT, condop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void SetTraceRestrictAuxField(TraceRestrictItem &item, uint8 data)
|
||||||
|
{
|
||||||
|
SB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT, data);
|
||||||
|
}
|
||||||
|
|
||||||
void SetTraceRestrictTypeAndNormalise(TraceRestrictItem &item, TraceRestrictItemType type);
|
void SetTraceRestrictTypeAndNormalise(TraceRestrictItem &item, TraceRestrictItemType type);
|
||||||
|
|
||||||
static inline void SetTraceRestrictValue(TraceRestrictItem &item, uint16 value)
|
static inline void SetTraceRestrictValue(TraceRestrictItem &item, uint16 value)
|
||||||
@@ -199,6 +219,7 @@ enum TraceRestrictValueType {
|
|||||||
TRVT_INT = 2, ///< takes an integer value
|
TRVT_INT = 2, ///< takes an integer value
|
||||||
TRVT_DENY = 3, ///< takes a value 0 = deny, 1 = allow (cancel previous deny)
|
TRVT_DENY = 3, ///< takes a value 0 = deny, 1 = allow (cancel previous deny)
|
||||||
TRVT_SPEED = 4, ///< takes an integer speed value
|
TRVT_SPEED = 4, ///< takes an integer speed value
|
||||||
|
TRVT_ORDER = 5, ///< takes an order target ID, as per the auxiliary field as type: TraceRestrictOrderCondAuxField
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TraceRestrictTypePropertySet {
|
struct TraceRestrictTypePropertySet {
|
||||||
@@ -229,6 +250,11 @@ static inline TraceRestrictTypePropertySet GetTraceRestrictTypeProperties(TraceR
|
|||||||
out.value_type = TRVT_SPEED;
|
out.value_type = TRVT_SPEED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TRIT_COND_CURRENT_ORDER:
|
||||||
|
out.value_type = TRVT_ORDER;
|
||||||
|
out.cond_type = TRCOT_BINARY;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
break;
|
break;
|
||||||
@@ -311,4 +337,6 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag
|
|||||||
|
|
||||||
void ShowTraceRestrictProgramWindow(TileIndex tile, Track track);
|
void ShowTraceRestrictProgramWindow(TileIndex tile, Track track);
|
||||||
|
|
||||||
|
void TraceRestrictRemoveDestinationID(TraceRestrictOrderCondAuxField type, uint16 index);
|
||||||
|
|
||||||
#endif /* TRACERESTRICT_H */
|
#endif /* TRACERESTRICT_H */
|
||||||
|
@@ -23,7 +23,11 @@
|
|||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "gfx_func.h"
|
#include "gfx_func.h"
|
||||||
#include "rail_map.h"
|
#include "rail_map.h"
|
||||||
|
#include "depot_map.h"
|
||||||
#include "tile_cmd.h"
|
#include "tile_cmd.h"
|
||||||
|
#include "station_base.h"
|
||||||
|
#include "waypoint_base.h"
|
||||||
|
#include "depot_base.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
|
|
||||||
@@ -44,6 +48,7 @@ enum TraceRestrictWindowWidgets {
|
|||||||
TR_WIDGET_COMPARATOR,
|
TR_WIDGET_COMPARATOR,
|
||||||
TR_WIDGET_VALUE_INT,
|
TR_WIDGET_VALUE_INT,
|
||||||
TR_WIDGET_VALUE_DROPDOWN,
|
TR_WIDGET_VALUE_DROPDOWN,
|
||||||
|
TR_WIDGET_VALUE_DEST,
|
||||||
|
|
||||||
TR_WIDGET_BLANK_L,
|
TR_WIDGET_BLANK_L,
|
||||||
TR_WIDGET_BLANK_M,
|
TR_WIDGET_BLANK_M,
|
||||||
@@ -70,6 +75,7 @@ enum PanelWidgets {
|
|||||||
// Right
|
// Right
|
||||||
DPR_VALUE_INT = 0,
|
DPR_VALUE_INT = 0,
|
||||||
DPR_VALUE_DROPDOWN,
|
DPR_VALUE_DROPDOWN,
|
||||||
|
DPR_VALUE_DEST,
|
||||||
DPR_BLANK,
|
DPR_BLANK,
|
||||||
|
|
||||||
// Share
|
// Share
|
||||||
@@ -152,12 +158,14 @@ static const TraceRestrictDropDownListSet *GetTypeDropDownListSet(TraceRestrictI
|
|||||||
static const StringID str_cond[] = {
|
static const StringID str_cond[] = {
|
||||||
STR_TRACE_RESTRICT_VARIABLE_TRAIN_LENGTH,
|
STR_TRACE_RESTRICT_VARIABLE_TRAIN_LENGTH,
|
||||||
STR_TRACE_RESTRICT_VARIABLE_MAX_SPEED,
|
STR_TRACE_RESTRICT_VARIABLE_MAX_SPEED,
|
||||||
|
STR_TRACE_RESTRICT_VARIABLE_CURRENT_ORDER,
|
||||||
STR_TRACE_RESTRICT_VARIABLE_UNDEFINED,
|
STR_TRACE_RESTRICT_VARIABLE_UNDEFINED,
|
||||||
INVALID_STRING_ID,
|
INVALID_STRING_ID,
|
||||||
};
|
};
|
||||||
static const uint val_cond[] = {
|
static const uint val_cond[] = {
|
||||||
TRIT_COND_TRAIN_LENGTH,
|
TRIT_COND_TRAIN_LENGTH,
|
||||||
TRIT_COND_MAX_SPEED,
|
TRIT_COND_MAX_SPEED,
|
||||||
|
TRIT_COND_CURRENT_ORDER,
|
||||||
TRIT_COND_UNDEFINED,
|
TRIT_COND_UNDEFINED,
|
||||||
};
|
};
|
||||||
static const TraceRestrictDropDownListSet set_cond = {
|
static const TraceRestrictDropDownListSet set_cond = {
|
||||||
@@ -257,12 +265,17 @@ static const StringID _program_cond_type[] = {
|
|||||||
/* TRCF_OR */ STR_TRACE_RESTRICT_CONDITIONAL_ORIF,
|
/* TRCF_OR */ STR_TRACE_RESTRICT_CONDITIONAL_ORIF,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void DrawInstructionStringConditionalIntegerCommon(TraceRestrictItem item, const TraceRestrictTypePropertySet &properties)
|
static void DrawInstructionStringConditionalCommon(TraceRestrictItem item, const TraceRestrictTypePropertySet &properties)
|
||||||
{
|
{
|
||||||
assert(GetTraceRestrictCondFlags(item) <= TRCF_OR);
|
assert(GetTraceRestrictCondFlags(item) <= TRCF_OR);
|
||||||
SetDParam(0, _program_cond_type[GetTraceRestrictCondFlags(item)]);
|
SetDParam(0, _program_cond_type[GetTraceRestrictCondFlags(item)]);
|
||||||
SetDParam(1, GetTypeString(GetTraceRestrictType(item)));
|
SetDParam(1, GetTypeString(GetTraceRestrictType(item)));
|
||||||
SetDParam(2, GetDropDownStringByValue(GetCondOpDropDownListSet(properties.cond_type), GetTraceRestrictCondOp(item)));
|
SetDParam(2, GetDropDownStringByValue(GetCondOpDropDownListSet(properties.cond_type), GetTraceRestrictCondOp(item)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawInstructionStringConditionalIntegerCommon(TraceRestrictItem item, const TraceRestrictTypePropertySet &properties)
|
||||||
|
{
|
||||||
|
DrawInstructionStringConditionalCommon(item, properties);
|
||||||
SetDParam(3, GetTraceRestrictValue(item));
|
SetDParam(3, GetTraceRestrictValue(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,14 +305,55 @@ static void DrawInstructionString(TraceRestrictItem item, int y, bool selected,
|
|||||||
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_UNDEFINED;
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_UNDEFINED;
|
||||||
SetDParam(0, _program_cond_type[GetTraceRestrictCondFlags(item)]);
|
SetDParam(0, _program_cond_type[GetTraceRestrictCondFlags(item)]);
|
||||||
SetDParam(1, selected ? STR_TRACE_RESTRICT_WHITE : STR_EMPTY);
|
SetDParam(1, selected ? STR_TRACE_RESTRICT_WHITE : STR_EMPTY);
|
||||||
} else if (properties.value_type == TRVT_INT) {
|
|
||||||
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_INTEGER;
|
|
||||||
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
|
||||||
} else if (properties.value_type == TRVT_SPEED) {
|
|
||||||
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_SPEED;
|
|
||||||
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
|
||||||
} else {
|
} else {
|
||||||
NOT_REACHED();
|
switch (properties.value_type) {
|
||||||
|
case TRVT_INT:
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_INTEGER;
|
||||||
|
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TRVT_SPEED:
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_COMPARE_SPEED;
|
||||||
|
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TRVT_ORDER: {
|
||||||
|
switch (static_cast<TraceRestrictOrderCondAuxField>(GetTraceRestrictAuxField(item))) {
|
||||||
|
case TROCAF_STATION:
|
||||||
|
if (GetTraceRestrictValue(item) != INVALID_STATION) {
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_ORDER_STATION;
|
||||||
|
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
||||||
|
} else {
|
||||||
|
// this is an invalid station, use a seperate string
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_UNDEFINED;
|
||||||
|
DrawInstructionStringConditionalCommon(item, properties);
|
||||||
|
SetDParam(3, selected ? STR_TRACE_RESTRICT_WHITE : STR_EMPTY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TROCAF_WAYPOINT:
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_ORDER_WAYPOINT;
|
||||||
|
DrawInstructionStringConditionalIntegerCommon(item, properties);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TROCAF_DEPOT:
|
||||||
|
instruction_string = STR_TRACE_RESTRICT_CONDITIONAL_ORDER_DEPOT;
|
||||||
|
DrawInstructionStringConditionalCommon(item, properties);
|
||||||
|
SetDParam(3, VEH_TRAIN);
|
||||||
|
SetDParam(4, GetTraceRestrictValue(item));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (GetTraceRestrictType(item)) {
|
switch (GetTraceRestrictType(item)) {
|
||||||
@@ -369,6 +423,35 @@ public:
|
|||||||
case TR_WIDGET_INSTRUCTION_LIST: {
|
case TR_WIDGET_INSTRUCTION_LIST: {
|
||||||
int sel = this->GetInstructionFromPt(pt.y);
|
int sel = this->GetInstructionFromPt(pt.y);
|
||||||
|
|
||||||
|
if (_ctrl_pressed) {
|
||||||
|
// scroll to target (for stations, waypoints, depots)
|
||||||
|
|
||||||
|
if (sel == -1) return;
|
||||||
|
|
||||||
|
TraceRestrictItem item = this->GetItem(this->GetProgram(), sel);
|
||||||
|
if (GetTraceRestrictTypeProperties(item).value_type == TRVT_ORDER) {
|
||||||
|
switch (static_cast<TraceRestrictOrderCondAuxField>(GetTraceRestrictAuxField(item))) {
|
||||||
|
case TROCAF_STATION:
|
||||||
|
case TROCAF_WAYPOINT: {
|
||||||
|
BaseStation *st = BaseStation::GetIfValid(GetTraceRestrictValue(item));
|
||||||
|
if (st) {
|
||||||
|
ScrollMainWindowToTile(st->xy);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TROCAF_DEPOT: {
|
||||||
|
Depot *depot = Depot::GetIfValid(GetTraceRestrictValue(item));
|
||||||
|
if (depot) {
|
||||||
|
ScrollMainWindowToTile(depot->xy);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->DeleteChildWindows();
|
this->DeleteChildWindows();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
|
|
||||||
@@ -440,6 +523,11 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TR_WIDGET_VALUE_DEST: {
|
||||||
|
SetObjectToPlaceAction(widget, ANIMCURSOR_PICKSTATION);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case TR_WIDGET_GOTO_SIGNAL:
|
case TR_WIDGET_GOTO_SIGNAL:
|
||||||
ScrollMainWindowToTile(this->tile);
|
ScrollMainWindowToTile(this->tile);
|
||||||
break;
|
break;
|
||||||
@@ -451,7 +539,7 @@ public:
|
|||||||
|
|
||||||
case TR_WIDGET_COPY:
|
case TR_WIDGET_COPY:
|
||||||
case TR_WIDGET_SHARE:
|
case TR_WIDGET_SHARE:
|
||||||
SelectSignalAction(widget);
|
SetObjectToPlaceAction(widget, ANIMCURSOR_BUILDSIGNALS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TR_WIDGET_UNSHARE: {
|
case TR_WIDGET_UNSHARE: {
|
||||||
@@ -527,7 +615,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlaceObject(Point pt, TileIndex source_tile)
|
virtual void OnPlaceObject(Point pt, TileIndex tile)
|
||||||
{
|
{
|
||||||
int widget = this->current_placement_widget;
|
int widget = this->current_placement_widget;
|
||||||
this->current_placement_widget = -1;
|
this->current_placement_widget = -1;
|
||||||
@@ -539,8 +627,27 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int error_message = (widget == TR_WIDGET_COPY) ? STR_TRACE_RESTRICT_ERROR_CAN_T_COPY_PROGRAM : STR_TRACE_RESTRICT_ERROR_CAN_T_SHARE_PROGRAM;
|
switch (widget) {
|
||||||
|
case TR_WIDGET_COPY:
|
||||||
|
OnPlaceObjectSignal(pt, tile, widget, STR_TRACE_RESTRICT_ERROR_CAN_T_COPY_PROGRAM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_WIDGET_SHARE:
|
||||||
|
OnPlaceObjectSignal(pt, tile, widget, STR_TRACE_RESTRICT_ERROR_CAN_T_SHARE_PROGRAM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_WIDGET_VALUE_DEST:
|
||||||
|
OnPlaceObjectDestination(pt, tile, widget, STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnPlaceObjectSignal(Point pt, TileIndex source_tile, int widget, int error_message)
|
||||||
|
{
|
||||||
if (!IsPlainRailTile(source_tile)) {
|
if (!IsPlainRailTile(source_tile)) {
|
||||||
ShowErrorMessage(error_message, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, WL_INFO);
|
ShowErrorMessage(error_message, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, WL_INFO);
|
||||||
return;
|
return;
|
||||||
@@ -587,6 +694,38 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnPlaceObjectDestination(Point pt, TileIndex tile, int widget, int error_message)
|
||||||
|
{
|
||||||
|
TraceRestrictItem item = GetSelected();
|
||||||
|
if (GetTraceRestrictTypeProperties(item).value_type != TRVT_ORDER) return;
|
||||||
|
|
||||||
|
if (IsDepotTypeTile(tile, TRANSPORT_RAIL)) {
|
||||||
|
SetTraceRestrictValue(item, GetDepotIndex(tile));
|
||||||
|
SetTraceRestrictAuxField(item, TROCAF_DEPOT);
|
||||||
|
} else if (IsRailWaypointTile(tile)) {
|
||||||
|
SetTraceRestrictValue(item, GetStationIndex(tile));
|
||||||
|
SetTraceRestrictAuxField(item, TROCAF_WAYPOINT);
|
||||||
|
} else if (IsTileType(tile, MP_STATION)) {
|
||||||
|
StationID st_index = GetStationIndex(tile);
|
||||||
|
const Station *st = Station::Get(st_index);
|
||||||
|
if (st->facilities & FACIL_TRAIN) {
|
||||||
|
SetTraceRestrictValue(item, st_index);
|
||||||
|
SetTraceRestrictAuxField(item, TROCAF_STATION);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsTileOwner(tile, _local_company)) {
|
||||||
|
ShowErrorMessage(error_message, STR_ERROR_AREA_IS_OWNED_BY_ANOTHER, WL_INFO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TraceRestrictDoCommandP(this->tile, this->track, TRDCT_MODIFY_ITEM, this->selected_instruction - 1, item, STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void OnPlaceObjectAbort()
|
virtual void OnPlaceObjectAbort()
|
||||||
{
|
{
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
@@ -789,6 +928,7 @@ private:
|
|||||||
this->RaiseWidget(TR_WIDGET_COMPARATOR);
|
this->RaiseWidget(TR_WIDGET_COMPARATOR);
|
||||||
this->RaiseWidget(TR_WIDGET_VALUE_INT);
|
this->RaiseWidget(TR_WIDGET_VALUE_INT);
|
||||||
this->RaiseWidget(TR_WIDGET_VALUE_DROPDOWN);
|
this->RaiseWidget(TR_WIDGET_VALUE_DROPDOWN);
|
||||||
|
this->RaiseWidget(TR_WIDGET_VALUE_DEST);
|
||||||
|
|
||||||
NWidgetStacked *left_sel = this->GetWidget<NWidgetStacked>(TR_WIDGET_SEL_TOP_LEFT);
|
NWidgetStacked *left_sel = this->GetWidget<NWidgetStacked>(TR_WIDGET_SEL_TOP_LEFT);
|
||||||
NWidgetStacked *middle_sel = this->GetWidget<NWidgetStacked>(TR_WIDGET_SEL_TOP_MIDDLE);
|
NWidgetStacked *middle_sel = this->GetWidget<NWidgetStacked>(TR_WIDGET_SEL_TOP_MIDDLE);
|
||||||
@@ -799,6 +939,7 @@ private:
|
|||||||
this->DisableWidget(TR_WIDGET_COMPARATOR);
|
this->DisableWidget(TR_WIDGET_COMPARATOR);
|
||||||
this->DisableWidget(TR_WIDGET_VALUE_INT);
|
this->DisableWidget(TR_WIDGET_VALUE_INT);
|
||||||
this->DisableWidget(TR_WIDGET_VALUE_DROPDOWN);
|
this->DisableWidget(TR_WIDGET_VALUE_DROPDOWN);
|
||||||
|
this->DisableWidget(TR_WIDGET_VALUE_DEST);
|
||||||
|
|
||||||
this->DisableWidget(TR_WIDGET_INSERT);
|
this->DisableWidget(TR_WIDGET_INSERT);
|
||||||
this->DisableWidget(TR_WIDGET_REMOVE);
|
this->DisableWidget(TR_WIDGET_REMOVE);
|
||||||
@@ -892,11 +1033,23 @@ private:
|
|||||||
if (IsIntegerValueType(properties.value_type)) {
|
if (IsIntegerValueType(properties.value_type)) {
|
||||||
right_sel->SetDisplayedPlane(DPR_VALUE_INT);
|
right_sel->SetDisplayedPlane(DPR_VALUE_INT);
|
||||||
this->EnableWidget(TR_WIDGET_VALUE_INT);
|
this->EnableWidget(TR_WIDGET_VALUE_INT);
|
||||||
} else if (properties.value_type == TRVT_DENY) {
|
} else {
|
||||||
right_sel->SetDisplayedPlane(DPR_VALUE_DROPDOWN);
|
switch (properties.value_type) {
|
||||||
this->EnableWidget(TR_WIDGET_VALUE_DROPDOWN);
|
case TRVT_DENY:
|
||||||
this->GetWidget<NWidgetCore>(TR_WIDGET_VALUE_DROPDOWN)->widget_data =
|
right_sel->SetDisplayedPlane(DPR_VALUE_DROPDOWN);
|
||||||
GetTraceRestrictValue(item) ? STR_TRACE_RESTRICT_PF_ALLOW : STR_TRACE_RESTRICT_PF_DENY;
|
this->EnableWidget(TR_WIDGET_VALUE_DROPDOWN);
|
||||||
|
this->GetWidget<NWidgetCore>(TR_WIDGET_VALUE_DROPDOWN)->widget_data =
|
||||||
|
GetTraceRestrictValue(item) ? STR_TRACE_RESTRICT_PF_ALLOW : STR_TRACE_RESTRICT_PF_DENY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TRVT_ORDER:
|
||||||
|
right_sel->SetDisplayedPlane(DPR_VALUE_DEST);
|
||||||
|
this->EnableWidget(TR_WIDGET_VALUE_DEST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->EnableWidget(TR_WIDGET_INSERT);
|
this->EnableWidget(TR_WIDGET_INSERT);
|
||||||
@@ -915,12 +1068,12 @@ private:
|
|||||||
ShowDropDownMenu(this, list_set->string_array, selected, button, disabled_mask, hidden_mask, width);
|
ShowDropDownMenu(this, list_set->string_array, selected, button, disabled_mask, hidden_mask, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectSignalAction(int widget)
|
void SetObjectToPlaceAction(int widget, CursorID cursor)
|
||||||
{
|
{
|
||||||
this->ToggleWidgetLoweredState(widget);
|
this->ToggleWidgetLoweredState(widget);
|
||||||
this->SetWidgetDirty(widget);
|
this->SetWidgetDirty(widget);
|
||||||
if (this->IsWidgetLowered(widget)) {
|
if (this->IsWidgetLowered(widget)) {
|
||||||
SetObjectToPlaceWnd(ANIMCURSOR_BUILDSIGNALS, PAL_NONE, HT_RECT, this);
|
SetObjectToPlaceWnd(cursor, PAL_NONE, HT_RECT, this);
|
||||||
this->current_placement_widget = widget;
|
this->current_placement_widget = widget;
|
||||||
} else {
|
} else {
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
@@ -940,7 +1093,7 @@ static const NWidgetPart _nested_program_widgets[] = {
|
|||||||
|
|
||||||
// Program display
|
// Program display
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_PANEL, COLOUR_GREY, TR_WIDGET_INSTRUCTION_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_TRACE_RESTRICT_SIGNAL_GUI_TOOLTIP), SetResize(1, 1), EndContainer(),
|
NWidget(WWT_PANEL, COLOUR_GREY, TR_WIDGET_INSTRUCTION_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_TRACE_RESTRICT_INSTRUCTION_LIST_TOOLTIP), SetResize(1, 1), EndContainer(),
|
||||||
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, TR_WIDGET_SCROLLBAR),
|
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, TR_WIDGET_SCROLLBAR),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
|
||||||
@@ -964,6 +1117,8 @@ static const NWidgetPart _nested_program_widgets[] = {
|
|||||||
SetDataTip(STR_BLACK_COMMA, STR_TRACE_RESTRICT_COND_VALUE_TOOLTIP), SetResize(1, 0),
|
SetDataTip(STR_BLACK_COMMA, STR_TRACE_RESTRICT_COND_VALUE_TOOLTIP), SetResize(1, 0),
|
||||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, TR_WIDGET_VALUE_DROPDOWN), SetMinimalSize(124, 12), SetFill(1, 0),
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, TR_WIDGET_VALUE_DROPDOWN), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||||
SetDataTip(STR_NULL, STR_TRACE_RESTRICT_COND_VALUE_TOOLTIP), SetResize(1, 0),
|
SetDataTip(STR_NULL, STR_TRACE_RESTRICT_COND_VALUE_TOOLTIP), SetResize(1, 0),
|
||||||
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, TR_WIDGET_VALUE_DEST), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||||
|
SetDataTip(STR_TRACE_RESTRICT_SELECT_TARGET, STR_TRACE_RESTRICT_SELECT_TARGET), SetResize(1, 0),
|
||||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, TR_WIDGET_BLANK_R), SetMinimalSize(124, 12), SetFill(1, 0),
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, TR_WIDGET_BLANK_R), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||||
SetDataTip(STR_EMPTY, STR_NULL), SetResize(1, 0),
|
SetDataTip(STR_EMPTY, STR_NULL), SetResize(1, 0),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include "window_func.h"
|
#include "window_func.h"
|
||||||
#include "newgrf_station.h"
|
#include "newgrf_station.h"
|
||||||
#include "waypoint_base.h"
|
#include "waypoint_base.h"
|
||||||
|
#include "tracerestrict.h"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
@@ -54,4 +55,5 @@ Waypoint::~Waypoint()
|
|||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
|
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
||||||
|
TraceRestrictRemoveDestinationID(TROCAF_WAYPOINT, this->index);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user