mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Add TeleportDialog and CTeleportDialogQuery
TeleportDialog is based off BlockingDialog and it's needed for server to ask client what teleport hero should be teleported to. It's also contain list of possible exits, identifier of currently used channel and also impassable option. If impassable set to true then client will remember that current teleport channel is lack of exit point.
This commit is contained in:
parent
8d7b6d119f
commit
18535db0ef
@ -595,6 +595,11 @@ void ExchangeDialog::applyCl(CClient *cl)
|
||||
INTERFACE_CALL_IF_PRESENT(heroes[0]->tempOwner, heroExchangeStarted, heroes[0]->id, heroes[1]->id, queryID);
|
||||
}
|
||||
|
||||
void TeleportDialog::applyCl( CClient *cl )
|
||||
{
|
||||
CALL_ONLY_THAT_INTERFACE(hero->tempOwner,showTeleportDialog,channel,exits,impassable,queryID);
|
||||
}
|
||||
|
||||
void BattleStart::applyFirstCl( CClient *cl )
|
||||
{
|
||||
//Cannot use the usual macro because curB is not set yet
|
||||
|
@ -1206,6 +1206,28 @@ struct ExchangeDialog : public Query//2005
|
||||
}
|
||||
};
|
||||
|
||||
struct TeleportDialog : public Query//2006
|
||||
{
|
||||
TeleportDialog() {type = 2006;}
|
||||
TeleportDialog(const CGHeroInstance *Hero, TeleportChannelID Channel)
|
||||
: hero(Hero), channel(Channel), impassable(false)
|
||||
{
|
||||
type = 2006;
|
||||
}
|
||||
|
||||
void applyCl(CClient *cl);
|
||||
|
||||
const CGHeroInstance *hero;
|
||||
TeleportChannelID channel;
|
||||
std::vector<ObjectInstanceID> exits;
|
||||
bool impassable;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & queryID & hero & channel & exits & impassable;
|
||||
}
|
||||
};
|
||||
|
||||
struct BattleInfo;
|
||||
struct BattleStart : public CPackForClient//3000
|
||||
{
|
||||
|
@ -286,6 +286,7 @@ void registerTypesClientPacks2(Serializer &s)
|
||||
s.template registerType<Query, BlockingDialog>();
|
||||
s.template registerType<Query, GarrisonDialog>();
|
||||
s.template registerType<Query, ExchangeDialog>();
|
||||
s.template registerType<Query, TeleportDialog>();
|
||||
|
||||
s.template registerType<CPackForClient, CGarrisonOperationPack>();
|
||||
s.template registerType<CGarrisonOperationPack, ChangeStackCount>();
|
||||
|
@ -313,6 +313,18 @@ CBlockingDialogQuery::CBlockingDialogQuery(const BlockingDialog &bd)
|
||||
addPlayer(bd.player);
|
||||
}
|
||||
|
||||
void CTeleportDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
||||
{
|
||||
auto obj = dynamic_cast<const CGTeleport *>(objectVisit.visitedObject);
|
||||
obj->teleportDialogAnswered(objectVisit.visitingHero, *answer, td.exits);
|
||||
}
|
||||
|
||||
CTeleportDialogQuery::CTeleportDialogQuery(const TeleportDialog &td)
|
||||
{
|
||||
this->td = td;
|
||||
addPlayer(td.hero->tempOwner);
|
||||
}
|
||||
|
||||
CHeroLevelUpDialogQuery::CHeroLevelUpDialogQuery(const HeroLevelUp &Hlu)
|
||||
{
|
||||
hlu = Hlu;
|
||||
|
@ -130,6 +130,16 @@ public:
|
||||
virtual void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
|
||||
};
|
||||
|
||||
class CTeleportDialogQuery : public CDialogQuery
|
||||
{
|
||||
public:
|
||||
TeleportDialog td; //copy of pack... debug purposes
|
||||
|
||||
CTeleportDialogQuery(const TeleportDialog &td);
|
||||
|
||||
virtual void notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const override;
|
||||
};
|
||||
|
||||
class CHeroLevelUpDialogQuery : public CDialogQuery
|
||||
{
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user