CBattleSiegeController.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * CBattleObstacleController.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/GameConstants.h"
  12. struct BattleObjectsByHex;
  13. struct CatapultAttack;
  14. struct SDL_Surface;
  15. struct BattleHex;
  16. struct Point;
  17. class CGTownInstance;
  18. class CBattleInterface;
  19. class CCreature;
  20. namespace EWallVisual
  21. {
  22. enum EWallVisual
  23. {
  24. BACKGROUND = 0,
  25. BACKGROUND_WALL = 1,
  26. KEEP,
  27. BOTTOM_TOWER,
  28. BOTTOM_WALL,
  29. WALL_BELLOW_GATE,
  30. WALL_OVER_GATE,
  31. UPPER_WALL,
  32. UPPER_TOWER,
  33. GATE,
  34. GATE_ARCH,
  35. BOTTOM_STATIC_WALL,
  36. UPPER_STATIC_WALL,
  37. MOAT,
  38. BACKGROUND_MOAT,
  39. KEEP_BATTLEMENT,
  40. BOTTOM_BATTLEMENT,
  41. UPPER_BATTLEMENT
  42. };
  43. }
  44. class CBattleSiegeController
  45. {
  46. CBattleInterface * owner;
  47. SDL_Surface* walls[18];
  48. const CGTownInstance *town; //besieged town
  49. std::string getSiegeName(ui16 what) const;
  50. std::string getSiegeName(ui16 what, int state) const; // state uses EWallState enum
  51. void printPartOfWall(SDL_Surface *to, int what);
  52. public:
  53. CBattleSiegeController(CBattleInterface * owner, const CGTownInstance *siegeTown);
  54. ~CBattleSiegeController();
  55. void showPiecesOfWall(SDL_Surface *to, std::vector<int> pieces);
  56. const CCreature *turretCreature();
  57. Point turretCreaturePosition( BattleHex position );
  58. void gateStateChanged(const EGateState state);
  59. void showAbsoluteObstacles(SDL_Surface * to);
  60. bool isCatapultAttackable(BattleHex hex) const; //returns true if given tile can be attacked by catapult
  61. void stackIsCatapulting(const CatapultAttack & ca); //called when a stack is attacking walls
  62. void sortObjectsByHex(BattleObjectsByHex & sorted);
  63. };