summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-01-15 22:18:35 +0000
committermaedhros <maedhros@openttd.org>2007-01-15 22:18:35 +0000
commit895cc4fa47a706f85176f19985d0a4f32313d937 (patch)
tree0a7c7a59463925d388434ef7010b35b7d6b0f50f /src/rail_gui.cpp
parentb4f128b5f0e40da869feb2bce77cb9bcd3b3370f (diff)
downloadopenttd-895cc4fa47a706f85176f19985d0a4f32313d937.tar.xz
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 2d08dfeab..25318676d 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -7,6 +7,7 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "functions.h"
+#include "date.h"
#include "map.h"
#include "tile.h"
#include "window.h"
@@ -181,7 +182,13 @@ static void GenericPlaceSignals(TileIndex tile)
}
if (!_remove_button_clicked) {
- DoCommandP(tile, i + (_ctrl_pressed ? 8 : 0), 0, CcPlaySound1E,
+ uint32 p1 = _ctrl_pressed ? 8 : 0;
+ if (!HasSignals(tile) && _cur_year < _patches.semaphore_build_before) {
+ /* Reverse the logic, so semaphores are normally built, and light
+ * signals can be built with ctrl held down. */
+ p1 = _ctrl_pressed ? 0 : 8;
+ }
+ DoCommandP(tile, i + p1, 0, CcPlaySound1E,
CMD_BUILD_SIGNALS | CMD_AUTO | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE));
} else {
DoCommandP(tile, i, 0, CcPlaySound1E,
@@ -360,18 +367,25 @@ static void HandleAutoSignalPlacement(void)
{
TileHighlightData *thd = &_thd;
byte trackstat = thd->drawstyle & 0xF; // 0..5
+ byte semaphore = _ctrl_pressed ? 1 : 0;
if (thd->drawstyle == HT_RECT) { // one tile case
GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y));
return;
}
+ if (!HasSignals(TileVirtXY(thd->selstart.x, thd->selstart.y)) && _cur_year < _patches.semaphore_build_before) {
+ /* Reverse the logic, so semaphores are normally built, and light
+ * signals can be built with ctrl held down. */
+ semaphore = _ctrl_pressed ? 0 : 1;
+ }
+
// _patches.drag_signals_density is given as a parameter such that each user in a network
// game can specify his/her own signal density
DoCommandP(
TileVirtXY(thd->selstart.x, thd->selstart.y),
TileVirtXY(thd->selend.x, thd->selend.y),
- (_ctrl_pressed ? 1 << 3 : 0) | (trackstat << 4) | (_patches.drag_signals_density << 24),
+ (semaphore << 3) | (trackstat << 4) | (_patches.drag_signals_density << 24),
CcPlaySound1E,
_remove_button_clicked ?
CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :