summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-22 09:53:15 +0000
committerrubidium <rubidium@openttd.org>2011-01-22 09:53:15 +0000
commiteb299736c1bcb277da1862afe95c11cb897effcf (patch)
tree3bb6bff78f066da770a367e078c569dbe8ce319a /src/newgrf_object.cpp
parent0cdb1c78cdbfce4d426441c21ef7066f1cfecf6f (diff)
downloadopenttd-eb299736c1bcb277da1862afe95c11cb897effcf.tar.xz
(svn r21886) -Codechange: move documentation towards the code to make it more likely to be updated [n].
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 5b5e6e438..a9ee7a983 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -35,17 +35,31 @@ extern const ObjectSpec _original_objects[NEW_OBJECT_OFFSET];
/** All the object specifications. */
ObjectSpec _object_specs[NUM_OBJECTS];
+/**
+ * Get the specification associated with a specific ObjectType.
+ * @param index The object type to fetch.
+ * @return The specification.
+ */
/* static */ const ObjectSpec *ObjectSpec::Get(ObjectType index)
{
assert(index < NUM_OBJECTS);
return &_object_specs[index];
}
+/**
+ * Get the specification associated with a tile.
+ * @param tile The tile to fetch the data for.
+ * @return The specification.
+ */
/* static */ const ObjectSpec *ObjectSpec::GetByTile(TileIndex tile)
{
return ObjectSpec::Get(GetObjectType(tile));
}
+/**
+ * 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 &&
@@ -54,6 +68,10 @@ bool ObjectSpec::IsAvailable() const
(flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
}
+/**
+ * Gets the index of this spec.
+ * @return The index.
+ */
uint ObjectSpec::Index() const
{
return this - _object_specs;