CGBank.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include "CObjectHandler.h"
  3. #include "CGArmedInstance.h"
  4. /*
  5. * CObjectHandler.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 DLL_LINKAGE CBank : public CArmedInstance
  14. {
  15. public:
  16. int index; //banks have unusal numbering - see ZCRBANK.txt and initObj()
  17. BankConfig *bc;
  18. double multiplier; //for improved banks script
  19. std::vector<ui32> artifacts; //fixed and deterministic
  20. ui32 daycounter;
  21. void initObj() override;
  22. const std::string & getHoverText() const override;
  23. void initialize() const;
  24. void reset(ui16 var1);
  25. void newTurn() const override;
  26. bool wasVisited (PlayerColor player) const override;
  27. void onHeroVisit(const CGHeroInstance * h) const override;
  28. void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
  29. void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
  30. template <typename Handler> void serialize(Handler &h, const int version)
  31. {
  32. h & static_cast<CArmedInstance&>(*this);
  33. h & index & multiplier & artifacts & daycounter & bc;
  34. }
  35. protected:
  36. void setPropertyDer(ui8 what, ui32 val) override;
  37. };
  38. class DLL_LINKAGE CGPyramid : public CBank
  39. {
  40. public:
  41. ui16 spell;
  42. void initObj() override;
  43. const std::string & getHoverText() const override;
  44. void newTurn() const override {}; //empty, no reset
  45. void onHeroVisit(const CGHeroInstance * h) const override;
  46. void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
  47. template <typename Handler> void serialize(Handler &h, const int version)
  48. {
  49. h & static_cast<CBank&>(*this);
  50. h & spell;
  51. }
  52. };