mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there. * Declared existing Entity APIs. * Added basic script context caching * Started Lua script module * Started Lua spell effect API * Started script state persistence * Started battle info callback binding * CommitPackage removed * Extracted spells::Caster to own header; Expanded Spell API. * implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C * !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented * Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key) * Re-enabled VERM macros. * !?GM0 added * !?TM implemented * Added !!MF:N * Started !?OB, !!BM, !!HE, !!OW, !!UN * Added basic support of w-variables * Added support for ERM indirect variables * Made !?FU regular trigger * !!re (ERA loop receiver) implemented * Fixed ERM receivers with zero args.
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vcmi/Metatype.h>
|
||||
|
||||
#include "CGameInfoCallback.h" // for CGameInfoCallback
|
||||
#include "CRandomGenerator.h"
|
||||
|
||||
@@ -25,6 +27,13 @@ class CStackBasicDescriptor;
|
||||
class CGCreature;
|
||||
struct ShashInt3;
|
||||
|
||||
namespace scripting
|
||||
{
|
||||
class Context;
|
||||
class Pool;
|
||||
class Script;
|
||||
}
|
||||
|
||||
class DLL_LINKAGE CPrivilegedInfoCallback : public CGameInfoCallback
|
||||
{
|
||||
public:
|
||||
@@ -42,12 +51,16 @@ public:
|
||||
void loadCommonState(Loader &in); //loads GS and VLC
|
||||
};
|
||||
|
||||
class DLL_LINKAGE IGameEventCallback : public IGameEventRealizer
|
||||
class DLL_LINKAGE IGameEventCallback
|
||||
{
|
||||
public:
|
||||
virtual void setObjProperty(ObjectInstanceID objid, int prop, si64 val) = 0;
|
||||
|
||||
virtual void showInfoDialog(InfoWindow * iw) = 0;
|
||||
virtual void showInfoDialog(const std::string & msg, PlayerColor player) = 0;
|
||||
|
||||
virtual void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells)=0;
|
||||
virtual bool removeObject(const CGObjectInstance * obj)=0;
|
||||
virtual void setBlockVis(ObjectInstanceID objid, bool bv)=0;
|
||||
virtual void setOwner(const CGObjectInstance * objid, PlayerColor owner)=0;
|
||||
virtual void changePrimSkill(const CGHeroInstance * hero, PrimarySkill::PrimarySkill which, si64 val, bool abs=false)=0;
|
||||
virtual void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs=false)=0;
|
||||
@@ -76,7 +89,6 @@ public:
|
||||
virtual void putArtifact(const ArtifactLocation &al, const CArtifactInstance *a) = 0;
|
||||
virtual void removeArtifact(const ArtifactLocation &al) = 0;
|
||||
virtual bool moveArtifact(const ArtifactLocation &al1, const ArtifactLocation &al2) = 0;
|
||||
virtual void synchronizeArtifactHandlerLists() = 0;
|
||||
|
||||
virtual void showCompInfo(ShowInInfobox * comp)=0;
|
||||
virtual void heroVisitCastle(const CGTownInstance * obj, const CGHeroInstance * hero)=0;
|
||||
@@ -85,7 +97,6 @@ public:
|
||||
virtual void startBattlePrimary(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool creatureBank = false, const CGTownInstance *town = nullptr)=0; //use hero=nullptr for no hero
|
||||
virtual void startBattleI(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, bool creatureBank = false)=0; //if any of armies is hero, hero will be used
|
||||
virtual void startBattleI(const CArmedInstance *army1, const CArmedInstance *army2, bool creatureBank = false)=0; //if any of armies is hero, hero will be used, visitable tile of second obj is place of battle
|
||||
virtual void setAmount(ObjectInstanceID objid, ui32 val)=0;
|
||||
virtual bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, bool transit = false, PlayerColor asker = PlayerColor::NEUTRAL)=0;
|
||||
virtual void giveHeroBonus(GiveBonus * bonus)=0;
|
||||
virtual void setMovePoints(SetMovePoints * smp)=0;
|
||||
@@ -101,7 +112,7 @@ public:
|
||||
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilegedInfoCallback
|
||||
{
|
||||
public:
|
||||
PlayerState *getPlayer(PlayerColor color, bool verbose = true);
|
||||
PlayerState * getPlayerState(PlayerColor color, bool verbose = true);
|
||||
TeamState *getTeam(TeamID teamID);//get team by team ID
|
||||
TeamState *getPlayerTeam(PlayerColor color);// get team by player color
|
||||
CGHeroInstance *getHero(ObjectInstanceID objid);
|
||||
@@ -110,6 +121,8 @@ public:
|
||||
CArtifactInstance * getArtInstance(ArtifactInstanceID aid);
|
||||
CGObjectInstance * getObjInstance(ObjectInstanceID oid);
|
||||
CArmedInstance * getArmyInstance(ObjectInstanceID oid);
|
||||
|
||||
virtual void updateEntity(Metatype metatype, int32_t index, const JsonNode & data) = 0;
|
||||
};
|
||||
|
||||
/// Interface class for handling general game logic and actions
|
||||
@@ -118,9 +131,7 @@ class DLL_LINKAGE IGameCallback : public CPrivilegedInfoCallback, public IGameEv
|
||||
public:
|
||||
virtual ~IGameCallback(){};
|
||||
|
||||
//do sth
|
||||
const CGObjectInstance *putNewObject(Obj ID, int subID, int3 pos);
|
||||
const CGCreature *putNewMonster(CreatureID creID, int count, int3 pos);
|
||||
virtual scripting::Pool * getGlobalContextPool() const = 0;
|
||||
|
||||
//get info
|
||||
virtual bool isVisitCoveredByAnotherQuery(const CGObjectInstance *obj, const CGHeroInstance *hero);
|
||||
|
||||
Reference in New Issue
Block a user