VisitQueries.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * VisitQueries.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 "CQuery.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGTownInstance;
  14. VCMI_LIB_NAMESPACE_END
  15. //Created when hero visits object.
  16. //Removed when query above is resolved (or immediately after visit if no queries were created)
  17. class VisitQuery : public CQuery
  18. {
  19. protected:
  20. VisitQuery(CGameHandler * owner, const CGObjectInstance * Obj, const CGHeroInstance * Hero);
  21. public:
  22. ObjectInstanceID visitedObject;
  23. ObjectInstanceID visitingHero;
  24. bool blocksPack(const CPackForServer * pack) const final;
  25. };
  26. class MapObjectVisitQuery final : public VisitQuery
  27. {
  28. public:
  29. bool removeObjectAfterVisit;
  30. MapObjectVisitQuery(CGameHandler * owner, const CGObjectInstance * Obj, const CGHeroInstance * Hero);
  31. void onRemoval(PlayerColor color) final;
  32. void onExposure(QueryPtr topQuery) final;
  33. };
  34. class TownBuildingVisitQuery final : public VisitQuery
  35. {
  36. struct BuildingVisit
  37. {
  38. const CGHeroInstance * hero;
  39. BuildingID building;
  40. };
  41. const CGTownInstance * visitedTown;
  42. std::vector<BuildingVisit> visitedBuilding;
  43. public:
  44. TownBuildingVisitQuery(CGameHandler * owner, const CGTownInstance * Obj, std::vector<const CGHeroInstance *> heroes, std::vector<BuildingID> buildingToVisit);
  45. void onAdded(PlayerColor color) final;
  46. void onExposure(QueryPtr topQuery) final;
  47. };