From 55129f1fbb6451b27ac45224dcad2cb2ed911f92 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 2 Aug 2010 21:35:59 +0000 Subject: [PATCH] (svn r20326) -Codechange: move UnmovableType to its own file --- projects/openttd_vs100.vcxproj | 1 + projects/openttd_vs100.vcxproj.filters | 3 +++ projects/openttd_vs80.vcproj | 4 ++++ projects/openttd_vs90.vcproj | 4 ++++ source.list | 1 + src/unmovable.h | 3 ++- src/unmovable_cmd.cpp | 2 +- src/unmovable_map.h | 11 +---------- src/unmovable_type.h | 27 ++++++++++++++++++++++++++ 9 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 src/unmovable_type.h diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj index 93efda8949..84ac70efaf 100644 --- a/projects/openttd_vs100.vcxproj +++ b/projects/openttd_vs100.vcxproj @@ -578,6 +578,7 @@ + diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters index 4aa8f28190..c9e5e52953 100644 --- a/projects/openttd_vs100.vcxproj.filters +++ b/projects/openttd_vs100.vcxproj.filters @@ -937,6 +937,9 @@ Header Files + + Header Files + Header Files diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index b6697d7508..86dc93a5e5 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -1579,6 +1579,10 @@ RelativePath=".\..\src\unmovable.h" > + + diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj index a0c31ce147..6fd56503b4 100644 --- a/projects/openttd_vs90.vcproj +++ b/projects/openttd_vs90.vcproj @@ -1576,6 +1576,10 @@ RelativePath=".\..\src\unmovable.h" > + + diff --git a/source.list b/source.list index 30b6a8aae2..00878b29bd 100644 --- a/source.list +++ b/source.list @@ -304,6 +304,7 @@ transparency_gui.h transport_type.h tunnelbridge.h unmovable.h +unmovable_type.h vehicle_base.h vehicle_func.h vehicle_gui.h diff --git a/src/unmovable.h b/src/unmovable.h index 2838d18790..330373cb8f 100644 --- a/src/unmovable.h +++ b/src/unmovable.h @@ -14,6 +14,7 @@ #include "economy_func.h" #include "strings_type.h" +#include "unmovable_type.h" void UpdateCompanyHQ(Company *c, uint score); @@ -40,7 +41,7 @@ struct UnmovableSpec { * @param index The unmovable type to fetch. * @return The specification. */ - static const UnmovableSpec *Get(int index); + static const UnmovableSpec *Get(UnmovableType index); /** * Get the specification associated with a tile. diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index ce9bfb161b..c3983424ee 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -35,7 +35,7 @@ #include "table/sprites.h" #include "table/unmovable_land.h" -/* static */ const UnmovableSpec *UnmovableSpec::Get(int index) +/* static */ const UnmovableSpec *UnmovableSpec::Get(UnmovableType index) { assert(index < UNMOVABLE_MAX); return &_original_unmovable[index]; diff --git a/src/unmovable_map.h b/src/unmovable_map.h index 1b01c56376..7725ac5cb8 100644 --- a/src/unmovable_map.h +++ b/src/unmovable_map.h @@ -13,16 +13,7 @@ #define UNMOVABLE_MAP_H #include "tile_map.h" - -/** Types of unmovable structure */ -enum UnmovableType { - UNMOVABLE_TRANSMITTER = 0, ///< The large antenna - UNMOVABLE_LIGHTHOUSE = 1, ///< The nice lighthouse - UNMOVABLE_STATUE = 2, ///< Statue in towns - UNMOVABLE_OWNED_LAND = 3, ///< Owned land 'flag' - UNMOVABLE_HQ = 4, ///< HeadQuarter of a player - UNMOVABLE_MAX, -}; +#include "unmovable_type.h" /** * Gets the UnmovableType of the given unmovable tile diff --git a/src/unmovable_type.h b/src/unmovable_type.h new file mode 100644 index 0000000000..92f11c31b7 --- /dev/null +++ b/src/unmovable_type.h @@ -0,0 +1,27 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file unmovable_map.h Types related to unmovable tiles. */ + +#ifndef UNMOVABLE_TYPE_H +#define UNMOVABLE_TYPE_H + +/** Types of unmovable structure */ +enum UnmovableType { + UNMOVABLE_TRANSMITTER = 0, ///< The large antenna + UNMOVABLE_LIGHTHOUSE = 1, ///< The nice lighthouse + UNMOVABLE_STATUE = 2, ///< Statue in towns + UNMOVABLE_OWNED_LAND = 3, ///< Owned land 'flag' + UNMOVABLE_HQ = 4, ///< HeadQuarter of a player + UNMOVABLE_MAX, +}; + +struct UnmovableSpec; + +#endif /* UNMOVABLE_MAP_H */