2011-12-13 21:23:17 +00:00
|
|
|
#pragma once
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2009-04-15 14:03:31 +00:00
|
|
|
/*
|
|
|
|
* VCMI_Lib.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 11:14:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class CArtHandler;
|
|
|
|
class CHeroHandler;
|
|
|
|
class CCreatureHandler;
|
|
|
|
class CSpellHandler;
|
|
|
|
class CBuildingHandler;
|
|
|
|
class CObjectHandler;
|
2014-05-24 01:56:51 +03:00
|
|
|
class CObjectClassesHandler;
|
2009-04-16 11:14:13 +00:00
|
|
|
class CTownHandler;
|
|
|
|
class CGeneralTextHandler;
|
2012-08-10 13:07:53 +00:00
|
|
|
class CModHandler;
|
2013-03-06 18:49:56 +00:00
|
|
|
class IBonusTypeHandler;
|
|
|
|
class CBonusTypeHandler;
|
2013-08-17 12:46:48 +00:00
|
|
|
class CTerrainViewPatternConfig;
|
|
|
|
class CRmgTemplateStorage;
|
2009-04-16 11:14:13 +00:00
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Loads and constructs several handlers
|
2011-12-13 21:23:17 +00:00
|
|
|
class DLL_LINKAGE LibClasses
|
2009-04-16 11:14:13 +00:00
|
|
|
{
|
2013-03-06 18:49:56 +00:00
|
|
|
CBonusTypeHandler * bth;
|
2013-04-21 12:49:26 +00:00
|
|
|
|
2013-01-03 12:19:20 +00:00
|
|
|
void callWhenDeserializing(); //should be called only by serialize !!!
|
|
|
|
void makeNull(); //sets all handler pointers to null
|
2009-04-16 11:14:13 +00:00
|
|
|
public:
|
2011-09-02 01:09:53 +00:00
|
|
|
bool IS_AI_ENABLED; //VLC is the only object visible from both CMT and GeniusAI
|
2013-03-06 18:49:56 +00:00
|
|
|
|
|
|
|
const IBonusTypeHandler * getBth() const;
|
2013-04-21 12:49:26 +00:00
|
|
|
|
2009-04-16 11:14:13 +00:00
|
|
|
CArtHandler * arth;
|
|
|
|
CHeroHandler * heroh;
|
|
|
|
CCreatureHandler * creh;
|
|
|
|
CSpellHandler * spellh;
|
|
|
|
CObjectHandler * objh;
|
2014-05-24 01:56:51 +03:00
|
|
|
CObjectClassesHandler * objtypeh;
|
2009-04-16 11:14:13 +00:00
|
|
|
CTownHandler * townh;
|
|
|
|
CGeneralTextHandler * generaltexth;
|
2012-08-10 13:07:53 +00:00
|
|
|
CModHandler * modh;
|
2013-08-17 12:46:48 +00:00
|
|
|
CTerrainViewPatternConfig * terviewh;
|
|
|
|
CRmgTemplateStorage * tplh;
|
2009-04-16 11:14:13 +00:00
|
|
|
|
2009-06-23 08:14:49 +00:00
|
|
|
LibClasses(); //c-tor, loads .lods and NULLs handlers
|
2012-04-08 01:15:18 +00:00
|
|
|
~LibClasses();
|
2009-04-16 11:14:13 +00:00
|
|
|
void init(); //uses standard config file
|
|
|
|
void clear(); //deletes all handlers and its data
|
2013-01-03 12:19:20 +00:00
|
|
|
|
2012-08-02 11:03:26 +00:00
|
|
|
|
2012-12-12 11:13:57 +00:00
|
|
|
void loadFilesystem();// basic initialization. should be called before init()
|
2009-04-16 11:14:13 +00:00
|
|
|
|
2013-01-03 12:19:20 +00:00
|
|
|
|
2009-04-16 11:14:13 +00:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2014-05-16 23:50:02 +03:00
|
|
|
h & heroh & arth & creh & townh & objh & objtypeh & spellh & modh & IS_AI_ENABLED;
|
2013-03-06 18:49:56 +00:00
|
|
|
h & bth;
|
2009-04-16 11:14:13 +00:00
|
|
|
if(!h.saving)
|
|
|
|
{
|
2010-02-12 15:04:01 +00:00
|
|
|
callWhenDeserializing();
|
2009-04-16 11:14:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-12-13 21:23:17 +00:00
|
|
|
extern DLL_LINKAGE LibClasses * VLC;
|
2009-04-16 11:14:13 +00:00
|
|
|
|
2013-04-11 15:58:01 +00:00
|
|
|
DLL_LINKAGE void preinitDLL(CConsoleHandler *Console);
|
2012-12-12 11:13:57 +00:00
|
|
|
DLL_LINKAGE void loadDLLClasses();
|
|
|
|
|