# HG changeset patch # User frosch # Date 1335112080 0 # Node ID 8bb6a344996778566d075644cd833622eccfa132 # Parent 34e42b748da7503a6fc3d08640b27b7606e67881 (svn r24163) -Codechange: Make various members of NewGRFClass private. diff --git a/src/newgrf_class.h b/src/newgrf_class.h --- a/src/newgrf_class.h +++ b/src/newgrf_class.h @@ -19,18 +19,25 @@ */ template 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. +private: + uint count; ///< Number of specs in this class. + Tspec **spec; ///< Array of specifications. - /** The actual classes. */ + /** + * 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 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);