Mercurial > hg > openttd
changeset 1993:c7bc3114d76f draft
(svn r2499) -Codechange: Moved the semaphore bit from bit 2 to bit 3 in _map_hi for rails, in order to make way for pbs
author | celestar <celestar@openttd.org> |
---|---|
date | Thu, 30 Jun 2005 13:24:17 +0000 |
parents | 6df743908a29 |
children | 93d88ab9dfba |
files | docs/landscape.html docs/landscape_grid.html openttd.c rail_cmd.c saveload.c |
diffstat | 5 files changed, 38 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/landscape.html +++ b/docs/landscape.html @@ -98,7 +98,7 @@ <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
--- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -52,7 +52,7 @@ <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 XXXX</td> <td style="white-space: nowrap; text-align: center;">XXXX XXXX<br>
--- a/openttd.c +++ b/openttd.c @@ -1410,5 +1410,14 @@ } } + 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; }
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -749,7 +749,7 @@ _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 @@ _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 @@ 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 @@ #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 @@ 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)); }