1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Change callback interface

This commit is contained in:
nordsoft 2023-04-10 05:40:03 +04:00
parent 56b0e900d8
commit c0b90432cb
4 changed files with 10 additions and 5 deletions

View File

@ -231,7 +231,7 @@ public:
void changeObjPos(ObjectInstanceID objid, int3 newPos) override {};
void sendAndApply(CPackForClient * pack) override {};
void heroExchange(ObjectInstanceID hero1, ObjectInstanceID hero2) override {};
void castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos) override {};
void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos) override {};
void changeFogOfWar(int3 center, ui32 radius, PlayerColor player, bool hide) override {}
void changeFogOfWar(std::unordered_set<int3, ShashInt3> & tiles, PlayerColor player, bool hide) override {}

View File

@ -28,6 +28,11 @@ class CStackBasicDescriptor;
class CGCreature;
struct ShashInt3;
namespace spells
{
class Caster;
}
#if SCRIPTING_ENABLED
namespace scripting
{
@ -133,7 +138,7 @@ public:
virtual void changeFogOfWar(int3 center, ui32 radius, PlayerColor player, bool hide) = 0;
virtual void changeFogOfWar(std::unordered_set<int3, ShashInt3> &tiles, PlayerColor player, bool hide) = 0;
virtual void castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos) = 0;
virtual void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos) = 0;
};
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilegedInfoCallback

View File

@ -6282,14 +6282,14 @@ bool CGameHandler::moveStack(const StackLocation &src, const StackLocation &dst,
return true;
}
void CGameHandler::castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos)
void CGameHandler::castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos)
{
const CSpell * s = spellID.toSpell();
if(!s)
return;
AdventureSpellCastParameters p;
p.caster = hero;
p.caster = caster;
p.pos = pos;
s->adventureCast(spellEnv, p);

View File

@ -275,7 +275,7 @@ public:
void moveArmy(const CArmedInstance *src, const CArmedInstance *dst, bool allowMerging);
const ObjectInstanceID putNewObject(Obj ID, int subID, int3 pos);
void castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos);
void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos);
template <typename Handler> void serialize(Handler &h, const int version)
{