summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-04-22 16:28:00 +0000
committerfrosch <frosch@openttd.org>2012-04-22 16:28:00 +0000
commitb3c84fcbbd1983676eb0eae2079042580f4c78e6 (patch)
tree0a710fdd0ea3cde506b2d6ed70d1e7d7ea5fcce2 /src
parent6f4d2160c25c75ed0d09657bfb0f85fdac65bfcd (diff)
downloadopenttd-b3c84fcbbd1983676eb0eae2079042580f4c78e6.tar.xz
(svn r24163) -Codechange: Make various members of NewGRFClass private.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_class.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/newgrf_class.h b/src/newgrf_class.h
index 95c589d17..a7b8099ad 100644
--- a/src/newgrf_class.h
+++ b/src/newgrf_class.h
@@ -19,18 +19,25 @@
*/
template <typename Tspec, typename Tid, Tid Tmax>
struct NewGRFClass {
- uint32 global_id; ///< Global ID for class, e.g. 'DFLT', 'WAYP', etc.
- StringID name; ///< Name of this class.
- uint count; ///< Number of stations in this class.
- Tspec **spec; ///< Array of station specifications.
-
- /** The actual classes. */
+private:
+ uint count; ///< Number of specs in this class.
+ Tspec **spec; ///< Array of specifications.
+
+ /**
+ * The actual classes.
+ * @note We store pointers to membes of this array in various places outside this class (e.g. to 'name' for GRF string resolving).
+ * Thus this must be a static array, and cannot be a self-resizing SmallVector or similar.
+ */
static NewGRFClass<Tspec, Tid, Tmax> classes[Tmax];
- static void Reset();
/** Initialise the defaults. */
static void InsertDefaults();
+public:
+ uint32 global_id; ///< Global ID for class, e.g. 'DFLT', 'WAYP', etc.
+ StringID name; ///< Name of this class.
+
+ static void Reset();
static Tid Allocate(uint32 global_id);
static void Assign(Tspec *spec);
static NewGRFClass *Get(Tid cls_id);