From 2b96754673a964ba73a7ad5e508a8dfb31a0c701 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Mon, 9 May 2005 13:26:15 +0000 Subject: (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. --- rail_cmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rail_cmd.c') 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; -- cgit v1.2.3-54-g00ecf