VCMI_Lib.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef __VCMI_LIB_H__
  2. #define __VCMI_LIB_H__
  3. #include "../global.h"
  4. /*
  5. * VCMI_Lib.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. class CLodHandler;
  14. class CArtHandler;
  15. class CHeroHandler;
  16. class CCreatureHandler;
  17. class CSpellHandler;
  18. class CBuildingHandler;
  19. class CObjectHandler;
  20. class CDefObjInfoHandler;
  21. class CTownHandler;
  22. class CGeneralTextHandler;
  23. /// Loads and constructs several handlers
  24. class DLL_EXPORT LibClasses
  25. {
  26. public:
  27. bool IS_AI_ENABLED; //VLC is teh only object visible from both CMT and GeniusAI
  28. CArtHandler * arth;
  29. CHeroHandler * heroh;
  30. CCreatureHandler * creh;
  31. CSpellHandler * spellh;
  32. CBuildingHandler * buildh;
  33. CObjectHandler * objh;
  34. CDefObjInfoHandler * dobjinfo;
  35. CTownHandler * townh;
  36. CGeneralTextHandler * generaltexth;
  37. LibClasses(); //c-tor, loads .lods and NULLs handlers
  38. void init(); //uses standard config file
  39. void clear(); //deletes all handlers and its data
  40. void makeNull(); //sets all handler (except of lodhs) pointers to null
  41. void callWhenDeserializing(); //should be called only by serialize !!!
  42. template <typename Handler> void serialize(Handler &h, const int version)
  43. {
  44. h & heroh & arth & creh & townh & objh & dobjinfo & buildh & spellh & IS_AI_ENABLED;;
  45. if(!h.saving)
  46. {
  47. callWhenDeserializing();
  48. }
  49. }
  50. };
  51. extern DLL_EXPORT LibClasses * VLC;
  52. extern DLL_EXPORT CLodHandler * bitmaph, *spriteh;
  53. DLL_EXPORT void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
  54. DLL_EXPORT void loadToIt(si32 &dest, const std::string &src, int &iter, int mode);
  55. DLL_EXPORT void initDLL(CConsoleHandler *Console, std::ostream *Logfile);
  56. #endif // __VCMI_LIB_H__