summaryrefslogtreecommitdiff
path: root/src/newgrf_object.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-28 17:32:30 +0000
committerrubidium <rubidium@openttd.org>2010-08-28 17:32:30 +0000
commitf9a9b0ed4aa6c7496bf5be49a9886b27ff01a979 (patch)
tree6b4ef5c35cfbda82e3ea7284ec09f7f1818f88e9 /src/newgrf_object.h
parent1ec1f1ef374b70b0e057d806f1310b7aeadce50c (diff)
downloadopenttd-f9a9b0ed4aa6c7496bf5be49a9886b27ff01a979.tar.xz
(svn r20649) -Codechange: implement classes for objects
Diffstat (limited to 'src/newgrf_object.h')
-rw-r--r--src/newgrf_object.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newgrf_object.h b/src/newgrf_object.h
index 2fea6668b..5946ae397 100644
--- a/src/newgrf_object.h
+++ b/src/newgrf_object.h
@@ -15,6 +15,7 @@
#include "economy_func.h"
#include "strings_type.h"
#include "object_type.h"
+#include "newgrf_class.h"
#include "newgrf_commons.h"
/** Various object behaviours. */
@@ -38,10 +39,20 @@ DECLARE_ENUM_AS_BIT_SET(ObjectFlags)
void ResetObjects();
+/** Class IDs for objects. */
+enum ObjectClassID {
+ OBJECT_CLASS_BEGIN = 0, ///< The lowest valid value
+ OBJECT_CLASS_MAX = 32, ///< Maximum number of classes.
+ INVALID_OBJECT_CLASS = 0xFF, ///< Class for the less fortunate.
+};
+/** Allow incrementing of ObjectClassID variables */
+DECLARE_POSTFIX_INCREMENT(ObjectClassID)
+
/** An object that isn't use for transport, industries or houses. */
struct ObjectSpec {
/* 2 because of the "normal" and "buy" sprite stacks. */
GRFFilePropsBase<2> grf_prop; ///< Properties related the the grf file
+ ObjectClassID cls_id; ///< The class to which this spec belongs.
StringID name; ///< The name for this object.
uint8 size; ///< The size of this objects; low nibble for X, high nibble for Y.
@@ -77,4 +88,7 @@ struct ObjectSpec {
static const ObjectSpec *GetByTile(TileIndex tile);
};
+/** Struct containing information relating to station classes. */
+typedef NewGRFClass<ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX> ObjectClass;
+
#endif /* NEWGRF_OBJECT_H */