1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
vcmi/server/queries/MapQueries.h

134 lines
4.0 KiB
C++
Raw Normal View History

2023-07-23 23:46:29 +02:00
/*
* MapQueries.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"
#include "../../lib/networkPacks/PacksForClient.h"
VCMI_LIB_NAMESPACE_BEGIN
class CGHeroInstance;
class CGObjectInstance;
class int3;
VCMI_LIB_NAMESPACE_END
2023-07-23 23:46:29 +02:00
2023-08-28 02:42:05 +02:00
class TurnTimerHandler;
2023-10-07 01:44:37 +02:00
//Created when player starts turn or when player puts game on [ause
//Removed when player accepts a turn or continur play
class TimerPauseQuery : public CQuery
2023-08-28 02:42:05 +02:00
{
public:
2023-10-07 01:44:37 +02:00
TimerPauseQuery(CGameHandler * owner, PlayerColor player);
2023-08-28 02:42:05 +02:00
bool blocksPack(const CPack *pack) const override;
void onAdding(PlayerColor color) override;
void onRemoval(PlayerColor color) override;
bool endsByPlayerAnswer() const override;
};
2023-07-23 23:46:29 +02:00
//Created when hero visits object.
//Removed when query above is resolved (or immediately after visit if no queries were created)
class CObjectVisitQuery : public CQuery
2023-07-23 23:46:29 +02:00
{
public:
const CGObjectInstance *visitedObject;
const CGHeroInstance *visitingHero;
int3 tile; //may be different than hero pos -> eg. visit via teleport
bool removeObjectAfterVisit;
CObjectVisitQuery(CGameHandler * owner, const CGObjectInstance *Obj, const CGHeroInstance *Hero, int3 Tile);
bool blocksPack(const CPack *pack) const override;
void onRemoval(PlayerColor color) override;
void onExposure(QueryPtr topQuery) override;
2023-07-23 23:46:29 +02:00
};
//Created when hero attempts move and something happens
//(not necessarily position change, could be just an object interaction).
class CHeroMovementQuery : public CQuery
2023-07-23 23:46:29 +02:00
{
public:
TryMoveHero tmh;
bool visitDestAfterVictory; //if hero moved to guarded tile and it should be visited once guard is defeated
const CGHeroInstance *hero;
void onExposure(QueryPtr topQuery) override;
2023-07-23 23:46:29 +02:00
CHeroMovementQuery(CGameHandler * owner, const TryMoveHero & Tmh, const CGHeroInstance * Hero, bool VisitDestAfterVictory = false);
void onAdding(PlayerColor color) override;
void onRemoval(PlayerColor color) override;
2023-07-23 23:46:29 +02:00
};
class CGarrisonDialogQuery : public CDialogQuery //used also for hero exchange dialogs
{
public:
std::array<const CArmedInstance *,2> exchangingArmies;
CGarrisonDialogQuery(CGameHandler * owner, const CArmedInstance *up, const CArmedInstance *down);
void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
bool blocksPack(const CPack *pack) const override;
2023-07-23 23:46:29 +02:00
};
//yes/no and component selection dialogs
class CBlockingDialogQuery : public CDialogQuery
{
public:
BlockingDialog bd; //copy of pack... debug purposes
CBlockingDialogQuery(CGameHandler * owner, const BlockingDialog &bd);
void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
2023-07-23 23:46:29 +02:00
};
class OpenWindowQuery : public CDialogQuery
{
EOpenWindowMode mode;
public:
OpenWindowQuery(CGameHandler * owner, const CGHeroInstance *hero, EOpenWindowMode mode);
2023-09-28 11:16:42 +02:00
bool blocksPack(const CPack *pack) const override;
void onExposure(QueryPtr topQuery) override;
};
2023-07-23 23:46:29 +02:00
class CTeleportDialogQuery : public CDialogQuery
{
public:
TeleportDialog td; //copy of pack... debug purposes
CTeleportDialogQuery(CGameHandler * owner, const TeleportDialog &td);
void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
2023-07-23 23:46:29 +02:00
};
class CHeroLevelUpDialogQuery : public CDialogQuery
{
public:
CHeroLevelUpDialogQuery(CGameHandler * owner, const HeroLevelUp &Hlu, const CGHeroInstance * Hero);
void onRemoval(PlayerColor color) override;
void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
2023-07-23 23:46:29 +02:00
HeroLevelUp hlu;
const CGHeroInstance * hero;
};
class CCommanderLevelUpDialogQuery : public CDialogQuery
{
public:
CCommanderLevelUpDialogQuery(CGameHandler * owner, const CommanderLevelUp &Clu, const CGHeroInstance * Hero);
void onRemoval(PlayerColor color) override;
void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
2023-07-23 23:46:29 +02:00
CommanderLevelUp clu;
const CGHeroInstance * hero;
};