summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/landscape.html2
-rw-r--r--docs/landscape_grid.html2
-rw-r--r--openttd.c9
-rw-r--r--rail_cmd.c32
-rw-r--r--saveload.c2
5 files changed, 38 insertions, 9 deletions
diff --git a/docs/landscape.html b/docs/landscape.html
index 2f4f6c775..de298b09d 100644
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -98,7 +98,7 @@ map5 bit 7 clear: railway track
<tr><td nowrap valign=top><tt>01</tt>: </td><td align=left>pre-signals</td></tr>
<tr><td nowrap valign=top><tt>10</tt>: </td><td align=left>exit-signals</td></tr>
<tr><td nowrap valign=top><tt>11</tt>: </td><td align=left>combo-signals</td></tr>
-<tr><td nowrap valign=top>bit 2: </td><td align=left>set = semaphore signals, clear = light signals</td></tr>
+<tr><td nowrap valign=top>bit 3: </td><td align=left>set = semaphore signals, clear = light signals</td></tr>
</table></li>
</ul></li>
<li>map_owner: <a href="#OwnershipInfo">owner</a> of the track
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index df11897c4..511a25b45 100644
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -52,7 +52,7 @@ the array so you can quickly see what is used and what is not.
<td style="white-space: nowrap; text-align: center;"><span class="abuse">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;">XXXX XXXX <span class="freebits">OOOO OOOO</span><br>
</td>
- <td style="white-space: nowrap; text-align: center;">XXXX XXXX XXX<span class="freebits">O OOOO</span><br>
+ <td style="white-space: nowrap; text-align: center;">XXXX XXXX XX<span class="freebits">O</span>X<span class="freebits"> OOOO</span><br>
</td>
<td style="white-space: nowrap; text-align: center;">XXXX&nbsp;&nbsp;&nbsp;&nbsp;XXXX</td>
<td style="white-space: nowrap; text-align: center;">XXXX XXXX<br>
diff --git a/openttd.c b/openttd.c
index 13a508326..75c7c3152 100644
--- a/openttd.c
+++ b/openttd.c
@@ -1410,5 +1410,14 @@ bool AfterLoadGame(uint version)
}
}
+ if (version < 0xF00) {
+ BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
+ if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && HASBIT(_map3_hi[tile], 2)) {
+ CLRBIT(_map3_hi[tile], 2);
+ SETBIT(_map3_hi[tile], 3);
+ }
+ } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
+ }
+
return true;
}
diff --git a/rail_cmd.c b/rail_cmd.c
index a4ea4c21b..b1ec7ea51 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -749,7 +749,7 @@ int32 CmdBuildSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
_map5[tile] |= RAIL_TYPE_SIGNALS; // change into signals
_map2[tile] |= 0xF0; // all signals are on
_map3_lo[tile] &= ~0xF0; // no signals built by default
- _map3_hi[tile] = semaphore ? 4 : 0;
+ _map3_hi[tile] = semaphore ? 0x08 : 0;
}
if (p2 == 0) {
@@ -792,9 +792,9 @@ int32 CmdBuildSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
_map3_lo[tile] |= p2 & SignalOnTrack(track);
// convert between signal<->semaphores when dragging
if (semaphore)
- SETBIT(_map3_hi[tile], 2);
+ SETBIT(_map3_hi[tile], 3);
else
- CLRBIT(_map3_hi[tile], 2);
+ CLRBIT(_map3_hi[tile], 3);
}
MarkTileDirtyByTile(tile);
@@ -931,7 +931,7 @@ int32 CmdRemoveSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if ((_map3_lo[tile] & 0xF0) == 0) {
_map5[tile] &= ~RAIL_TYPE_SIGNALS;
_map2[tile] &= ~0xF0;
- CLRBIT(_map3_hi[tile], 2); // remove any possible semaphores
+ CLRBIT(_map3_hi[tile], 3); // remove any possible semaphores
}
SetSignalsOnBothDir(tile, track);
@@ -1118,28 +1118,48 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
#include "table/track_land.h"
// used for presignals
-static const SpriteID _signal_base_sprites[16] = {
+static const SpriteID _signal_base_sprites[32] = {
0x4FB,
0x1323,
0x1333,
0x1343,
+ 0x0, //PBS place, light signal
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+
// use semaphores instead of signals?
0x1353,
0x1363,
0x1373,
0x1383,
+ 0x0, //PBS place, semaphore
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+
// mirrored versions
0x4FB,
0x1323,
0x1333,
0x1343,
+ 0x0, //PBS place, semaphore
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+
0x13C6,
0x13D6,
0x13E6,
0x13F6,
+
+ 0x0, //PBS place, semaphore
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
+ 0x0, //reserved for future use
};
// used to determine the side of the road for the signal
@@ -1157,7 +1177,7 @@ static void DrawSignalHelper(TileInfo *ti, byte condition, uint32 image_and_pos)
uint v = _signal_position[(image_and_pos & 0xF) + (otherside ? 12 : 0)];
uint x = ti->x | (v&0xF);
uint y = ti->y | (v>>4);
- uint sprite = _signal_base_sprites[(_map3_hi[ti->tile] & 7) + (otherside ? 8 : 0)] + (image_and_pos>>4) + ((condition != 0) ? 1 : 0);
+ uint sprite = _signal_base_sprites[(_map3_hi[ti->tile] & 0xF) + (otherside ? 0x10 : 0)] + (image_and_pos>>4) + ((condition != 0) ? 1 : 0);
AddSortableSpriteToDraw(sprite, x, y, 1, 1, 10, GetSlopeZ(x,y));
}
diff --git a/saveload.c b/saveload.c
index 0ec2bc23d..2fdfbe2d3 100644
--- a/saveload.c
+++ b/saveload.c
@@ -23,7 +23,7 @@
#include "saveload.h"
enum {
- SAVEGAME_MAJOR_VERSION = 14,
+ SAVEGAME_MAJOR_VERSION = 15,
SAVEGAME_MINOR_VERSION = 0,
SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION