summaryrefslogtreecommitdiff
path: root/src/newgrf_class_func.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-04-22 16:27:49 +0000
committerfrosch <frosch@openttd.org>2012-04-22 16:27:49 +0000
commit73d926c8d4b7cb327cb1d3484dbecd8303268172 (patch)
tree8651505c13e64b06a53aec6845140b16e0c7cb75 /src/newgrf_class_func.h
parent27ffb033838e1dc9fede9154181be572e826a1e6 (diff)
downloadopenttd-73d926c8d4b7cb327cb1d3484dbecd8303268172.tar.xz
(svn r24161) -Add: Method to get a specific NewGRFClass.
Diffstat (limited to 'src/newgrf_class_func.h')
-rw-r--r--src/newgrf_class_func.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/newgrf_class_func.h b/src/newgrf_class_func.h
index c4e9f7963..15cacd4e2 100644
--- a/src/newgrf_class_func.h
+++ b/src/newgrf_class_func.h
@@ -93,6 +93,18 @@ DEFINE_NEWGRF_CLASS_METHOD(void)::Assign(Tspec *spec)
}
/**
+ * Get a particular class.
+ * @param cls_id The id for the class.
+ * @pre cls_id < Tmax
+ */
+template <typename Tspec, typename Tid, Tid Tmax>
+NewGRFClass<Tspec, Tid, Tmax> *NewGRFClass<Tspec, Tid, Tmax>::Get(Tid cls_id)
+{
+ assert(cls_id < Tmax);
+ return classes + cls_id;
+}
+
+/**
* Get the name of a particular class.
* @param cls_id The class to get the name of.
* @pre index < GetCount(cls_id)
@@ -176,6 +188,7 @@ DEFINE_NEWGRF_CLASS_METHOD(const Tspec *)::GetByGrf(uint32 grfid, byte local_id,
template Tid name::Allocate(uint32 global_id); \
template void name::SetName(Tid cls_id, StringID name); \
template void name::Assign(Tspec *spec); \
+ template NewGRFClass<Tspec, Tid, Tmax> *name::Get(Tid cls_id); \
template StringID name::GetName(Tid cls_id); \
template uint name::GetCount(); \
template uint name::GetCount(Tid cls_id); \