fix for https://github.com/Attnam/ivan/issues/119
[k8-i-v-a-n.git] / src / game / database.h
blob943da1514825797dffa9ce6cb364274e86460b7e
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __DATABASE_H__
13 #define __DATABASE_H__
15 #include "ivancommon.h"
17 #include <map>
19 #include "typedef.h"
22 class inputfile;
23 class festring;
26 template <class database> struct databasememberbase {
27 virtual ~databasememberbase () {}
28 virtual void ReadData(database &, inputfile &) = 0;
32 template <class type> class databasecreator {
33 public:
34 typedef typename type::database database;
35 typedef typename type::prototype prototype;
36 typedef std::map<festring, databasememberbase<database> *> databasemembermap;
38 virtual ~databasecreator () {}
40 static void ReadFrom (const festring &baseFileName);
41 static void FindDataBase (const database *&, const prototype *, int);
42 static void InstallDataBase (type *, int);
43 static void CreateDataBaseMemberMap ();
44 static int CreateDivineConfigurations (const prototype *, database **, int);
46 private:
47 static truth AnalyzeData (inputfile &, cfestring &, database &);
48 static void CheckDefaults (cfestring &, database &);
49 static void CreateLTerrainDataBaseMemberMap ();
50 static void SetBaseValue (cfestring &, databasememberbase<database> *, database &);
51 static databasemembermap &GetDataBaseMemberMap();
55 class databasesystem {
56 public:
57 virtual ~databasesystem () {}
59 static void Initialize ();
63 #endif