From 9c5189b2125d05a050523ad8bf9bd4e2818b00bf Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 15 Dec 2015 18:36:02 +0000 Subject: [PATCH 1/2] Handle double instructions correctly when deleting stations/depots/etc. Fix some whitespace and comment typos. --- src/tracerestrict.cpp | 1 + src/tracerestrict.h | 2 +- src/tracerestrict_gui.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tracerestrict.cpp b/src/tracerestrict.cpp index c69da07ce8..8d0ed43240 100644 --- a/src/tracerestrict.cpp +++ b/src/tracerestrict.cpp @@ -1084,6 +1084,7 @@ void TraceRestrictRemoveDestinationID(TraceRestrictOrderCondAuxField type, uint1 SetTraceRestrictValueDefault(item, TRVT_ORDER); // this updates the instruction in-place } } + if (IsTraceRestrictDoubleItem(item)) i++; } } diff --git a/src/tracerestrict.h b/src/tracerestrict.h index 1704dc4c79..3bacf61ae7 100644 --- a/src/tracerestrict.h +++ b/src/tracerestrict.h @@ -99,7 +99,7 @@ enum TraceRestrictItemType { TRIT_PF_PENALTY = 2, ///< Add to pathfinder penalty TRIT_RESERVE_THROUGH = 3, ///< Reserve through PBS signal - TRIT_COND_BEGIN = 8, ///< Start of conditional item types, note that this has the save value as TRIT_COND_ENDIF + TRIT_COND_BEGIN = 8, ///< Start of conditional item types, note that this has the same value as TRIT_COND_ENDIF TRIT_COND_ENDIF = 8, ///< This is an endif block or an else block TRIT_COND_UNDEFINED = 9, ///< This condition has no type defined (evaluate as false) TRIT_COND_TRAIN_LENGTH = 10, ///< Test train length diff --git a/src/tracerestrict_gui.cpp b/src/tracerestrict_gui.cpp index 5125c053c3..22c7f5471f 100644 --- a/src/tracerestrict_gui.cpp +++ b/src/tracerestrict_gui.cpp @@ -123,7 +123,7 @@ static const StringID _program_insert_str[] = { INVALID_STRING_ID }; static const uint32 _program_insert_else_hide_mask = 8; ///< disable bitmask for else -static const uint32 _program_insert_or_if_hide_mask = 4; ///< disable bitmask for elif +static const uint32 _program_insert_or_if_hide_mask = 4; ///< disable bitmask for orif static const uint32 _program_insert_else_if_hide_mask = 2; ///< disable bitmask for elif static const uint _program_insert_val[] = { TRIT_COND_UNDEFINED, // if block @@ -1418,7 +1418,7 @@ private: this->RaiseWidget(TR_WIDGET_VALUE_DEST); this->RaiseWidget(TR_WIDGET_VALUE_SIGNAL); - NWidgetStacked *left_2_sel = this->GetWidget(TR_WIDGET_SEL_TOP_LEFT_2); + NWidgetStacked *left_2_sel = this->GetWidget(TR_WIDGET_SEL_TOP_LEFT_2); NWidgetStacked *left_sel = this->GetWidget(TR_WIDGET_SEL_TOP_LEFT); NWidgetStacked *middle_sel = this->GetWidget(TR_WIDGET_SEL_TOP_MIDDLE); NWidgetStacked *right_sel = this->GetWidget(TR_WIDGET_SEL_TOP_RIGHT); From ebf250d8137a25e1fd4098c18d7039ec34e3d3b1 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 15 Dec 2015 18:37:34 +0000 Subject: [PATCH 2/2] Reserve instruction 24 for train owner test. --- src/tracerestrict.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tracerestrict.h b/src/tracerestrict.h index 3bacf61ae7..50324acfe6 100644 --- a/src/tracerestrict.h +++ b/src/tracerestrict.h @@ -110,6 +110,7 @@ enum TraceRestrictItemType { TRIT_COND_CARGO = 15, ///< Test if train can carry cargo type TRIT_COND_ENTRY_DIRECTION = 16, ///< Test which side of signal/signal tile is being entered from TRIT_COND_PBS_ENTRY_SIGNAL = 17, ///< Test tile and PBS-state of previous signal + //TRIT_COND_TRAIN_OWNER = 24, ///< Test train owner: reserved for future use /* space up to 31 */ };