summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-04-22 16:27:45 +0000
committerfrosch <frosch@openttd.org>2012-04-22 16:27:45 +0000
commit27ffb033838e1dc9fede9154181be572e826a1e6 (patch)
tree4cc3bcbb0a3250b5375bb55e6f3628c81afbb9b0 /src/newgrf_object.cpp
parent1b0d3e3034b4f7a43d4d32692861a1d07bb0f50c (diff)
downloadopenttd-27ffb033838e1dc9fede9154181be572e826a1e6.tar.xz
(svn r24160) -Codechange: Split parts of ObjectSpec::IsAvailable() into ObjectSpec::IsEverAvailable().
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 8874b6d65..f77519881 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -54,15 +54,23 @@ ObjectSpec _object_specs[NUM_OBJECTS];
}
/**
+ * Check whether the object might be available at some point in this game with the current game mode.
+ * @return true if it might be available.
+ */
+bool ObjectSpec::IsEverAvailable() const
+{
+ return this->enabled && HasBit(this->climate, _settings_game.game_creation.landscape) &&
+ (this->flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
+}
+
+/**
* Check whether the object is available at this time.
* @return true if it is available.
*/
bool ObjectSpec::IsAvailable() const
{
- return this->enabled && _date > this->introduction_date &&
- (_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365) &&
- HasBit(this->climate, _settings_game.game_creation.landscape) &&
- (flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
+ return this->IsEverAvailable() && _date > this->introduction_date &&
+ (_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365);
}
/**