HeroMovementController.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * CPlayerInterface.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 "../lib/constants/EntityIdentifiers.h"
  12. #include "../lib/int3.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. using TTeleportExitsList = std::vector<std::pair<ObjectInstanceID, int3>>;
  15. class CGHeroInstance;
  16. class CArmedInstance;
  17. struct CGPath;
  18. struct TryMoveHero;
  19. VCMI_LIB_NAMESPACE_END
  20. class HeroMovementController
  21. {
  22. ObjectInstanceID destinationTeleport; //contain -1 or object id if teleportation
  23. int3 destinationTeleportPos;
  24. bool duringMovement;
  25. enum class EMoveState
  26. {
  27. STOP_MOVE,
  28. WAITING_MOVE,
  29. CONTINUE_MOVE,
  30. DURING_MOVE
  31. };
  32. EMoveState movementState;
  33. void setMovementStatus(bool value);
  34. public:
  35. HeroMovementController();
  36. // const queries
  37. bool isHeroMovingThroughGarrison(const CGHeroInstance * hero, const CArmedInstance * garrison) const;
  38. bool isHeroMoving() const;
  39. // netpack handlers
  40. void onMoveHeroApplied();
  41. void onQueryReplyApplied();
  42. void onPlayerTurnStarted();
  43. void onBattleStarted();
  44. void showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID);
  45. void heroMoved(const CGHeroInstance * hero, const TryMoveHero & details);
  46. // UI handlers
  47. void movementStartRequested(const CGHeroInstance * h, const CGPath & path);
  48. void movementStopRequested();
  49. };