From 7ef97932d93050d2e0fb78e77179945d5904e392 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 20 Mar 2010 10:59:06 +0000 Subject: (svn r19479) -Codechange: Test range of town size and layout instead of against the current last value. --- src/town_cmd.cpp | 4 ++-- src/town_type.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index c3d3ceded..b7e054b71 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1525,8 +1525,8 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 bool random = HasBit(p1, 6); uint32 townnameparts = p2; - if (size > TSZ_RANDOM) return CMD_ERROR; - if (layout > TL_RANDOM) return CMD_ERROR; + if (size >= TSZ_END) return CMD_ERROR; + if (layout >= NUM_TLS) return CMD_ERROR; /* Some things are allowed only in the scenario editor */ if (_game_mode != GM_EDITOR) { diff --git a/src/town_type.h b/src/town_type.h index 2224499e3..320653011 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -23,6 +23,8 @@ enum TownSize { TSZ_MEDIUM, ///< Medium town. TSZ_LARGE, ///< Large town. TSZ_RANDOM, ///< Random size, bigger than small, smaller than large. + + TSZ_END, ///< Number of available town sizes. }; enum { -- cgit v1.2.3-70-g09d2