2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CGameInfo.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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CGameInfo.h"
|
|
|
|
|
|
|
|
#include "../lib/VCMI_Lib.h"
|
2009-04-15 17:03:31 +03:00
|
|
|
|
2018-01-05 19:21:07 +02:00
|
|
|
const CGameInfo * CGI;
|
2014-03-08 19:05:23 +03:00
|
|
|
CClientState * CCS = nullptr;
|
2018-01-05 19:21:07 +02:00
|
|
|
CServerHandler * CSH;
|
|
|
|
|
2009-01-11 00:08:18 +02:00
|
|
|
|
|
|
|
CGameInfo::CGameInfo()
|
|
|
|
{
|
2016-11-27 16:48:18 +02:00
|
|
|
generaltexth = nullptr;
|
2013-06-26 14:18:27 +03:00
|
|
|
mh = nullptr;
|
2016-11-27 16:48:18 +02:00
|
|
|
townh = nullptr;
|
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
|
|
|
globalServices = nullptr;
|
2009-01-11 00:08:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameInfo::setFromLib()
|
|
|
|
{
|
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
|
|
|
globalServices = VLC;
|
2012-08-10 16:07:53 +03:00
|
|
|
modh = VLC->modh;
|
2009-01-11 00:08:18 +02:00
|
|
|
generaltexth = VLC->generaltexth;
|
|
|
|
creh = VLC->creh;
|
|
|
|
townh = VLC->townh;
|
|
|
|
heroh = VLC->heroh;
|
|
|
|
objh = VLC->objh;
|
|
|
|
spellh = VLC->spellh;
|
2017-08-25 03:35:02 +02:00
|
|
|
skillh = VLC->skillh;
|
2014-05-16 23:50:02 +03:00
|
|
|
objtypeh = VLC->objtypeh;
|
2022-06-28 10:05:30 +02:00
|
|
|
battleFieldHandler = VLC->battlefieldsHandler;
|
2022-09-15 10:06:54 +02:00
|
|
|
obstacleHandler = VLC->obstacleHandler;
|
2014-03-08 19:05:23 +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 ArtifactService * CGameInfo::artifacts() const
|
|
|
|
{
|
|
|
|
return globalServices->artifacts();
|
|
|
|
}
|
|
|
|
|
2022-06-28 10:05:30 +02:00
|
|
|
const BattleFieldService * CGameInfo::battlefields() const
|
|
|
|
{
|
|
|
|
return globalServices->battlefields();
|
|
|
|
}
|
|
|
|
|
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 CreatureService * CGameInfo::creatures() const
|
|
|
|
{
|
|
|
|
return globalServices->creatures();
|
|
|
|
}
|
|
|
|
|
|
|
|
const FactionService * CGameInfo::factions() const
|
|
|
|
{
|
|
|
|
return globalServices->factions();
|
|
|
|
}
|
|
|
|
|
|
|
|
const HeroClassService * CGameInfo::heroClasses() const
|
|
|
|
{
|
|
|
|
return globalServices->heroClasses();
|
|
|
|
}
|
|
|
|
|
|
|
|
const HeroTypeService * CGameInfo::heroTypes() const
|
|
|
|
{
|
|
|
|
return globalServices->heroTypes();
|
|
|
|
}
|
|
|
|
|
2022-09-21 18:31:14 +02:00
|
|
|
#if SCRIPTING_ENABLED
|
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 scripting::Service * CGameInfo::scripts() const
|
|
|
|
{
|
|
|
|
return globalServices->scripts();
|
|
|
|
}
|
2022-09-21 18:31:14 +02:00
|
|
|
#endif
|
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::Service * CGameInfo::spells() const
|
|
|
|
{
|
|
|
|
return globalServices->spells();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkillService * CGameInfo::skills() const
|
|
|
|
{
|
|
|
|
return globalServices->skills();
|
|
|
|
}
|
|
|
|
|
2022-09-15 10:06:54 +02:00
|
|
|
const ObstacleService * CGameInfo::obstacles() const
|
|
|
|
{
|
|
|
|
return globalServices->obstacles();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void CGameInfo::updateEntity(Metatype metatype, int32_t index, const JsonNode & data)
|
|
|
|
{
|
|
|
|
logGlobal->error("CGameInfo::updateEntity call is not expected.");
|
|
|
|
}
|
|
|
|
|
|
|
|
spells::effects::Registry * CGameInfo::spellEffects()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const spells::effects::Registry * CGameInfo::spellEffects() const
|
|
|
|
{
|
|
|
|
return globalServices->spellEffects();
|
|
|
|
}
|