newgrf_class.h

Go to the documentation of this file.
00001 /* $Id: newgrf_class.h 21886 2011-01-22 09:53:15Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef NEWGRF_CLASS_H
00013 #define NEWGRF_CLASS_H
00014 
00015 #include "strings_type.h"
00016 
00020 template <typename Tspec, typename Tid, Tid Tmax>
00021 struct NewGRFClass {
00022   uint32 global_id; 
00023   StringID name;    
00024   uint count;       
00025   Tspec **spec;     
00026 
00028   static NewGRFClass<Tspec, Tid, Tmax> classes[Tmax];
00029 
00030   static void Reset();
00032   static void InsertDefaults();
00033 
00034   static Tid Allocate(uint32 global_id);
00035   static void SetName(Tid cls_id, StringID name);
00036   static void Assign(Tspec *spec);
00037 
00038   static StringID GetName(Tid cls_id);
00039   static uint GetCount();
00040   static uint GetCount(Tid cls_id);
00041   static const Tspec *Get(Tid cls_id, uint index);
00042   static const Tspec *GetByGrf(uint32 grfid, byte local_id, int *index);
00043 };
00044 
00045 #endif /* NEWGRF_CLASS_H */

Generated on Fri Mar 4 21:37:02 2011 for OpenTTD by  doxygen 1.6.1