summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
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.cpp
parent1ec1f1ef374b70b0e057d806f1310b7aeadce50c (diff)
downloadopenttd-f9a9b0ed4aa6c7496bf5be49a9886b27ff01a979.tar.xz
(svn r20649) -Codechange: implement classes for objects
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index edb991fa8..30dd23df5 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -11,8 +11,11 @@
#include "stdafx.h"
#include "core/mem_func.hpp"
+#include "newgrf.h"
+#include "newgrf_class_func.h"
#include "newgrf_object.h"
#include "object_map.h"
+#include "openttd.h"
/** The override manager for our objects. */
ObjectOverrideManager _object_mngr(NEW_OBJECT_OFFSET, NUM_OBJECTS, INVALID_OBJECT_TYPE);
@@ -42,3 +45,21 @@ void ResetObjects()
MemCpyT(_object_specs, _original_objects, lengthof(_original_objects));
}
+template <typename Tspec, typename Tid, Tid Tmax>
+/* static */ void NewGRFClass<Tspec, Tid, Tmax>::InsertDefaults()
+{
+ /* We only add the transmitters in the scenario editor. */
+ if (_game_mode != GM_EDITOR) return;
+
+ ObjectClassID cls = ObjectClass::Allocate('LTHS');
+ ObjectClass::SetName(cls, STR_OBJECT_CLASS_LTHS);
+ _object_specs[OBJECT_LIGHTHOUSE].cls_id = cls;
+ ObjectClass::Assign(&_object_specs[OBJECT_LIGHTHOUSE]);
+
+ cls = ObjectClass::Allocate('TRNS');
+ ObjectClass::SetName(cls, STR_OBJECT_CLASS_TRNS);
+ _object_specs[OBJECT_TRANSMITTER].cls_id = cls;
+ ObjectClass::Assign(&_object_specs[OBJECT_TRANSMITTER]);
+}
+
+INSTANTIATE_NEWGRF_CLASS_METHODS(ObjectClass, ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX)