2024-09-04 16:32:36 +02:00
|
|
|
/*
|
|
|
|
* VisitQueries.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CQuery.h"
|
|
|
|
|
2024-09-15 22:09:06 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class CGTownInstance;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2024-09-04 16:32:36 +02:00
|
|
|
//Created when hero visits object.
|
|
|
|
//Removed when query above is resolved (or immediately after visit if no queries were created)
|
2024-09-04 16:54:09 +02:00
|
|
|
class VisitQuery : public CQuery
|
2024-09-04 16:32:36 +02:00
|
|
|
{
|
2024-09-04 16:54:09 +02:00
|
|
|
protected:
|
2024-09-15 22:09:06 +02:00
|
|
|
VisitQuery(CGameHandler * owner, const CGObjectInstance * Obj, const CGHeroInstance * Hero);
|
2024-09-04 16:54:09 +02:00
|
|
|
|
2024-09-04 16:32:36 +02:00
|
|
|
public:
|
2024-09-15 22:09:06 +02:00
|
|
|
const CGObjectInstance * visitedObject;
|
|
|
|
const CGHeroInstance * visitingHero;
|
2024-09-04 16:32:36 +02:00
|
|
|
|
2024-10-04 15:41:53 +02:00
|
|
|
bool blocksPack(const CPackForServer * pack) const final;
|
2024-09-04 16:54:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class MapObjectVisitQuery final : public VisitQuery
|
|
|
|
{
|
|
|
|
public:
|
2024-09-04 16:32:36 +02:00
|
|
|
bool removeObjectAfterVisit;
|
|
|
|
|
2024-09-15 22:09:06 +02:00
|
|
|
MapObjectVisitQuery(CGameHandler * owner, const CGObjectInstance * Obj, const CGHeroInstance * Hero);
|
2024-09-04 16:54:09 +02:00
|
|
|
|
|
|
|
void onRemoval(PlayerColor color) final;
|
2024-09-15 22:09:06 +02:00
|
|
|
void onExposure(QueryPtr topQuery) final;
|
2024-09-04 16:54:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class TownBuildingVisitQuery final : public VisitQuery
|
|
|
|
{
|
2024-09-15 22:09:06 +02:00
|
|
|
struct BuildingVisit
|
|
|
|
{
|
|
|
|
const CGHeroInstance * hero;
|
|
|
|
BuildingID building;
|
|
|
|
};
|
2024-09-04 16:54:09 +02:00
|
|
|
|
2024-09-15 22:09:06 +02:00
|
|
|
const CGTownInstance * visitedTown;
|
|
|
|
std::vector<BuildingVisit> visitedBuilding;
|
2024-09-04 16:32:36 +02:00
|
|
|
|
2024-09-15 22:09:06 +02:00
|
|
|
public:
|
|
|
|
TownBuildingVisitQuery(CGameHandler * owner, const CGTownInstance * Obj, std::vector<const CGHeroInstance *> heroes, std::vector<BuildingID> buildingToVisit);
|
|
|
|
|
|
|
|
void onAdded(PlayerColor color) final;
|
|
|
|
void onExposure(QueryPtr topQuery) final;
|
2024-09-04 16:32:36 +02:00
|
|
|
};
|