VCMI_Lib.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. /*
  3. * VCMI_Lib.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. class CArtHandler;
  12. class CHeroHandler;
  13. class CCreatureHandler;
  14. class CSpellHandler;
  15. class CBuildingHandler;
  16. class CObjectHandler;
  17. class CDefObjInfoHandler;
  18. class CTownHandler;
  19. class CGeneralTextHandler;
  20. class CModHandler;
  21. class IBonusTypeHandler;
  22. class CBonusTypeHandler;
  23. /// Loads and constructs several handlers
  24. class DLL_LINKAGE LibClasses
  25. {
  26. CBonusTypeHandler * bth;
  27. void callWhenDeserializing(); //should be called only by serialize !!!
  28. void makeNull(); //sets all handler pointers to null
  29. public:
  30. bool IS_AI_ENABLED; //VLC is the only object visible from both CMT and GeniusAI
  31. const IBonusTypeHandler * getBth() const;
  32. CArtHandler * arth;
  33. CHeroHandler * heroh;
  34. CCreatureHandler * creh;
  35. CSpellHandler * spellh;
  36. CObjectHandler * objh;
  37. CDefObjInfoHandler * dobjinfo;
  38. CTownHandler * townh;
  39. CGeneralTextHandler * generaltexth;
  40. CModHandler * modh;
  41. LibClasses(); //c-tor, loads .lods and NULLs handlers
  42. ~LibClasses();
  43. void init(); //uses standard config file
  44. void clear(); //deletes all handlers and its data
  45. void loadFilesystem();// basic initialization. should be called before init()
  46. template <typename Handler> void serialize(Handler &h, const int version)
  47. {
  48. h & heroh & arth & creh & townh & objh & dobjinfo & spellh & modh & IS_AI_ENABLED;
  49. h & bth;
  50. if(!h.saving)
  51. {
  52. callWhenDeserializing();
  53. }
  54. }
  55. };
  56. extern DLL_LINKAGE LibClasses * VLC;
  57. DLL_LINKAGE void preinitDLL(CConsoleHandler *Console);
  58. DLL_LINKAGE void loadDLLClasses();