IBattleCallback.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * IBattleCallback.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../constants/EntityIdentifiers.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class BattleAction;
  14. class BattleStateInfoForRetreat;
  15. class CPlayerBattleCallback;
  16. class IBattleCallback
  17. {
  18. public:
  19. virtual ~IBattleCallback() = default;
  20. bool waitTillRealize = false; //if true, request functions will return after they are realized by server
  21. bool unlockGsWhenWaiting = false;//if true after sending each request, gs mutex will be unlocked so the changes can be applied; NOTICE caller must have gs mx locked prior to any call to actiob callback!
  22. //battle
  23. virtual void battleMakeSpellAction(const BattleID & battleID, const BattleAction & action) = 0;
  24. virtual void battleMakeUnitAction(const BattleID & battleID, const BattleAction & action) = 0;
  25. virtual void battleMakeTacticAction(const BattleID & battleID, const BattleAction & action) = 0;
  26. virtual std::optional<BattleAction> makeSurrenderRetreatDecision(const BattleID & battleID, const BattleStateInfoForRetreat & battleState) = 0;
  27. virtual std::shared_ptr<CPlayerBattleCallback> getBattle(const BattleID & battleID) = 0;
  28. virtual std::optional<PlayerColor> getPlayerID() const = 0;
  29. };
  30. VCMI_LIB_NAMESPACE_END