From 683a6ca039fb0c52093dd93261b6233dd6f482f3 Mon Sep 17 00:00:00 2001 From: smatz Date: Thu, 14 May 2009 23:40:03 +0000 Subject: (svn r16308) -Fix: parameter is invalid when it's equal to length of an array (Yexo) --- src/station_cmd.cpp | 2 +- src/town_cmd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 85e12fa25..1d4d2948f 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1820,7 +1820,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint if (distant_join && (!_settings_game.station.distant_join_stations || !IsValidStationID(station_to_join))) return CMD_ERROR; /* Check if a valid, buildable airport was chosen for construction */ - if (p1 > lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR; + if (p1 >= lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR; if (!CheckIfAuthorityAllowsNewStation(tile, flags)) { return CMD_ERROR; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index dc53528c8..3e8d1bdfa 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2553,7 +2553,7 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t) */ CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { - if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR; + if (!IsValidTownID(p1) || p2 >= lengthof(_town_action_proc)) return CMD_ERROR; Town *t = GetTown(p1); -- cgit v1.2.3-70-g09d2