diff --git a/binaries/data/mods/public/simulation/components/Auras.js b/binaries/data/mods/public/simulation/components/Auras.js
index ce451ee66a..f38779272a 100644
--- a/binaries/data/mods/public/simulation/components/Auras.js
+++ b/binaries/data/mods/public/simulation/components/Auras.js
@@ -8,14 +8,14 @@ Auras.prototype.Schema =
Auras.prototype.Init = function()
{
- let cmpTechnologyTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
+ let cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
this.auras = {};
this.affectedPlayers = {};
let auraNames = this.GetAuraNames();
for (let name of auraNames)
{
this.affectedPlayers[name] = [];
- this.auras[name] = cmpTechnologyTemplateManager.GetAuraTemplate(name);
+ this.auras[name] = cmpDataTemplateManager.GetAuraTemplate(name);
}
// In case of autogarrisoning, this component can be called before ownership is set.
// So it needs to be completely initialised from the start.
diff --git a/binaries/data/mods/public/simulation/components/TechnologyTemplateManager.js b/binaries/data/mods/public/simulation/components/DataTemplateManager.js
similarity index 55%
rename from binaries/data/mods/public/simulation/components/TechnologyTemplateManager.js
rename to binaries/data/mods/public/simulation/components/DataTemplateManager.js
index 088abad619..7874a5d07b 100644
--- a/binaries/data/mods/public/simulation/components/TechnologyTemplateManager.js
+++ b/binaries/data/mods/public/simulation/components/DataTemplateManager.js
@@ -1,21 +1,28 @@
/**
* System component which loads the technology and the aura data files
*/
-function TechnologyTemplateManager() {}
+function DataTemplateManager() {}
-TechnologyTemplateManager.prototype.Schema =
+DataTemplateManager.prototype.Schema =
"";
-TechnologyTemplateManager.prototype.Init = function()
+DataTemplateManager.prototype.Init = function()
{
this.allTechs = {};
this.allAuras = {};
var techNames = this.ListAllTechs();
for (var i in techNames)
- this.GetTemplate(techNames[i]);
+ this.GetTechnologyTemplate(techNames[i]);
};
-TechnologyTemplateManager.prototype.GetTemplate = function(template)
+DataTemplateManager.prototype.Serialize = null; // we have no dynamic state to save
+
+DataTemplateManager.prototype.Deserialize = function()
+{
+ this.Init();
+};
+
+DataTemplateManager.prototype.GetTechnologyTemplate = function(template)
{
if (!this.allTechs[template])
{
@@ -27,7 +34,7 @@ TechnologyTemplateManager.prototype.GetTemplate = function(template)
return this.allTechs[template];
};
-TechnologyTemplateManager.prototype.GetAuraTemplate = function(template)
+DataTemplateManager.prototype.GetAuraTemplate = function(template)
{
if (!this.allAuras[template])
{
@@ -39,14 +46,14 @@ TechnologyTemplateManager.prototype.GetAuraTemplate = function(template)
return this.allAuras[template];
};
-TechnologyTemplateManager.prototype.ListAllTechs = function()
+DataTemplateManager.prototype.ListAllTechs = function()
{
return Engine.FindJSONFiles("technologies", true);
};
-TechnologyTemplateManager.prototype.GetAllTechs = function()
+DataTemplateManager.prototype.GetAllTechs = function()
{
return this.allTechs;
};
-Engine.RegisterSystemComponentType(IID_TechnologyTemplateManager, "TechnologyTemplateManager", TechnologyTemplateManager);
+Engine.RegisterSystemComponentType(IID_DataTemplateManager, "DataTemplateManager", DataTemplateManager);
diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js
index 97e77a7593..e4b73009ed 100644
--- a/binaries/data/mods/public/simulation/components/GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -591,13 +591,13 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
// Add aura name and description loaded from JSON file
let auraNames = template.Auras._string.split(/\s+/);
- let cmpTechnologyTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
+ let cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
for (let name of auraNames)
{
- let auraTemplate = cmpTechnologyTemplateManager.GetAuraTemplate(name);
+ let auraTemplate = cmpDataTemplateManager.GetAuraTemplate(name);
if (!auraTemplate)
{
- // the following warning is perhaps useless since it's yet done in TechnologyTemplateManager
+ // the following warning is perhaps useless since it's yet done in DataTemplateManager
warn("Tried to get data for invalid aura: " + name);
continue;
}
@@ -610,8 +610,8 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName)
GuiInterface.prototype.GetTechnologyData = function(player, name)
{
- let cmpTechnologyTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
- let template = cmpTechnologyTemplateManager.GetTemplate(name);
+ let cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
+ let template = cmpDataTemplateManager.GetTechnologyTemplate(name);
if (!template)
{
diff --git a/binaries/data/mods/public/simulation/components/ProductionQueue.js b/binaries/data/mods/public/simulation/components/ProductionQueue.js
index 9fa6c42c97..82d0602738 100644
--- a/binaries/data/mods/public/simulation/components/ProductionQueue.js
+++ b/binaries/data/mods/public/simulation/components/ProductionQueue.js
@@ -316,8 +316,8 @@ ProductionQueue.prototype.AddBatch = function(templateName, type, count, metadat
else if (type == "technology")
{
// Load the technology template
- var cmpTechnologyTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
- var template = cmpTechnologyTemplateManager.GetTemplate(templateName);
+ var cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
+ var template = cmpDataTemplateManager.GetTechnologyTemplate(templateName);
if (!template)
return;
var cmpPlayer = QueryOwnerInterface(this.entity);
diff --git a/binaries/data/mods/public/simulation/components/TechnologyManager.js b/binaries/data/mods/public/simulation/components/TechnologyManager.js
index f7bf93a493..31a466ea5c 100644
--- a/binaries/data/mods/public/simulation/components/TechnologyManager.js
+++ b/binaries/data/mods/public/simulation/components/TechnologyManager.js
@@ -41,7 +41,7 @@ TechnologyManager.prototype.Init = function()
// Some technologies are automatically researched when their conditions are met. They have no cost and are
// researched instantly. This allows civ bonuses and more complicated technologies.
this.autoResearchTech = {};
- var allTechs = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager).GetAllTechs();
+ var allTechs = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager).GetAllTechs();
for (var key in allTechs)
{
if (allTechs[key].autoResearch || allTechs[key].top)
@@ -58,10 +58,10 @@ TechnologyManager.prototype.OnUpdate = function()
// This function checks if the requirements of any autoresearch techs are met and if they are it researches them
TechnologyManager.prototype.UpdateAutoResearch = function()
{
- var cmpTechTempMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
+ var cmpDataTempMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
for (var key in this.autoResearchTech)
{
- var tech = cmpTechTempMan.GetTemplate(key);
+ var tech = cmpDataTempMan.GetTechnologyTemplate(key);
if ((tech.autoResearch && this.CanResearch(key))
|| (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom))))
{
@@ -74,7 +74,7 @@ TechnologyManager.prototype.UpdateAutoResearch = function()
TechnologyManager.prototype.GetTechnologyTemplate = function(tech)
{
- return Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager).GetTemplate(tech);
+ return Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager).GetTechnologyTemplate(tech);
};
// Checks an entity template to see if its technology requirements have been met
diff --git a/binaries/data/mods/public/simulation/components/tests/test_Auras.js b/binaries/data/mods/public/simulation/components/tests/test_Auras.js
index 53ee771ef4..38df448ef1 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_Auras.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_Auras.js
@@ -25,7 +25,7 @@ AddMock(SYSTEM_ENTITY, IID_RangeManager, {
GetEntityFlagMask: function(identifier) { },
});
-AddMock(SYSTEM_ENTITY, IID_TechnologyTemplateManager, {
+AddMock(SYSTEM_ENTITY, IID_DataTemplateManager, {
GetAuraTemplate: function(name) {
if (name == "test1")
return {
diff --git a/binaries/data/mods/public/simulation/helpers/Cheat.js b/binaries/data/mods/public/simulation/helpers/Cheat.js
index c7df04399a..f3164db5e3 100644
--- a/binaries/data/mods/public/simulation/helpers/Cheat.js
+++ b/binaries/data/mods/public/simulation/helpers/Cheat.js
@@ -90,8 +90,8 @@ function Cheat(input)
return;
// check if specialised tech exists (like phase_town_athen)
- var cmpTechnologyTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TechnologyTemplateManager);
- if (cmpTechnologyTemplateManager.ListAllTechs().indexOf(parameter + "_" + cmpPlayer.civ) > -1)
+ var cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
+ if (cmpDataTemplateManager.ListAllTechs().indexOf(parameter + "_" + cmpPlayer.civ) > -1)
parameter += "_" + cmpPlayer.civ;
Cheat({ "player": input.player, "action": "researchTechnology", "parameter": parameter, "selected": input.selected });
diff --git a/source/simulation2/TypeList.h b/source/simulation2/TypeList.h
index e0d9c6ad88..5f7a6145c6 100644
--- a/source/simulation2/TypeList.h
+++ b/source/simulation2/TypeList.h
@@ -160,8 +160,8 @@ COMPONENT(SoundManager)
INTERFACE(ValueModificationManager)
COMPONENT(ValueModificationManagerScripted)
-INTERFACE(TechnologyTemplateManager)
-COMPONENT(TechnologyTemplateManagerScripted)
+INTERFACE(DataTemplateManager)
+COMPONENT(DataTemplateManagerScripted)
INTERFACE(Terrain)
COMPONENT(Terrain)
diff --git a/source/simulation2/components/CCmpAIManager.cpp b/source/simulation2/components/CCmpAIManager.cpp
index 1fd9e454ed..69e0f7a43c 100644
--- a/source/simulation2/components/CCmpAIManager.cpp
+++ b/source/simulation2/components/CCmpAIManager.cpp
@@ -34,7 +34,7 @@
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpRangeManager.h"
#include "simulation2/components/ICmpTemplateManager.h"
-#include "simulation2/components/ICmpTechnologyTemplateManager.h"
+#include "simulation2/components/ICmpDataTemplateManager.h"
#include "simulation2/components/ICmpTerritoryManager.h"
#include "simulation2/helpers/LongPathfinder.h"
#include "simulation2/serialization/DebugSerializer.h"
@@ -979,12 +979,12 @@ public:
JSAutoRequest rq(cx);
// load the technology templates
- CmpPtr cmpTechTemplateManager(GetSystemEntity());
- ENSURE(cmpTechTemplateManager);
+ CmpPtr cmpDataTemplateManager(GetSystemEntity());
+ ENSURE(cmpDataTemplateManager);
// Get the game state from AIInterface
JS::RootedValue techTemplates(cx);
- cmpTechTemplateManager->GetAllTechs(&techTemplates);
+ cmpDataTemplateManager->GetAllTechs(&techTemplates);
m_Worker.RegisterTechTemplates(scriptInterface.WriteStructuredClone(techTemplates));
m_Worker.TryLoadSharedComponent(true);
diff --git a/source/simulation2/components/ICmpTechnologyTemplateManager.cpp b/source/simulation2/components/ICmpDataTemplateManager.cpp
similarity index 72%
rename from source/simulation2/components/ICmpTechnologyTemplateManager.cpp
rename to source/simulation2/components/ICmpDataTemplateManager.cpp
index fa8349b9c2..6cf765e378 100644
--- a/source/simulation2/components/ICmpTechnologyTemplateManager.cpp
+++ b/source/simulation2/components/ICmpDataTemplateManager.cpp
@@ -17,18 +17,18 @@
#include "precompiled.h"
-#include "ICmpTechnologyTemplateManager.h"
+#include "ICmpDataTemplateManager.h"
#include "simulation2/system/InterfaceScripted.h"
#include "simulation2/scripting/ScriptComponent.h"
-BEGIN_INTERFACE_WRAPPER(TechnologyTemplateManager)
-END_INTERFACE_WRAPPER(TechnologyTemplateManager)
+BEGIN_INTERFACE_WRAPPER(DataTemplateManager)
+END_INTERFACE_WRAPPER(DataTemplateManager)
-class CCmpTechnologyTemplateManagerScripted : public ICmpTechnologyTemplateManager
+class CCmpDataTemplateManagerScripted : public ICmpDataTemplateManager
{
public:
- DEFAULT_SCRIPT_WRAPPER(TechnologyTemplateManagerScripted)
+ DEFAULT_SCRIPT_WRAPPER(DataTemplateManagerScripted)
virtual void GetAllTechs(JS::MutableHandleValue ret)
{
@@ -36,4 +36,4 @@ public:
}
};
-REGISTER_COMPONENT_SCRIPT_WRAPPER(TechnologyTemplateManagerScripted)
+REGISTER_COMPONENT_SCRIPT_WRAPPER(DataTemplateManagerScripted)
diff --git a/source/simulation2/components/ICmpTechnologyTemplateManager.h b/source/simulation2/components/ICmpDataTemplateManager.h
similarity index 72%
rename from source/simulation2/components/ICmpTechnologyTemplateManager.h
rename to source/simulation2/components/ICmpDataTemplateManager.h
index a18ac9b98d..e6b34298c8 100644
--- a/source/simulation2/components/ICmpTechnologyTemplateManager.h
+++ b/source/simulation2/components/ICmpDataTemplateManager.h
@@ -15,24 +15,24 @@
* along with 0 A.D. If not, see .
*/
-#ifndef INCLUDED_ICMPTECHNOLOGYTEMPLATEMANAGER
-#define INCLUDED_ICMPTECHNOLOGYTEMPLATEMANAGER
+#ifndef INCLUDED_ICMPDATATEMPLATEMANAGER
+#define INCLUDED_ICMPDATATEMPLATEMANAGER
#include "simulation2/system/Interface.h"
#include "maths/Fixed.h"
/**
- * Technology template manager interface.
+ * Data template manager interface.
* (This interface only includes the functions needed by native code for accessing
- * technology template data, the associated logic is handled in scripts)
+ * json template data, the associated logic is handled in scripts)
*/
-class ICmpTechnologyTemplateManager : public IComponent
+class ICmpDataTemplateManager : public IComponent
{
public:
virtual void GetAllTechs(JS::MutableHandleValue ret) = 0;
- DECLARE_INTERFACE_TYPE(TechnologyTemplateManager)
+ DECLARE_INTERFACE_TYPE(DataTemplateManager)
};
-#endif // INCLUDED_ICMPTECHNOLOGYTEMPLATEMANAGER
+#endif // INCLUDED_ICMPDATATEMPLATEMANAGER