(svn r13938) -Codechange [YAPP]: Add the new signals to the build signal GUI. (michi_cc)
authorrubidium
Sat, 02 Aug 2008 22:50:22 +0000
changeset 9796 4d1358696a92
parent 9795 55c38728362c
child 9797 3b2e6f55e7d0
(svn r13938) -Codechange [YAPP]: Add the new signals to the build signal GUI. (michi_cc)
src/lang/english.txt
src/rail_gui.cpp
src/table/sprites.h
--- a/src/lang/english.txt	Sat Aug 02 22:50:04 2008 +0000
+++ b/src/lang/english.txt	Sat Aug 02 22:50:22 2008 +0000
@@ -3602,10 +3602,14 @@
 STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TIP                            :{BLACK}Entry-Signal (semaphore){}Green as long as there is one or more green exit-signal from the following section of track. Otherwise it shows red.
 STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TIP                             :{BLACK}Exit-Signal (semaphore){}Behaves in the same way as a normal signal but is necessary to trigger the correct colour on entry & combo pre-signals.
 STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TIP                            :{BLACK}Combo-Signal (semaphore){}The combo signal simply acts as both an entry and exit signal. This allows you to build large "trees" of presignals.
+STR_BUILD_SIGNAL_SEMAPHORE_PBS_TIP                              :{BLACK}Advanced Signal (semaphore){}An advanced signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. Advanced signals can be passed from the backside.
+STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TIP                         :{BLACK}One-way Advanced Signal (semaphore){}An advanced signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. One-way signals cannot be passed from the backside.
 STR_BUILD_SIGNAL_ELECTRIC_NORM_TIP                              :{BLACK}Standard Signal (electric){}Signals are necessary to keep trains from crashing on railway networks with more than one train.
 STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TIP                             :{BLACK}Entry-Signal (electric){}Green as long as there is one or more green exit-signal from the following section of track. Otherwise it shows red.
 STR_BUILD_SIGNAL_ELECTRIC_EXIT_TIP                              :{BLACK}Exit-Signal (electric){}Behaves in the same way as a normal signal but is necessary to trigger the correct colour on entry & combo pre-signals.
 STR_BUILD_SIGNAL_ELECTRIC_COMBO_TIP                             :{BLACK}Combo-Signal (electric){}The combo signal simply acts as both an entry and exit signal. This allows you to build large "trees" of presignals.
+STR_BUILD_SIGNAL_ELECTRIC_PBS_TIP                               :{BLACK}Advanced Signal (electric){}An advanced signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. Advanced signals can be passed from the backside.
+STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TIP                          :{BLACK}One-way Advanced Signal (electric){}An advanced signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. One-way signals cannot be passed from the backside.
 STR_SIGNAL_CONVERT_TIP                                          :{BLACK}Signal Convert{}When selected, clicking an existing signal will convert it to the selected signal type and variant, CTRL-click will toggle the existing variant.
 STR_DRAG_SIGNALS_DENSITY_TIP                                    :{BLACK}Dragging signal density
 STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP                           :{BLACK}Decrease dragging signal density
--- a/src/rail_gui.cpp	Sat Aug 02 22:50:04 2008 +0000
+++ b/src/rail_gui.cpp	Sat Aug 02 22:50:22 2008 +0000
@@ -1354,10 +1354,14 @@
 	BSW_SEMAPHORE_ENTRY,
 	BSW_SEMAPHORE_EXIT,
 	BSW_SEMAPHORE_COMBO,
+	BSW_SEMAPHORE_PBS,
+	BSW_SEMAPHORE_PBS_OWAY,
 	BSW_ELECTRIC_NORM,
 	BSW_ELECTRIC_ENTRY,
 	BSW_ELECTRIC_EXIT,
 	BSW_ELECTRIC_COMBO,
+	BSW_ELECTRIC_PBS,
+	BSW_ELECTRIC_PBS_OWAY,
 	BSW_CONVERT,
 	BSW_DRAG_SIGNALS_DENSITY,
 	BSW_DRAG_SIGNALS_DENSITY_DECREASE,
@@ -1404,10 +1408,14 @@
 		this->DrawSignalSprite(BSW_SEMAPHORE_ENTRY, SPR_IMG_SIGNAL_SEMAPHORE_ENTRY, -1, 13); // xsize of sprite + 1 == 10
 		this->DrawSignalSprite(BSW_SEMAPHORE_EXIT,  SPR_IMG_SIGNAL_SEMAPHORE_EXIT,   0, 12); // xsize of sprite + 1 ==  9
 		this->DrawSignalSprite(BSW_SEMAPHORE_COMBO, SPR_IMG_SIGNAL_SEMAPHORE_COMBO,  0, 12); // xsize of sprite + 1 ==  9
+		this->DrawSignalSprite(BSW_SEMAPHORE_PBS,   SPR_IMG_SIGNAL_SEMAPHORE_PBS,    0, 12); // xsize of sprite + 1 ==  9
+		this->DrawSignalSprite(BSW_SEMAPHORE_PBS_OWAY, SPR_IMG_SIGNAL_SEMAPHORE_PBSOWAY, -1, 13); // xsize of sprite + 1 == 10
 		this->DrawSignalSprite(BSW_ELECTRIC_NORM,   SPR_IMG_SIGNAL_ELECTRIC_NORM,   -1,  4);
 		this->DrawSignalSprite(BSW_ELECTRIC_ENTRY,  SPR_IMG_SIGNAL_ELECTRIC_ENTRY,  -2,  6);
 		this->DrawSignalSprite(BSW_ELECTRIC_EXIT,   SPR_IMG_SIGNAL_ELECTRIC_EXIT,   -2,  6);
 		this->DrawSignalSprite(BSW_ELECTRIC_COMBO,  SPR_IMG_SIGNAL_ELECTRIC_COMBO,  -2,  6);
+		this->DrawSignalSprite(BSW_ELECTRIC_PBS,    SPR_IMG_SIGNAL_ELECTRIC_PBS,    -1,  4);
+		this->DrawSignalSprite(BSW_ELECTRIC_PBS_OWAY,SPR_IMG_SIGNAL_ELECTRIC_OBSOWAY,-2,  6);
 
 		/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */
 		SetDParam(0, _settings_client.gui.drag_signals_density);
@@ -1423,13 +1431,17 @@
 			case BSW_SEMAPHORE_ENTRY:
 			case BSW_SEMAPHORE_EXIT:
 			case BSW_SEMAPHORE_COMBO:
+			case BSW_SEMAPHORE_PBS:
+			case BSW_SEMAPHORE_PBS_OWAY:
 			case BSW_ELECTRIC_NORM:
 			case BSW_ELECTRIC_ENTRY:
 			case BSW_ELECTRIC_EXIT:
 			case BSW_ELECTRIC_COMBO:
+			case BSW_ELECTRIC_PBS:
+			case BSW_ELECTRIC_PBS_OWAY:
 				this->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type);
 
-				_cur_signal_type = (SignalType)((uint)((widget - BSW_SEMAPHORE_NORM) % (SIGTYPE_COMBO + 1)));
+				_cur_signal_type = (SignalType)((uint)((widget - BSW_SEMAPHORE_NORM) % (SIGTYPE_LAST + 1)));
 				_cur_signal_variant = widget >= BSW_ELECTRIC_NORM ? SIG_ELECTRIC : SIG_SEMAPHORE;
 				break;
 
@@ -1461,29 +1473,33 @@
 /** Widget definition of the build signal window */
 static const Widget _signal_builder_widgets[] = {
 {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_DARK_GREEN,   0,  10,   0,  13, STR_00C5,               STR_018B_CLOSE_WINDOW},                 // BSW_CLOSEBOX
-{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_DARK_GREEN,  11, 109,   0,  13, STR_SIGNAL_SELECTION,   STR_018C_WINDOW_TITLE_DRAG_THIS},       // BSW_CAPTION
+{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_DARK_GREEN,  11, 152,   0,  13, STR_SIGNAL_SELECTION,   STR_018C_WINDOW_TITLE_DRAG_THIS},       // BSW_CAPTION
 
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,   0,  21,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_NORM_TIP},   // BSW_SEMAPHORE_NORM
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  22,  43,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TIP},  // BSW_SEMAPHORE_ENTRY
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  44,  65,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TIP},   // BSW_SEMAPHORE_EXIT
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  66,  87,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TIP},  // BSW_SEMAPHORE_COMBO
+{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  88, 109,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_PBS_TIP},    // BSW_SEMAPHORE_PBS
+{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN, 109, 130,  14,  40, STR_NULL,               STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TIP},// BSW_SEMAPHORE_PBS_OWAY
 
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,   0,  21,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_NORM_TIP},    // BSW_ELECTRIC_NORM
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  22,  43,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TIP},   // BSW_ELECTRIC_ENTRY
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  44,  65,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_EXIT_TIP},    // BSW_ELECTRIC_EXIT
 {      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  66,  87,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_COMBO_TIP},   // BSW_ELECTRIC_COMBO
+{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  88, 109,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_PBS_TIP},     // BSW_ELECTRIC_PBS
+{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN, 109, 130,  41,  67, STR_NULL,               STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TIP},// BSW_ELECTRIC_PBS_OWAY
 
-{     WWT_IMGBTN,   RESIZE_NONE,  COLOUR_DARK_GREEN,  88, 109,  14,  40, SPR_IMG_SIGNAL_CONVERT, STR_SIGNAL_CONVERT_TIP},                // BSW_CONVERT
-{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN,  88, 109,  41,  67, STR_NULL,               STR_DRAG_SIGNALS_DENSITY_TIP},          // BSW_DRAG_SIGNALS_DENSITY
-{ WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,        90,  98,  54,  65, SPR_ARROW_LEFT,         STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_DECREASE
-{ WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,        99, 107,  54,  65, SPR_ARROW_RIGHT,        STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_INCREASE
+{     WWT_IMGBTN,   RESIZE_NONE,  COLOUR_DARK_GREEN, 131, 152,  14,  40, SPR_IMG_SIGNAL_CONVERT, STR_SIGNAL_CONVERT_TIP},                // BSW_CONVERT
+{      WWT_PANEL,   RESIZE_NONE,  COLOUR_DARK_GREEN, 131, 152,  41,  67, STR_NULL,               STR_DRAG_SIGNALS_DENSITY_TIP},          // BSW_DRAG_SIGNALS_DENSITY
+{ WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,       133, 141,  54,  65, SPR_ARROW_LEFT,         STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_DECREASE
+{ WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,       142, 150,  54,  65, SPR_ARROW_RIGHT,        STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_INCREASE
 
 {   WIDGETS_END},
 };
 
 /** Signal selection window description */
 static const WindowDesc _signal_builder_desc = {
-	WDP_AUTO, WDP_AUTO, 110, 68, 110, 68,
+	WDP_AUTO, WDP_AUTO, 153, 68, 153, 68,
 	WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 	_signal_builder_widgets,
@@ -1779,6 +1795,6 @@
 	SetDefaultRailGui();
 
 	_convert_signal_button = false;
-	_cur_signal_type = SIGTYPE_NORMAL;
+	_cur_signal_type = _default_signal_type[_settings_client.gui.default_signal_type];
 	ResetSignalVariant();
 }
--- a/src/table/sprites.h	Sat Aug 02 22:50:04 2008 +0000
+++ b/src/table/sprites.h	Sat Aug 02 22:50:22 2008 +0000
@@ -1297,15 +1297,19 @@
 	SPR_IMG_RAIL_STATION = 1298,
 	SPR_IMG_RAIL_SIGNALS = 1291,
 
-	SPR_IMG_SIGNAL_ELECTRIC_NORM   = 1287,
-	SPR_IMG_SIGNAL_ELECTRIC_ENTRY  = SPR_SIGNALS_BASE +  12,
-	SPR_IMG_SIGNAL_ELECTRIC_EXIT   = SPR_SIGNALS_BASE +  28,
-	SPR_IMG_SIGNAL_ELECTRIC_COMBO  = SPR_SIGNALS_BASE +  44,
-	SPR_IMG_SIGNAL_SEMAPHORE_NORM  = SPR_SIGNALS_BASE +  60,
-	SPR_IMG_SIGNAL_SEMAPHORE_ENTRY = SPR_SIGNALS_BASE +  76,
-	SPR_IMG_SIGNAL_SEMAPHORE_EXIT  = SPR_SIGNALS_BASE +  92,
-	SPR_IMG_SIGNAL_SEMAPHORE_COMBO = SPR_SIGNALS_BASE + 108,
-	SPR_IMG_SIGNAL_CONVERT         = SPR_OPENTTD_BASE + 135,
+	SPR_IMG_SIGNAL_ELECTRIC_NORM     = 1287,
+	SPR_IMG_SIGNAL_ELECTRIC_ENTRY    = SPR_SIGNALS_BASE +  12,
+	SPR_IMG_SIGNAL_ELECTRIC_EXIT     = SPR_SIGNALS_BASE +  28,
+	SPR_IMG_SIGNAL_ELECTRIC_COMBO    = SPR_SIGNALS_BASE +  44,
+	SPR_IMG_SIGNAL_ELECTRIC_PBS      = SPR_SIGNALS_BASE + 124,
+	SPR_IMG_SIGNAL_ELECTRIC_OBSOWAY  = SPR_SIGNALS_BASE + 140,
+	SPR_IMG_SIGNAL_SEMAPHORE_NORM    = SPR_SIGNALS_BASE +  60,
+	SPR_IMG_SIGNAL_SEMAPHORE_ENTRY   = SPR_SIGNALS_BASE +  76,
+	SPR_IMG_SIGNAL_SEMAPHORE_EXIT    = SPR_SIGNALS_BASE +  92,
+	SPR_IMG_SIGNAL_SEMAPHORE_COMBO   = SPR_SIGNALS_BASE + 108,
+	SPR_IMG_SIGNAL_SEMAPHORE_PBS     = SPR_SIGNALS_BASE + 188,
+	SPR_IMG_SIGNAL_SEMAPHORE_PBSOWAY = SPR_SIGNALS_BASE + 204,
+	SPR_IMG_SIGNAL_CONVERT           = SPR_OPENTTD_BASE + 135,
 
 	SPR_IMG_TUNNEL_RAIL   = 2430,
 	SPR_IMG_TUNNEL_MONO   = 2431,