summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/landscape.html26
-rw-r--r--docs/landscape_grid.html2
-rw-r--r--src/lang/english.txt11
-rw-r--r--src/misc/dbg_helpers.cpp2
-rw-r--r--src/misc_gui.cpp10
-rw-r--r--src/openttd.cpp40
-rw-r--r--src/rail_cmd.cpp36
-rw-r--r--src/rail_map.h30
-rw-r--r--src/signal_type.h12
9 files changed, 138 insertions, 31 deletions
diff --git a/docs/landscape.html b/docs/landscape.html
index 15333cc8f..07ac847f0 100644
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -376,30 +376,40 @@
</tr>
</table>
<ul>
- <li>m2 bit 6: Signal 0 and 1: set = semaphore signals, clear = light signals</li>
- <li>m2 bit 2: Signal 2 and 3: set = semaphore signals, clear = light signals</li>
- <li>m2 bits 5..4: type of signal 0 and 1 (same values as m2 bits 1..0)</li>
- <li>m2 bits 1..0: type of signal 2 and 3
+ <li>m2 bit 7: Signal 0 and 1: set = semaphore signals, clear = light signals</li>
+ <li>m2 bit 3: Signal 2 and 3: set = semaphore signals, clear = light signals</li>
+ <li>m2 bits 6..4: type of signal 0 and 1 (same values as m2 bits 2..0)</li>
+ <li>m2 bits 2..0: type of signal 2 and 3
<table>
<tr>
- <td nowrap="nowrap" valign="top"><tt>00</tt>: </td>
+ <td nowrap="nowrap" valign="top"><tt>000</tt>: </td>
<td align="left">normal signals</td>
</tr>
<tr>
- <td nowrap="nowrap" valign="top"><tt>01</tt>: </td>
+ <td nowrap="nowrap" valign="top"><tt>001</tt>: </td>
<td align="left">pre-signals</td>
</tr>
<tr>
- <td nowrap="nowrap" valign="top"><tt>10</tt>: </td>
+ <td nowrap="nowrap" valign="top"><tt>010</tt>: </td>
<td align="left">exit-signals</td>
</tr>
<tr>
- <td nowrap="nowrap" valign="top"><tt>11</tt>: </td>
+ <td nowrap="nowrap" valign="top"><tt>011</tt>: </td>
<td align="left">combo-signals</td>
</tr>
+
+ <tr>
+ <td nowrap="nowrap" valign="top"><tt>100</tt>: </td>
+ <td align="left">pbs signals</td>
+ </tr>
+
+ <tr>
+ <td nowrap="nowrap" valign="top"><tt>101</tt>: </td>
+ <td align="left">no-entry signals</td>
+ </tr>
</table>
</li>
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index e01d32460..ed5734988 100644
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -101,7 +101,7 @@ the array so you can quickly see what is used and what is not.
<td class="caption">rail with signals</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
- <td class="bits"><span class="free">OOOO</span> XXXX <span class="free">O</span>XXX <span class="free">O</span>XXX</td>
+ <td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
<td class="bits">XXXX <span class="option">~~</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">-inherit-</td>
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 498635377..4752dd188 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1679,12 +1679,23 @@ STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS :Railway track w
STR_RAILROAD_TRACK_WITH_PRESIGNALS :Railway track with pre-signals
STR_RAILROAD_TRACK_WITH_EXITSIGNALS :Railway track with exit-signals
STR_RAILROAD_TRACK_WITH_COMBOSIGNALS :Railway track with combo-signals
+STR_RAILROAD_TRACK_WITH_PBSSIGNALS :Railway track with advanced signals
+STR_RAILROAD_TRACK_WITH_NOENTRYSIGNALS :Railway track with one-way advanced signals
STR_RAILROAD_TRACK_WITH_NORMAL_PRESIGNALS :Railway track with normal and pre-signals
STR_RAILROAD_TRACK_WITH_NORMAL_EXITSIGNALS :Railway track with normal and exit-signals
STR_RAILROAD_TRACK_WITH_NORMAL_COMBOSIGNALS :Railway track with normal and combo-signals
+STR_RAILROAD_TRACK_WITH_NORMAL_PBSSIGNALS :Railway track with normal and advanced signals
+STR_RAILROAD_TRACK_WITH_NORMAL_NOENTRYSIGNALS :Railway track with normal and one-way advanced signals
STR_RAILROAD_TRACK_WITH_PRE_EXITSIGNALS :Railway track with pre- and exit-signals
STR_RAILROAD_TRACK_WITH_PRE_COMBOSIGNALS :Railway track with pre- and combo-signals
+STR_RAILROAD_TRACK_WITH_PRE_PBSSIGNALS :Railway track with pre- and advanced signals
+STR_RAILROAD_TRACK_WITH_PRE_NOENTRYSIGNALS :Railway track with pre- and one-way advanced signals
STR_RAILROAD_TRACK_WITH_EXIT_COMBOSIGNALS :Railway track with exit- and combo-signals
+STR_RAILROAD_TRACK_WITH_EXIT_PBSSIGNALS :Railway track with exit- and advanced signals
+STR_RAILROAD_TRACK_WITH_EXIT_NOENTRYSIGNALS :Railway track with exit- and one-way advanced signals
+STR_RAILROAD_TRACK_WITH_COMBO_PBSSIGNALS :Railway track with combo- and advanced signals
+STR_RAILROAD_TRACK_WITH_COMBO_NOENTRYSIGNALS :Railway track with combo- and one-way advanced signals
+STR_RAILROAD_TRACK_WITH_PBS_NOENTRYSIGNALS :Railway track with advanced and one-way advanced signals
STR_MUST_REMOVE_RAILWAY_STATION_FIRST :{WHITE}Must remove railway station first
diff --git a/src/misc/dbg_helpers.cpp b/src/misc/dbg_helpers.cpp
index 6db02e8ef..1c34e25b3 100644
--- a/src/misc/dbg_helpers.cpp
+++ b/src/misc/dbg_helpers.cpp
@@ -49,7 +49,7 @@ CStrA ValueStr(DiagDirection dd)
/** SignalType short names. */
static const char* signal_type_names[] = {
- "NORMAL", "ENTRY", "EXIT", "COMBO",
+ "NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY",
};
/** Return name of given SignalType. */
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index ded54b9d0..5f055f1aa 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -59,13 +59,13 @@ static bool _savegame_sort_dirty;
static const Widget _land_info_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 279, 0, 13, STR_01A3_LAND_AREA_INFORMATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_PANEL, RESIZE_BOTTOM, COLOUR_GREY, 0, 279, 14, 99, 0x0, STR_NULL},
+{ WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 299, 0, 13, STR_01A3_LAND_AREA_INFORMATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_PANEL, RESIZE_BOTTOM, COLOUR_GREY, 0, 299, 14, 99, 0x0, STR_NULL},
{ WIDGETS_END},
};
static const WindowDesc _land_info_desc = {
- WDP_AUTO, WDP_AUTO, 280, 100, 280, 100,
+ WDP_AUTO, WDP_AUTO, 300, 100, 300, 100,
WC_LAND_INFO, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
_land_info_widgets,
@@ -91,7 +91,7 @@ public:
for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
if (StrEmpty(this->landinfo_data[i])) break;
- DoDrawStringCentered(140, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING);
+ DoDrawStringCentered(150, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING);
y += i == 0 ? 16 : 12;
}
@@ -99,7 +99,7 @@ public:
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
- DrawStringMultiCenter(140, y, STR_JUST_RAW_STRING, this->width - 4);
+ DrawStringMultiCenter(150, y, STR_JUST_RAW_STRING, this->width - 4);
}
}
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 29f6bbb79..e09a8501b 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -2464,6 +2464,46 @@ bool AfterLoadGame()
}
}
+ /* Move the signal variant back up one bit for PBS. We don't convert the old PBS
+ * format here, as an old layout wouldn't work properly anyway. To be safe, we
+ * clear any possible PBS reservations as well. */
+ if (CheckSavegameVersion(100)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ switch (GetTileType(t)) {
+ case MP_RAILWAY:
+ if (HasSignals(t)) {
+ /* move the signal variant */
+ SetSignalVariant(t, TRACK_UPPER, HasBit(_m[t].m2, 2) ? SIG_SEMAPHORE : SIG_ELECTRIC);
+ SetSignalVariant(t, TRACK_LOWER, HasBit(_m[t].m2, 6) ? SIG_SEMAPHORE : SIG_ELECTRIC);
+ ClrBit(_m[t].m2, 2);
+ ClrBit(_m[t].m2, 6);
+ }
+
+ /* Clear PBS reservation on track */
+ if (IsRailDepot(t) ||IsRailWaypoint(t)) {
+ SetDepotWaypointReservation(t, false);
+ } else {
+ SetTrackReservation(t, TRACK_BIT_NONE);
+ }
+ break;
+
+ case MP_ROAD: /* Clear PBS reservation on crossing */
+ if (IsLevelCrossing(t)) SetCrossingReservation(t, false);
+ break;
+
+ case MP_STATION: /* Clear PBS reservation on station */
+ if (IsRailwayStation(t)) SetRailwayStationReservation(t, false);
+ break;
+
+ case MP_TUNNELBRIDGE: /* Clear PBS reservation on tunnels/birdges */
+ if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) SetTunnelBridgeReservation(t, false);
+ break;
+
+ default: break;
+ }
+ }
+ }
+
GamelogPrintDebug(1);
return InitializeWindowsAndCaches();
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index a85626837..51ddec70f 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1453,7 +1453,7 @@ static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint i
sprite = SPR_ORIGINAL_SIGNALS_BASE + image + condition;
} else {
/* All other signals are picked from add on sprites. */
- sprite = SPR_SIGNALS_BASE + (type - 1) * 16 + variant * 64 + image + condition;
+ sprite = SPR_SIGNALS_BASE + (type - 1) * 16 + variant * 64 + image + condition + (type > SIGTYPE_LAST_NOPBS ? 64 : 0);
}
AddSortableSpriteToDraw(sprite, PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, GetSaveSlopeZ(x, y, track));
@@ -2231,30 +2231,54 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
break;
case RAIL_TILE_SIGNALS: {
- const StringID signal_type[4][4] = {
+ const StringID signal_type[6][6] = {
{
STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS,
STR_RAILROAD_TRACK_WITH_NORMAL_PRESIGNALS,
STR_RAILROAD_TRACK_WITH_NORMAL_EXITSIGNALS,
- STR_RAILROAD_TRACK_WITH_NORMAL_COMBOSIGNALS
+ STR_RAILROAD_TRACK_WITH_NORMAL_COMBOSIGNALS,
+ STR_RAILROAD_TRACK_WITH_NORMAL_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_NORMAL_NOENTRYSIGNALS
},
{
STR_RAILROAD_TRACK_WITH_NORMAL_PRESIGNALS,
STR_RAILROAD_TRACK_WITH_PRESIGNALS,
STR_RAILROAD_TRACK_WITH_PRE_EXITSIGNALS,
- STR_RAILROAD_TRACK_WITH_PRE_COMBOSIGNALS
+ STR_RAILROAD_TRACK_WITH_PRE_COMBOSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PRE_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PRE_NOENTRYSIGNALS
},
{
STR_RAILROAD_TRACK_WITH_NORMAL_EXITSIGNALS,
STR_RAILROAD_TRACK_WITH_PRE_EXITSIGNALS,
STR_RAILROAD_TRACK_WITH_EXITSIGNALS,
- STR_RAILROAD_TRACK_WITH_EXIT_COMBOSIGNALS
+ STR_RAILROAD_TRACK_WITH_EXIT_COMBOSIGNALS,
+ STR_RAILROAD_TRACK_WITH_EXIT_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_EXIT_NOENTRYSIGNALS
},
{
STR_RAILROAD_TRACK_WITH_NORMAL_COMBOSIGNALS,
STR_RAILROAD_TRACK_WITH_PRE_COMBOSIGNALS,
STR_RAILROAD_TRACK_WITH_EXIT_COMBOSIGNALS,
- STR_RAILROAD_TRACK_WITH_COMBOSIGNALS
+ STR_RAILROAD_TRACK_WITH_COMBOSIGNALS,
+ STR_RAILROAD_TRACK_WITH_COMBO_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_COMBO_NOENTRYSIGNALS
+ },
+ {
+ STR_RAILROAD_TRACK_WITH_NORMAL_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PRE_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_EXIT_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_COMBO_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PBSSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PBS_NOENTRYSIGNALS
+ },
+ {
+ STR_RAILROAD_TRACK_WITH_NORMAL_NOENTRYSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PRE_NOENTRYSIGNALS,
+ STR_RAILROAD_TRACK_WITH_EXIT_NOENTRYSIGNALS,
+ STR_RAILROAD_TRACK_WITH_COMBO_NOENTRYSIGNALS,
+ STR_RAILROAD_TRACK_WITH_PBS_NOENTRYSIGNALS,
+ STR_RAILROAD_TRACK_WITH_NOENTRYSIGNALS
}
};
diff --git a/src/rail_map.h b/src/rail_map.h
index 649e3baed..2d25feb5a 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -338,19 +338,24 @@ static inline TrackBits GetRailDepotReservation(TileIndex t)
}
+static inline bool IsPbsSignal(SignalType s)
+{
+ return s == SIGTYPE_PBS || s == SIGTYPE_PBS_ONEWAY;
+}
+
static inline SignalType GetSignalType(TileIndex t, Track track)
{
assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
- return (SignalType)GB(_m[t].m2, pos, 2);
+ return (SignalType)GB(_m[t].m2, pos, 3);
}
static inline void SetSignalType(TileIndex t, Track track, SignalType s)
{
assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
- SB(_m[t].m2, pos, 2, s);
- if (track == INVALID_TRACK) SB(_m[t].m2, 4, 2, s);
+ SB(_m[t].m2, pos, 3, s);
+ if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
}
static inline bool IsPresignalEntry(TileIndex t, Track track)
@@ -375,15 +380,15 @@ static inline void CycleSignalSide(TileIndex t, Track track)
static inline SignalVariant GetSignalVariant(TileIndex t, Track track)
{
- byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 6 : 2;
+ byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
return (SignalVariant)GB(_m[t].m2, pos, 1);
}
static inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v)
{
- byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 6 : 2;
+ byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
SB(_m[t].m2, pos, 1, v);
- if (track == INVALID_TRACK) SB(_m[t].m2, 6, 1, v);
+ if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v);
}
/** These are states in which a signal can be. Currently these are only two, so
@@ -510,6 +515,19 @@ static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, S
}
}
+/**
+ * Is a pbs signal present along the trackdir?
+ * @param tile the tile to check
+ * @param td the trackdir to check
+ */
+static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
+{
+ return
+ IsTileType(tile, MP_RAILWAY) &&
+ HasSignalOnTrackdir(tile, td) &&
+ IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
+}
+
/**
* Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
diff --git a/src/signal_type.h b/src/signal_type.h
index 5dccff621..0bcd107ef 100644
--- a/src/signal_type.h
+++ b/src/signal_type.h
@@ -14,10 +14,14 @@ enum SignalVariant {
/** Type of signal, i.e. how does the signal behave? */
enum SignalType {
- SIGTYPE_NORMAL = 0, ///< normal signal
- SIGTYPE_ENTRY = 1, ///< presignal block entry
- SIGTYPE_EXIT = 2, ///< presignal block exit
- SIGTYPE_COMBO = 3 ///< presignal inter-block
+ SIGTYPE_NORMAL = 0, ///< normal signal
+ SIGTYPE_ENTRY = 1, ///< presignal block entry
+ SIGTYPE_EXIT = 2, ///< presignal block exit
+ SIGTYPE_COMBO = 3, ///< presignal inter-block
+ SIGTYPE_PBS = 4, ///< normal pbs signal
+ SIGTYPE_PBS_ONEWAY = 5, ///< no-entry signal
+ SIGTYPE_LAST = SIGTYPE_PBS_ONEWAY,
+ SIGTYPE_LAST_NOPBS = SIGTYPE_COMBO
};