2014-03-17 22:51:07 +03:00
|
|
|
/*
|
|
|
|
* IGameCallback.cpp, 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
|
|
|
|
*
|
|
|
|
*/
|
2011-12-14 00:23:17 +03:00
|
|
|
#include "StdInc.h"
|
2008-12-27 03:01:59 +02:00
|
|
|
#include "IGameCallback.h"
|
2011-12-14 00:23:17 +03:00
|
|
|
|
2014-04-20 10:13:37 +03:00
|
|
|
#include "CHeroHandler.h" // for CHeroHandler
|
2015-02-02 10:25:26 +02:00
|
|
|
#include "spells/CSpellHandler.h"// for CSpell
|
2017-08-20 09:18:07 +02:00
|
|
|
#include "CSkillHandler.h"// for CSkill
|
2011-05-03 06:14:18 +03:00
|
|
|
#include "NetPacks.h"
|
2013-03-06 21:49:56 +03:00
|
|
|
#include "CBonusTypeHandler.h"
|
2014-06-25 17:11:07 +03:00
|
|
|
#include "CModHandler.h"
|
2022-06-28 10:05:30 +02:00
|
|
|
#include "BattleFieldHandler.h"
|
2022-09-15 10:06:54 +02:00
|
|
|
#include "ObstacleHandler.h"
|
2023-04-30 16:35:15 +02:00
|
|
|
#include "bonuses/CBonusSystemNode.h"
|
2023-04-30 15:52:48 +02:00
|
|
|
#include "bonuses/Limiters.h"
|
2023-04-30 16:35:15 +02:00
|
|
|
#include "bonuses/Propagators.h"
|
2023-04-30 15:52:48 +02:00
|
|
|
#include "bonuses/Updaters.h"
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2016-09-10 02:32:40 +02:00
|
|
|
#include "serializer/CSerializer.h" // for SAVEGAME_MAGIC
|
|
|
|
#include "serializer/BinaryDeserializer.h"
|
|
|
|
#include "serializer/BinarySerializer.h"
|
|
|
|
#include "serializer/CLoadIntegrityValidator.h"
|
|
|
|
#include "rmg/CMapGenOptions.h"
|
2023-06-02 20:47:37 +02:00
|
|
|
#include "mapObjectConstructors/AObjectTypeHandler.h"
|
|
|
|
#include "mapObjectConstructors/CObjectClassesHandler.h"
|
|
|
|
#include "mapObjects/CObjectHandler.h"
|
|
|
|
#include "mapObjects/ObjectTemplate.h"
|
2023-06-25 21:28:24 +02:00
|
|
|
#include "campaign/CampaignState.h"
|
2014-06-25 17:11:07 +03:00
|
|
|
#include "StartInfo.h"
|
2023-06-23 17:02:48 +02:00
|
|
|
#include "gameState/CGameState.h"
|
2023-06-23 18:33:47 +02:00
|
|
|
#include "gameState/CGameStateCampaign.h"
|
2023-07-11 14:16:02 +02:00
|
|
|
#include "gameState/TavernHeroesPool.h"
|
2015-12-02 21:05:10 +02:00
|
|
|
#include "mapping/CMap.h"
|
2015-12-02 21:39:53 +02:00
|
|
|
#include "CPlayerState.h"
|
2023-03-15 23:47:26 +02:00
|
|
|
#include "GameSettings.h"
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
#include "ScriptHandler.h"
|
2023-01-11 15:17:24 +02:00
|
|
|
#include "RoadHandler.h"
|
|
|
|
#include "RiverHandler.h"
|
2023-01-09 01:17:37 +02:00
|
|
|
#include "TerrainHandler.h"
|
2018-01-05 19:21:07 +02:00
|
|
|
|
|
|
|
#include "serializer/Connection.h"
|
2008-12-27 03:01:59 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2018-02-10 20:52:23 +02:00
|
|
|
void CPrivilegedInfoCallback::getFreeTiles(std::vector<int3> & tiles) const
|
2011-05-03 06:14:18 +03:00
|
|
|
{
|
2014-04-20 10:13:37 +03:00
|
|
|
std::vector<int> floors;
|
2023-03-13 23:26:44 +02:00
|
|
|
floors.reserve(gs->map->levels());
|
2022-09-18 16:39:10 +02:00
|
|
|
for(int b = 0; b < gs->map->levels(); ++b)
|
2014-04-20 10:13:37 +03:00
|
|
|
{
|
|
|
|
floors.push_back(b);
|
|
|
|
}
|
2023-03-13 23:26:44 +02:00
|
|
|
const TerrainTile * tinfo = nullptr;
|
2014-04-20 10:13:37 +03:00
|
|
|
for (auto zd : floors)
|
|
|
|
{
|
|
|
|
for (int xd = 0; xd < gs->map->width; xd++)
|
|
|
|
{
|
|
|
|
for (int yd = 0; yd < gs->map->height; yd++)
|
|
|
|
{
|
|
|
|
tinfo = getTile(int3 (xd,yd,zd));
|
2022-09-21 11:34:23 +02:00
|
|
|
if (tinfo->terType->isLand() && tinfo->terType->isPassable() && !tinfo->blocked) //land and free
|
2023-03-13 23:26:44 +02:00
|
|
|
tiles.emplace_back(xd, yd, zd);
|
2014-04-20 10:13:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-03 06:14:18 +03:00
|
|
|
}
|
|
|
|
|
2023-04-16 00:48:49 +02:00
|
|
|
void CPrivilegedInfoCallback::getTilesInRange(std::unordered_set<int3> & tiles,
|
2023-03-13 23:26:44 +02:00
|
|
|
const int3 & pos,
|
|
|
|
int radious,
|
2023-04-16 19:42:56 +02:00
|
|
|
std::optional<PlayerColor> player,
|
2023-03-13 23:26:44 +02:00
|
|
|
int mode,
|
|
|
|
int3::EDistanceFormula distanceFormula) const
|
2009-03-14 13:25:25 +02:00
|
|
|
{
|
2013-03-03 20:06:03 +03:00
|
|
|
if(!!player && *player >= PlayerColor::PLAYER_LIMIT)
|
2009-03-14 13:25:25 +02:00
|
|
|
{
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->error("Illegal call to getTilesInRange!");
|
2009-03-14 13:25:25 +02:00
|
|
|
return;
|
|
|
|
}
|
2020-10-02 23:55:46 +02:00
|
|
|
if(radious == CBuilding::HEIGHT_SKYSHIP) //reveal entire map
|
2022-12-30 16:09:09 +02:00
|
|
|
getAllTiles (tiles, player, -1, MapTerrainFilterMode::NONE);
|
2009-11-11 19:45:03 +02:00
|
|
|
else
|
2009-03-14 13:25:25 +02:00
|
|
|
{
|
2013-06-26 14:18:27 +03:00
|
|
|
const TeamState * team = !player ? nullptr : gs->getPlayerTeam(*player);
|
2009-11-11 19:45:03 +02:00
|
|
|
for (int xd = std::max<int>(pos.x - radious , 0); xd <= std::min<int>(pos.x + radious, gs->map->width - 1); xd++)
|
2009-03-14 13:25:25 +02:00
|
|
|
{
|
2009-11-11 19:45:03 +02:00
|
|
|
for (int yd = std::max<int>(pos.y - radious, 0); yd <= std::min<int>(pos.y + radious, gs->map->height - 1); yd++)
|
2009-03-14 13:25:25 +02:00
|
|
|
{
|
2015-12-04 20:08:09 +02:00
|
|
|
int3 tilePos(xd,yd,pos.z);
|
2016-02-10 17:36:56 +02:00
|
|
|
double distance = pos.dist(tilePos, distanceFormula);
|
2015-12-04 20:08:09 +02:00
|
|
|
|
2009-11-11 19:45:03 +02:00
|
|
|
if(distance <= radious)
|
|
|
|
{
|
2013-03-03 20:06:03 +03:00
|
|
|
if(!player
|
2022-09-18 16:39:10 +02:00
|
|
|
|| (mode == 1 && (*team->fogOfWarMap)[pos.z][xd][yd] == 0)
|
|
|
|
|| (mode == -1 && (*team->fogOfWarMap)[pos.z][xd][yd] == 1)
|
2009-11-11 19:45:03 +02:00
|
|
|
)
|
|
|
|
tiles.insert(int3(xd,yd,pos.z));
|
|
|
|
}
|
2009-03-14 13:25:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-16 00:48:49 +02:00
|
|
|
void CPrivilegedInfoCallback::getAllTiles(std::unordered_set<int3> & tiles, std::optional<PlayerColor> Player, int level, MapTerrainFilterMode tileFilterMode) const
|
2009-08-19 09:56:53 +03:00
|
|
|
{
|
2013-03-03 20:06:03 +03:00
|
|
|
if(!!Player && *Player >= PlayerColor::PLAYER_LIMIT)
|
2009-08-19 09:56:53 +03:00
|
|
|
{
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->error("Illegal call to getAllTiles !");
|
2009-08-19 09:56:53 +03:00
|
|
|
return;
|
|
|
|
}
|
2009-08-20 13:30:00 +03:00
|
|
|
|
|
|
|
std::vector<int> floors;
|
|
|
|
if(level == -1)
|
|
|
|
{
|
2022-09-18 16:39:10 +02:00
|
|
|
for(int b = 0; b < gs->map->levels(); ++b)
|
2009-08-20 13:30:00 +03:00
|
|
|
{
|
|
|
|
floors.push_back(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
floors.push_back(level);
|
|
|
|
|
2022-12-30 16:51:13 +02:00
|
|
|
for(auto zd: floors)
|
2009-08-19 09:56:53 +03:00
|
|
|
{
|
2022-12-30 16:51:13 +02:00
|
|
|
for(int xd = 0; xd < gs->map->width; xd++)
|
2009-08-19 09:56:53 +03:00
|
|
|
{
|
2022-12-30 16:51:13 +02:00
|
|
|
for(int yd = 0; yd < gs->map->height; yd++)
|
2009-08-19 09:56:53 +03:00
|
|
|
{
|
2022-12-30 16:51:13 +02:00
|
|
|
bool isTileEligible = false;
|
|
|
|
|
|
|
|
switch(tileFilterMode)
|
|
|
|
{
|
|
|
|
case MapTerrainFilterMode::NONE:
|
|
|
|
isTileEligible = true;
|
|
|
|
break;
|
|
|
|
case MapTerrainFilterMode::WATER:
|
|
|
|
isTileEligible = getTile(int3(xd, yd, zd))->terType->isWater();
|
|
|
|
break;
|
|
|
|
case MapTerrainFilterMode::LAND:
|
|
|
|
isTileEligible = getTile(int3(xd, yd, zd))->terType->isLand();
|
|
|
|
break;
|
|
|
|
case MapTerrainFilterMode::LAND_CARTOGRAPHER:
|
|
|
|
isTileEligible = getTile(int3(xd, yd, zd))->terType->isSurfaceCartographerCompatible();
|
|
|
|
break;
|
|
|
|
case MapTerrainFilterMode::UNDERGROUND_CARTOGRAPHER:
|
|
|
|
isTileEligible = getTile(int3(xd, yd, zd))->terType->isUndergroundCartographerCompatible();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isTileEligible)
|
|
|
|
tiles.insert(int3(xd, yd, zd));
|
2009-08-19 09:56:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
void CPrivilegedInfoCallback::pickAllowedArtsSet(std::vector<const CArtifact *> & out, CRandomGenerator & rand) const
|
2010-06-27 19:03:01 +03:00
|
|
|
{
|
2012-09-06 13:39:48 +03:00
|
|
|
for (int j = 0; j < 3 ; j++)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
out.push_back(VLC->arth->objects[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_TREASURE)]);
|
2012-09-06 13:39:48 +03:00
|
|
|
for (int j = 0; j < 3 ; j++)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
out.push_back(VLC->arth->objects[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_MINOR)]);
|
2012-09-06 13:39:48 +03: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.
2018-03-17 16:58:30 +02:00
|
|
|
out.push_back(VLC->arth->objects[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_MAJOR)]);
|
2009-05-21 03:55:30 +03:00
|
|
|
}
|
2009-07-26 06:33:13 +03:00
|
|
|
|
2023-06-06 17:34:04 +02:00
|
|
|
void CPrivilegedInfoCallback::getAllowedSpells(std::vector<SpellID> & out, std::optional<ui16> level)
|
2009-09-24 20:54:02 +03:00
|
|
|
{
|
2011-12-14 00:23:17 +03:00
|
|
|
for (ui32 i = 0; i < gs->map->allowedSpell.size(); i++) //spellh size appears to be greater (?)
|
2009-09-24 20:54:02 +03: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.
2018-03-17 16:58:30 +02:00
|
|
|
const spells::Spell * spell = SpellID(i).toSpell();
|
2023-06-06 17:34:04 +02:00
|
|
|
|
|
|
|
if (!isAllowed(0, spell->getIndex()))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (level.has_value() && spell->getLevel() != level)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
out.push_back(spell->getId());
|
2009-09-24 20:54:02 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-10 20:52:23 +02:00
|
|
|
CGameState * CPrivilegedInfoCallback::gameState()
|
2014-04-20 10:13:37 +03:00
|
|
|
{
|
|
|
|
return gs;
|
|
|
|
}
|
2013-02-19 01:37:22 +03:00
|
|
|
|
|
|
|
template<typename Loader>
|
2018-02-10 20:52:23 +02:00
|
|
|
void CPrivilegedInfoCallback::loadCommonState(Loader & in)
|
2013-02-19 01:37:22 +03:00
|
|
|
{
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("Loading lib part of game...");
|
2013-02-19 01:37:22 +03:00
|
|
|
in.checkMagicBytes(SAVEGAME_MAGIC);
|
|
|
|
|
|
|
|
CMapHeader dum;
|
2023-03-13 23:26:44 +02:00
|
|
|
StartInfo * si = nullptr;
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tReading header");
|
2016-09-10 02:32:40 +02:00
|
|
|
in.serializer & dum;
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tReading options");
|
2016-09-10 02:32:40 +02:00
|
|
|
in.serializer & si;
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tReading handlers");
|
2016-09-10 02:32:40 +02:00
|
|
|
in.serializer & *VLC;
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tReading gamestate");
|
2016-09-10 02:32:40 +02:00
|
|
|
in.serializer & gs;
|
2013-02-19 01:37:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename Saver>
|
2018-02-10 20:52:23 +02:00
|
|
|
void CPrivilegedInfoCallback::saveCommonState(Saver & out) const
|
2013-02-19 01:37:22 +03:00
|
|
|
{
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("Saving lib part of game...");
|
2013-02-19 01:37:22 +03:00
|
|
|
out.putMagicBytes(SAVEGAME_MAGIC);
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tSaving header");
|
2016-09-10 02:32:40 +02:00
|
|
|
out.serializer & static_cast<CMapHeader&>(*gs->map);
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tSaving options");
|
2016-09-10 02:32:40 +02:00
|
|
|
out.serializer & gs->scenarioOps;
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tSaving handlers");
|
2016-09-10 02:32:40 +02:00
|
|
|
out.serializer & *VLC;
|
2017-08-10 18:39:27 +02:00
|
|
|
logGlobal->info("\tSaving gamestate");
|
2016-09-10 02:32:40 +02:00
|
|
|
out.serializer & gs;
|
2013-02-19 01:37:22 +03:00
|
|
|
}
|
|
|
|
|
2014-04-20 13:10:46 +03:00
|
|
|
// hardly memory usage for `-gdwarf-4` flag
|
2018-02-10 20:52:23 +02:00
|
|
|
template DLL_LINKAGE void CPrivilegedInfoCallback::loadCommonState<CLoadIntegrityValidator>(CLoadIntegrityValidator &);
|
|
|
|
template DLL_LINKAGE void CPrivilegedInfoCallback::loadCommonState<CLoadFile>(CLoadFile &);
|
|
|
|
template DLL_LINKAGE void CPrivilegedInfoCallback::saveCommonState<CSaveFile>(CSaveFile &) const;
|
2013-02-19 01:37:22 +03:00
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
TerrainTile * CNonConstInfoCallback::getTile(const int3 & pos)
|
2009-07-26 06:33:13 +03:00
|
|
|
{
|
|
|
|
if(!gs->map->isInTheMap(pos))
|
2013-06-26 14:18:27 +03:00
|
|
|
return nullptr;
|
2009-07-26 06:33:13 +03:00
|
|
|
return &gs->map->getTile(pos);
|
2010-02-10 04:56:00 +02:00
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
CGHeroInstance * CNonConstInfoCallback::getHero(const ObjectInstanceID & objid)
|
2011-05-10 01:20:47 +03:00
|
|
|
{
|
|
|
|
return const_cast<CGHeroInstance*>(CGameInfoCallback::getHero(objid));
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
CGTownInstance * CNonConstInfoCallback::getTown(const ObjectInstanceID & objid)
|
2011-05-10 01:20:47 +03:00
|
|
|
{
|
|
|
|
return const_cast<CGTownInstance*>(CGameInfoCallback::getTown(objid));
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
TeamState * CNonConstInfoCallback::getTeam(const TeamID & teamID)
|
2011-05-10 01:20:47 +03:00
|
|
|
{
|
|
|
|
return const_cast<TeamState*>(CGameInfoCallback::getTeam(teamID));
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
TeamState * CNonConstInfoCallback::getPlayerTeam(const PlayerColor & color)
|
2011-05-10 01:20:47 +03:00
|
|
|
{
|
|
|
|
return const_cast<TeamState*>(CGameInfoCallback::getPlayerTeam(color));
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
PlayerState * CNonConstInfoCallback::getPlayerState(const PlayerColor & color, bool verbose)
|
2011-05-10 01:20:47 +03: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.
2018-03-17 16:58:30 +02:00
|
|
|
return const_cast<PlayerState*>(CGameInfoCallback::getPlayerState(color, verbose));
|
2011-05-10 01:20:47 +03:00
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
CArtifactInstance * CNonConstInfoCallback::getArtInstance(const ArtifactInstanceID & aid)
|
2013-02-14 02:55:42 +03:00
|
|
|
{
|
2018-03-10 23:19:36 +02:00
|
|
|
return gs->map->artInstances.at(aid.num);
|
2013-02-14 02:55:42 +03:00
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
CGObjectInstance * CNonConstInfoCallback::getObjInstance(const ObjectInstanceID & oid)
|
2013-02-14 02:55:42 +03:00
|
|
|
{
|
2018-03-10 23:19:36 +02:00
|
|
|
return gs->map->objects.at(oid.num);
|
|
|
|
}
|
|
|
|
|
2023-03-13 23:26:44 +02:00
|
|
|
CArmedInstance * CNonConstInfoCallback::getArmyInstance(const ObjectInstanceID & oid)
|
2018-03-10 23:19:36 +02:00
|
|
|
{
|
|
|
|
return dynamic_cast<CArmedInstance *>(getObjInstance(oid));
|
2013-02-14 02:55:42 +03:00
|
|
|
}
|
|
|
|
|
2013-05-28 00:46:04 +03:00
|
|
|
bool IGameCallback::isVisitCoveredByAnotherQuery(const CGObjectInstance *obj, const CGHeroInstance *hero)
|
|
|
|
{
|
|
|
|
//only server knows
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
logGlobal->error("isVisitCoveredByAnotherQuery call on client side");
|
2013-05-28 00:46:04 +03:00
|
|
|
return false;
|
|
|
|
}
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|