diff options
author | belugas <belugas@openttd.org> | 2009-02-07 02:38:32 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2009-02-07 02:38:32 +0000 |
commit | 0abf14384c36dc980ec9441734246603de929633 (patch) | |
tree | e3e263ba0a5e5b3098c9c9ff540164664965fa8d /src | |
parent | bab7367a592ba3b625e350d66610fc210dbac275 (diff) | |
download | openttd-0abf14384c36dc980ec9441734246603de929633.tar.xz |
(svn r15392) -Codechange: move the spec getter to a place where it's only required, without the use of extern
Diffstat (limited to 'src')
-rw-r--r-- | src/unmovable.h | 6 | ||||
-rw-r--r-- | src/unmovable_cmd.cpp | 14 | ||||
-rw-r--r-- | src/unmovable_map.h | 1 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/unmovable.h b/src/unmovable.h index f640a2ece..777b6af90 100644 --- a/src/unmovable.h +++ b/src/unmovable.h @@ -21,11 +21,5 @@ struct UnmovableSpec { }; -extern const UnmovableSpec _original_unmovable[]; - -static inline const UnmovableSpec *GetUnmovableSpec(UnmovableType type) -{ - return &_original_unmovable[type]; -} #endif /* UNMOVABLE_H */ diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 508cdc1d5..c93f0180e 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -28,6 +28,20 @@ #include "table/sprites.h" #include "table/unmovable_land.h" +/** + * Accessor for array _original_unmovable. + * This will ensure at once : proper access and + * not allowing modifications of it. + * @param type of unmovable (which is the index in _original_unmovable) + * @pre type < UNMOVABLE_MAX + * @return a pointer to the corresponding unmovable spec + **/ +static inline const UnmovableSpec *GetUnmovableSpec(UnmovableType type) +{ + assert(type < UNMOVABLE_MAX); + return &_original_unmovable[type]; +} + /** Destroy a HQ. * During normal gameplay you can only implicitely destroy a HQ when you are * rebuilding it. Otherwise, only water can destroy it. diff --git a/src/unmovable_map.h b/src/unmovable_map.h index 0dd11e7dc..027ca7b6b 100644 --- a/src/unmovable_map.h +++ b/src/unmovable_map.h @@ -15,6 +15,7 @@ enum UnmovableType { UNMOVABLE_STATUE = 2, ///< Statue in towns UNMOVABLE_OWNED_LAND = 3, ///< Owned land 'flag' UNMOVABLE_HQ = 4, ///< HeadQuarter of a player + UNMOVABLE_MAX, }; /** |