2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __VCMI_LIB_H__
|
|
|
|
#define __VCMI_LIB_H__
|
|
|
|
#include "../global.h"
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2009-04-15 17:03:31 +03: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 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
class CLodHandler;
|
|
|
|
class CArtHandler;
|
|
|
|
class CHeroHandler;
|
|
|
|
class CCreatureHandler;
|
|
|
|
class CSpellHandler;
|
|
|
|
class CBuildingHandler;
|
|
|
|
class CObjectHandler;
|
|
|
|
class CDefObjInfoHandler;
|
|
|
|
class CTownHandler;
|
|
|
|
class CGeneralTextHandler;
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Loads and constructs several handlers
|
2009-04-16 14:14:13 +03:00
|
|
|
class DLL_EXPORT LibClasses
|
|
|
|
{
|
|
|
|
public:
|
2010-11-28 18:39:13 +02:00
|
|
|
bool IS_AI_ENABLED; //VLC is teh only object visible from both CMT and GeniusAI
|
2009-04-16 14:14:13 +03:00
|
|
|
CArtHandler * arth;
|
|
|
|
CHeroHandler * heroh;
|
|
|
|
CCreatureHandler * creh;
|
|
|
|
CSpellHandler * spellh;
|
|
|
|
CBuildingHandler * buildh;
|
|
|
|
CObjectHandler * objh;
|
|
|
|
CDefObjInfoHandler * dobjinfo;
|
|
|
|
CTownHandler * townh;
|
|
|
|
CGeneralTextHandler * generaltexth;
|
|
|
|
|
2009-06-23 11:14:49 +03:00
|
|
|
LibClasses(); //c-tor, loads .lods and NULLs handlers
|
2009-04-16 14:14:13 +03:00
|
|
|
void init(); //uses standard config file
|
|
|
|
void clear(); //deletes all handlers and its data
|
2009-06-23 11:14:49 +03:00
|
|
|
void makeNull(); //sets all handler (except of lodhs) pointers to null
|
2010-02-12 17:04:01 +02:00
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2010-02-12 17:04:01 +02:00
|
|
|
void callWhenDeserializing(); //should be called only by serialize !!!
|
2009-04-16 14:14:13 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2010-11-28 18:39:13 +02:00
|
|
|
h & heroh & arth & creh & townh & objh & dobjinfo & buildh & spellh & IS_AI_ENABLED;;
|
2009-04-16 14:14:13 +03:00
|
|
|
if(!h.saving)
|
|
|
|
{
|
2010-02-12 17:04:01 +02:00
|
|
|
callWhenDeserializing();
|
2009-04-16 14:14:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern DLL_EXPORT LibClasses * VLC;
|
2011-03-19 16:27:51 +02:00
|
|
|
extern DLL_EXPORT CLodHandler * bitmaph, *spriteh, *bitmaph_ab;
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2010-02-12 17:04:01 +02:00
|
|
|
DLL_EXPORT void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
|
|
|
|
DLL_EXPORT void loadToIt(si32 &dest, const std::string &src, int &iter, int mode);
|
2009-05-09 19:18:27 +03:00
|
|
|
DLL_EXPORT void initDLL(CConsoleHandler *Console, std::ostream *Logfile);
|
2009-04-16 14:14:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
#endif // __VCMI_LIB_H__
|