diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-09 13:26:15 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-09 13:26:15 +0000 |
commit | 2b96754673a964ba73a7ad5e508a8dfb31a0c701 (patch) | |
tree | ccbac52281216762b9143a0756b6a957443b581d /rail_cmd.c | |
parent | 5f6de3e47c1418388efeabef2a312f689a288175 (diff) | |
download | openttd-2b96754673a964ba73a7ad5e508a8dfb31a0c701.tar.xz |
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
- Fix: [ 1197256 ] max station spread patch < 7 does not work. Station spread was not taking into account when not using drag&drop. Fix this up, and add a callback to the settings window to immediately reflect the changes.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r-- | rail_cmd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rail_cmd.c b/rail_cmd.c index 7bb367c57..59eac26d6 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -276,7 +276,7 @@ static uint32 CheckRailSlope(uint tileh, uint rail_bits, uint existing, TileInde } /* Validate functions for rail building */ -static inline bool ValParamTrackOrientation(uint32 rail) {return (rail > 5) ? false : true;} +static inline bool ValParamTrackOrientation(uint32 rail) {return rail <= 5;} /** Build a single piece of rail * @param x,y coordinates on where to build @@ -292,7 +292,7 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2) int32 cost = 0; int32 ret; - if (!(ValParamRailtype(p1) && ValParamTrackOrientation(p2))) return CMD_ERROR; + if (!ValParamRailtype(p1) || !ValParamTrackOrientation(p2)) return CMD_ERROR; tile = TILE_FROM_XY(x, y); tileh = GetTileSlope(tile, NULL); @@ -590,7 +590,8 @@ static int32 CmdRailTrackHelper(int x, int y, uint32 flags, uint32 p1, uint32 p2 byte railbit = (p2 >> 4) & 7; byte mode = HASBIT(p2, 7); - if (!(ValParamRailtype(p2 & 0x3) && ValParamTrackOrientation(railbit))) return CMD_ERROR; + if (!ValParamRailtype(p2 & 0x3) || !ValParamTrackOrientation(railbit)) return CMD_ERROR; + if (p1 > MapSize()) return CMD_ERROR; /* unpack end point */ ex = TileX(p1) * 16; |