diff --git a/binaries/data/mods/public/globalscripts/Templates.js b/binaries/data/mods/public/globalscripts/Templates.js
index 061811f2aa..c6c560393e 100644
--- a/binaries/data/mods/public/globalscripts/Templates.js
+++ b/binaries/data/mods/public/globalscripts/Templates.js
@@ -7,7 +7,7 @@
function loadCivFiles(selectableOnly)
{
let propertyNames = [
- "Code", "Culture", "Name", "Emblem", "History", "Music", "CivBonuses", "StartEntities",
+ "Code", "Culture", "Music", "CivBonuses", "StartEntities",
"Formations", "AINames", "SkirmishReplacements", "SelectableInGameSetup"];
let civData = {};
@@ -20,8 +20,15 @@ function loadCivFiles(selectableOnly)
if (data[prop] === undefined)
throw new Error(filename + " doesn't contain " + prop);
- if (!selectableOnly || data.SelectableInGameSetup)
- civData[data.Code] = data;
+ if (selectableOnly && !data.SelectableInGameSetup)
+ continue;
+
+ const template = Engine.GetTemplate("special/players/" + data.Code);
+ data.Name = template.Identity.GenericName;
+ data.Emblem = template.Identity.Icon;
+ data.History = template.Identity.History;
+
+ civData[data.Code] = data;
}
return civData;
diff --git a/binaries/data/mods/public/gui/reference/common/TemplateLoader.js b/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
index 8becc17f22..a24e6e3674 100644
--- a/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
+++ b/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
@@ -222,11 +222,13 @@ class TemplateLoader
*/
buildPlayerTemplateName(civCode)
{
- let templateName = this.PlayerPath + this.PlayerTemplatePrefix + civCode;
+ let templateName = this.PlayerPath + civCode;
if (Engine.TemplateExists(templateName))
return templateName;
- return this.PlayerPath + this.PlayerTemplateFallback;
+ warn("No template found for civ " + civCode + ".");
+
+ return this.PlayerPath + this.DefaultCiv;
}
/**
@@ -321,17 +323,11 @@ class TemplateLoader
* It might be nice if we could get these from somewhere, instead of having them hardcoded here.
*/
TemplateLoader.prototype.AuraPath = "simulation/data/auras/";
-TemplateLoader.prototype.PlayerPath = "special/player/";
+TemplateLoader.prototype.PlayerPath = "special/players/";
TemplateLoader.prototype.TechnologyPath = "simulation/data/technologies/";
TemplateLoader.prototype.DefaultCiv = "gaia";
-/**
- * Expected prefix for player templates, and the file to use if a civ doesn't have its own.
- */
-TemplateLoader.prototype.PlayerTemplatePrefix = "player_";
-TemplateLoader.prototype.PlayerTemplateFallback = "player";
-
/**
* Keys of template values that are to be translated on load.
*/
diff --git a/binaries/data/mods/public/l10n/messages.json b/binaries/data/mods/public/l10n/messages.json
index df2440c612..89fd5158f3 100644
--- a/binaries/data/mods/public/l10n/messages.json
+++ b/binaries/data/mods/public/l10n/messages.json
@@ -12,13 +12,22 @@
],
"options": {
"keywords": [
- "Name",
- "Description",
- "History",
"Special",
"AINames"
]
}
+ },
+ {
+ "extractor": "xml",
+ "filemasks": [
+ "simulation/templates/special/players/**.xml"
+ ],
+ "options": {
+ "keywords": [
+ "GenericName": {},
+ "History": {}
+ ]
+ }
}
]
},
diff --git a/binaries/data/mods/public/maps/random/tests/test_Constraint.js b/binaries/data/mods/public/maps/random/tests/test_Constraint.js
index 5c1548eb75..8b30e956b3 100644
--- a/binaries/data/mods/public/maps/random/tests/test_Constraint.js
+++ b/binaries/data/mods/public/maps/random/tests/test_Constraint.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
var g_MapSettings = { "Size": 512 };
diff --git a/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js b/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js
index 90c9e585b9..b15292b96c 100644
--- a/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js
+++ b/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
{
diff --git a/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js b/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js
index bc928af3b5..ee5042b525 100644
--- a/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js
+++ b/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
var g_MapSettings = { "Size": 512 };
diff --git a/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js b/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js
index 5028d2a7f4..79e5b51211 100644
--- a/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js
+++ b/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
var g_MapSettings = { "Size": 512 };
diff --git a/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js b/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js
index 98e7cae613..36b98dcf4a 100644
--- a/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js
+++ b/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
var g_MapSettings = { "Size": 512 };
diff --git a/binaries/data/mods/public/maps/random/tests/test_TileClass.js b/binaries/data/mods/public/maps/random/tests/test_TileClass.js
index c7542387a5..61ccd0bcd5 100644
--- a/binaries/data/mods/public/maps/random/tests/test_TileClass.js
+++ b/binaries/data/mods/public/maps/random/tests/test_TileClass.js
@@ -1,3 +1,13 @@
+Engine.GetTemplate = (path) => {
+ return {
+ "Identity": {
+ "GenericName": null,
+ "Icon": null,
+ "History": null
+ }
+ };
+};
+
Engine.LoadLibrary("rmgen");
var g_MapSettings = { "Size": 512 };
diff --git a/binaries/data/mods/public/simulation/components/Builder.js b/binaries/data/mods/public/simulation/components/Builder.js
index 6245ab76f9..7d29f4c6d8 100644
--- a/binaries/data/mods/public/simulation/components/Builder.js
+++ b/binaries/data/mods/public/simulation/components/Builder.js
@@ -43,7 +43,7 @@ Builder.prototype.GetEntitiesList = function()
if (cmpIdentity)
string = string.replace(/\{native\}/g, cmpIdentity.GetCiv());
- let entities = string.replace(/\{civ\}/g, cmpPlayer.GetCiv()).split(/\s+/);
+ const entities = string.replace(/\{civ\}/g, QueryOwnerInterface(this.entity, IID_Identity).GetCiv()).split(/\s+/);
let disabledTemplates = cmpPlayer.GetDisabledTemplates();
diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js
index 7652dc369d..8baa502fbd 100644
--- a/binaries/data/mods/public/simulation/components/GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -62,12 +62,14 @@ GuiInterface.prototype.GetSimulationState = function()
let numPlayers = cmpPlayerManager.GetNumPlayers();
for (let i = 0; i < numPlayers; ++i)
{
- let cmpPlayer = QueryPlayerIDInterface(i);
- let cmpPlayerEntityLimits = QueryPlayerIDInterface(i, IID_EntityLimits);
+ const playerEnt = cmpPlayerManager.GetPlayerByID(i);
+ const cmpPlayer = Engine.QueryInterface(playerEnt, IID_Player);
+ const cmpPlayerEntityLimits = Engine.QueryInterface(playerEnt, IID_EntityLimits);
+ const cmpIdentity = Engine.QueryInterface(playerEnt, IID_Identity);
// Work out which phase we are in.
let phase = "";
- let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
+ const cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager);
if (cmpTechnologyManager)
{
if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
@@ -92,8 +94,8 @@ GuiInterface.prototype.GetSimulationState = function()
}
ret.players.push({
- "name": cmpPlayer.GetName(),
- "civ": cmpPlayer.GetCiv(),
+ "name": cmpIdentity.GetName(),
+ "civ": cmpIdentity.GetCiv(),
"color": cmpPlayer.GetColor(),
"controlsAll": cmpPlayer.CanControlAllUnits(),
"popCount": cmpPlayer.GetPopulationCount(),
diff --git a/binaries/data/mods/public/simulation/components/Identity.js b/binaries/data/mods/public/simulation/components/Identity.js
index c7400990de..22758e1f75 100644
--- a/binaries/data/mods/public/simulation/components/Identity.js
+++ b/binaries/data/mods/public/simulation/components/Identity.js
@@ -181,6 +181,22 @@ Identity.prototype.SetPhenotype = function(phenotype)
this.phenotype = phenotype;
};
+/**
+ * @param {string} newName -
+ */
+Identity.prototype.SetName = function(newName)
+{
+ this.name = newName;
+};
+
+/**
+ * @return {string} -
+ */
+Identity.prototype.GetName = function()
+{
+ return this.name || this.template.GenericName;
+};
+
function IdentityMirage() {}
IdentityMirage.prototype.Init = function(cmpIdentity)
{
diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js
index 56e359bae4..3683d9aa6c 100644
--- a/binaries/data/mods/public/simulation/components/Player.js
+++ b/binaries/data/mods/public/simulation/components/Player.js
@@ -50,8 +50,6 @@ var panelEntityClasses = "Hero Relic";
Player.prototype.Init = function()
{
this.playerID = undefined;
- this.name = undefined; // Define defaults elsewhere (supporting other languages).
- this.civ = undefined;
this.color = undefined;
this.diplomacyColor = undefined;
this.displayDiplomacyColor = false;
@@ -112,34 +110,6 @@ Player.prototype.GetPlayerID = function()
return this.playerID;
};
-Player.prototype.SetName = function(name)
-{
- this.name = name;
-};
-
-Player.prototype.GetName = function()
-{
- return this.name;
-};
-
-Player.prototype.SetCiv = function(civcode)
-{
- let oldCiv = this.civ;
- this.civ = civcode;
- // Normally, the civ is only set once. But in Atlas, map designers can change civs at any time.
- if (oldCiv && this.playerID && oldCiv != civcode)
- Engine.BroadcastMessage(MT_CivChanged, {
- "player": this.playerID,
- "from": oldCiv,
- "to": civcode
- });
-};
-
-Player.prototype.GetCiv = function()
-{
- return this.civ;
-};
-
Player.prototype.SetColor = function(r, g, b)
{
let colorInitialized = !!this.color;
@@ -773,9 +743,10 @@ Player.prototype.OnGlobalInitGame = function(msg)
// Replace the "{civ}" code with this civ ID.
let disabledTemplates = this.disabledTemplates;
this.disabledTemplates = {};
+ const civ = Engine.QueryInterface(this.entity, IID_Identity).GetCiv();
for (let template in disabledTemplates)
if (disabledTemplates[template])
- this.disabledTemplates[template.replace(/\{civ\}/g, this.civ)] = true;
+ this.disabledTemplates[template.replace(/\{civ\}/g, civ)] = true;
};
/**
diff --git a/binaries/data/mods/public/simulation/components/Researcher.js b/binaries/data/mods/public/simulation/components/Researcher.js
index b7af1f10a6..1f95471d63 100644
--- a/binaries/data/mods/public/simulation/components/Researcher.js
+++ b/binaries/data/mods/public/simulation/components/Researcher.js
@@ -180,18 +180,26 @@ Researcher.prototype.GetTechnologiesList = function()
if (!string)
return [];
- const cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager);
+ const owner = Engine.QueryInterface(this.entity, IID_Ownership)?.GetOwner();
+ if (!owner || owner === INVALID_PLAYER)
+ return [];
+
+ const playerEnt = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetPlayerByID(owner);
+ if (!playerEnt)
+ return [];
+
+ const cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager);
if (!cmpTechnologyManager)
return [];
- const cmpPlayer = QueryOwnerInterface(this.entity);
+ const cmpPlayer = Engine.QueryInterface(playerEnt, IID_Player);
if (!cmpPlayer)
return [];
- const civ = cmpPlayer.GetCiv();
let techs = string.split(/\s+/);
// Replace the civ specific technologies.
+ const civ = Engine.QueryInterface(playerEnt, IID_Identity).GetCiv();
for (let i = 0; i < techs.length; ++i)
{
const tech = techs[i];
diff --git a/binaries/data/mods/public/simulation/components/SkirmishReplacer.js b/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
index 0b661afe90..f33ebb9f13 100644
--- a/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
+++ b/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
@@ -28,11 +28,10 @@ SkirmishReplacer.prototype.OnOwnershipChanged = function(msg)
SkirmishReplacer.prototype.ReplaceEntities = function()
{
- var cmpPlayer = QueryOwnerInterface(this.entity);
- if (!cmpPlayer)
+ const civ = QueryOwnerInterface(this.entity, IID_Identity)?.GetCiv();
+ if (!civ)
return;
- var civ = cmpPlayer.GetCiv();
var replacementEntities = getReplacementEntities(civ);
var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
diff --git a/binaries/data/mods/public/simulation/components/TechnologyManager.js b/binaries/data/mods/public/simulation/components/TechnologyManager.js
index 7891a5712c..fa231570d8 100644
--- a/binaries/data/mods/public/simulation/components/TechnologyManager.js
+++ b/binaries/data/mods/public/simulation/components/TechnologyManager.js
@@ -316,7 +316,7 @@ TechnologyManager.prototype.CanResearch = function(tech)
if (this.IsTechnologyResearched(tech))
return false;
- return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Player).GetCiv()));
+ return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Identity).GetCiv()));
};
/**
diff --git a/binaries/data/mods/public/simulation/components/Trainer.js b/binaries/data/mods/public/simulation/components/Trainer.js
index e129c15d72..bc6ba56e33 100644
--- a/binaries/data/mods/public/simulation/components/Trainer.js
+++ b/binaries/data/mods/public/simulation/components/Trainer.js
@@ -513,7 +513,7 @@ Trainer.prototype.CalculateEntitiesMap = function()
toks.push(tok);
const nativeCiv = Engine.QueryInterface(this.entity, IID_Identity)?.GetCiv();
- const playerCiv = cmpPlayer?.GetCiv();
+ const playerCiv = QueryOwnerInterface(this.entity, IID_Identity)?.GetCiv();
const addedDict = addedTokens.reduce((out, token) => { out[token] = true; return out; }, {});
this.entitiesMap = toks.reduce((entMap, token) => {
diff --git a/binaries/data/mods/public/simulation/components/tests/test_Builder.js b/binaries/data/mods/public/simulation/components/tests/test_Builder.js
index 0da3ed5b52..f9033c5c13 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_Builder.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_Builder.js
@@ -40,11 +40,14 @@ function testEntitiesList()
});
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({}),
"GetPlayerID": () => playerId
});
+ AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+ });
+
AddMock(builderId, IID_Ownership, {
"GetOwner": () => playerId
});
@@ -66,7 +69,6 @@ function testEntitiesList()
});
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({ "structures/athen/barracks": true }),
"GetPlayerID": () => playerId
});
@@ -74,7 +76,6 @@ function testEntitiesList()
TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetEntitiesList(), ["structures/iber/barracks", "structures/iber/civil_centre", "structures/iber/house"]);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({ "structures/iber/barracks": true }),
"GetPlayerID": () => playerId
});
@@ -82,11 +83,14 @@ function testEntitiesList()
TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetEntitiesList(), ["structures/iber/civil_centre", "structures/iber/house"]);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "athen",
"GetDisabledTemplates": () => ({ "structures/athen/barracks": true }),
"GetPlayerID": () => playerId
});
+ AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "athen",
+ });
+
TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetEntitiesList(), ["structures/athen/civil_centre", "structures/iber/house"]);
TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetRange(), { "max": 2, "min": 0 });
diff --git a/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js b/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
index 332cfc9a47..68d529ae79 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
@@ -100,8 +100,6 @@ AddMock(SYSTEM_ENTITY, IID_Timer, {
});
AddMock(100, IID_Player, {
- "GetName": function() { return "Player 1"; },
- "GetCiv": function() { return "gaia"; },
"GetColor": function() { return { "r": 1, "g": 1, "b": 1, "a": 1 }; },
"CanControlAllUnits": function() { return false; },
"GetPopulationCount": function() { return 10; },
@@ -128,6 +126,11 @@ AddMock(100, IID_Player, {
"HasSharedLos": function() { return false; }
});
+AddMock(100, IID_Identity, {
+ "GetName": function() { return "Player 1"; },
+ "GetCiv": function() { return "gaia"; },
+});
+
AddMock(100, IID_EntityLimits, {
"GetLimits": function() { return { "Foo": 10 }; },
"GetCounts": function() { return { "Foo": 5 }; },
@@ -188,8 +191,6 @@ AddMock(100, IID_StatisticsTracker, {
});
AddMock(101, IID_Player, {
- "GetName": function() { return "Player 2"; },
- "GetCiv": function() { return "mace"; },
"GetColor": function() { return { "r": 1, "g": 0, "b": 0, "a": 1 }; },
"CanControlAllUnits": function() { return true; },
"GetPopulationCount": function() { return 40; },
@@ -216,6 +217,11 @@ AddMock(101, IID_Player, {
"HasSharedLos": function() { return false; }
});
+AddMock(101, IID_Identity, {
+ "GetName": function() { return "Player 2"; },
+ "GetCiv": function() { return "mace"; },
+});
+
AddMock(101, IID_EntityLimits, {
"GetLimits": function() { return { "Bar": 20 }; },
"GetCounts": function() { return { "Bar": 0 }; },
diff --git a/binaries/data/mods/public/simulation/components/tests/test_Researcher.js b/binaries/data/mods/public/simulation/components/tests/test_Researcher.js
index 8ba7259e8c..5d73a3a95e 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_Researcher.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_Researcher.js
@@ -23,10 +23,13 @@ AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
});
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTechnologies": () => ({}) // ToDo: Should be in the techmanager.
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+});
+
AddMock(playerEntityID, IID_TechnologyManager, {
"CheckTechnologyRequirements": () => true,
"IsInProgress": () => false,
@@ -53,9 +56,11 @@ TS_ASSERT_UNEVAL_EQUALS(
);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "athen",
"GetDisabledTechnologies": () => ({ "gather_fishing_net": true })
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "athen",
+});
TS_ASSERT_UNEVAL_EQUALS(cmpResearcher.GetTechnologiesList(), ["phase_town_athen", "phase_city_athen"]);
AddMock(playerEntityID, IID_TechnologyManager, {
@@ -66,9 +71,11 @@ AddMock(playerEntityID, IID_TechnologyManager, {
TS_ASSERT_UNEVAL_EQUALS(cmpResearcher.GetTechnologiesList(), [undefined, "phase_city_athen"]);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTechnologies": () => ({})
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+});
TS_ASSERT_UNEVAL_EQUALS(
cmpResearcher.GetTechnologiesList(),
["gather_fishing_net", "phase_town_generic", "phase_city_generic"]
@@ -95,10 +102,13 @@ Engine.RegisterGlobal("TechnologyTemplates", {
});
const cmpPlayer = AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTechnologies": () => ({}),
"GetPlayerID": () => playerID,
});
+
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+});
const techManager = AddMock(playerEntityID, IID_TechnologyManager, {
"CheckTechnologyRequirements": () => true,
"IsInProgress": () => false,
diff --git a/binaries/data/mods/public/simulation/components/tests/test_Technologies.js b/binaries/data/mods/public/simulation/components/tests/test_Technologies.js
index 583c64d1a7..6781f5c41b 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_Technologies.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_Technologies.js
@@ -74,7 +74,9 @@ AddMock(researcherID, IID_Ownership, {
AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
"GetPlayerByID": id => playerEntityID
});
-
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "gaia"
+});
template.cost = {
"food": 100
};
diff --git a/binaries/data/mods/public/simulation/components/tests/test_Trainer.js b/binaries/data/mods/public/simulation/components/tests/test_Trainer.js
index 7a6972ad70..43834b964d 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_Trainer.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_Trainer.js
@@ -39,11 +39,14 @@ AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
});
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({}),
"GetPlayerID": () => playerID
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+});
+
AddMock(entityID, IID_Ownership, {
"GetOwner": () => playerID
});
@@ -72,7 +75,6 @@ AddMock(SYSTEM_ENTITY, IID_TemplateManager, {
});
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }),
"GetPlayerID": () => playerID
});
@@ -84,7 +86,6 @@ TS_ASSERT_UNEVAL_EQUALS(
);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({ "units/iber/infantry_swordsman_b": true }),
"GetPlayerID": () => playerID
});
@@ -96,11 +97,14 @@ TS_ASSERT_UNEVAL_EQUALS(
);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "athen",
"GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }),
"GetPlayerID": () => playerID
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "athen",
+});
+
cmpTrainer.CalculateEntitiesMap();
TS_ASSERT_UNEVAL_EQUALS(
cmpTrainer.GetEntitiesList(),
@@ -108,11 +112,14 @@ TS_ASSERT_UNEVAL_EQUALS(
);
AddMock(playerEntityID, IID_Player, {
- "GetCiv": () => "iber",
"GetDisabledTemplates": () => ({ "units/iber/infantry_swordsman_b": false }),
"GetPlayerID": () => playerID
});
+AddMock(playerEntityID, IID_Identity, {
+ "GetCiv": () => "iber",
+});
+
cmpTrainer.CalculateEntitiesMap();
TS_ASSERT_UNEVAL_EQUALS(
cmpTrainer.GetEntitiesList(),
@@ -150,7 +157,6 @@ AddMock(SYSTEM_ENTITY, IID_GuiInterface, {
const cmpPlayer = AddMock(playerEntityID, IID_Player, {
"BlockTraining": () => {},
- "GetCiv": () => "iber",
"GetPlayerID": () => playerID,
"RefundResources": (resources) => {
TS_ASSERT_UNEVAL_EQUALS(resources, cost);
diff --git a/binaries/data/mods/public/simulation/data/civs/athen.json b/binaries/data/mods/public/simulation/data/civs/athen.json
index 646eabeab1..fe3dec3467 100644
--- a/binaries/data/mods/public/simulation/data/civs/athen.json
+++ b/binaries/data/mods/public/simulation/data/civs/athen.json
@@ -1,9 +1,6 @@
{
"Code": "athen",
"Culture": "hele",
- "Name": "Athenians",
- "Emblem": "session/portraits/emblems/emblem_athenians.png",
- "History": "As the cradle of Western civilization and the birthplace of democracy, Athens was famed as a center for the arts, learning and philosophy. The Athenians were also powerful warriors, particularly at sea. At its peak, Athens dominated a large part of the Hellenic world for several decades.",
"Music": [
{
"File": "Harvest_Festival.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/brit.json b/binaries/data/mods/public/simulation/data/civs/brit.json
index a9b813abb3..7695106ebc 100644
--- a/binaries/data/mods/public/simulation/data/civs/brit.json
+++ b/binaries/data/mods/public/simulation/data/civs/brit.json
@@ -1,9 +1,6 @@
{
"Code": "brit",
"Culture": "celt",
- "Name": "Britons",
- "Emblem": "session/portraits/emblems/emblem_britons.png",
- "History": "The Britons were the Celtic tribes of the British Isles. Using chariots, longswordsmen and powerful melee soldiers, they staged fearsome revolts against Rome to protect their customs and interests. Also, they built thousands of unique structures such as hill forts, crannogs and brochs.",
"Music": [
{
"File": "Highland_Mist.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/cart.json b/binaries/data/mods/public/simulation/data/civs/cart.json
index 5c10fe7940..d6160e10c8 100644
--- a/binaries/data/mods/public/simulation/data/civs/cart.json
+++ b/binaries/data/mods/public/simulation/data/civs/cart.json
@@ -1,9 +1,6 @@
{
"Code": "cart",
"Culture": "cart",
- "Name": "Carthaginians",
- "Emblem": "session/portraits/emblems/emblem_carthaginians.png",
- "History": "Carthage, a city-state in modern-day Tunisia, was a formidable force in the western Mediterranean, eventually taking over much of North Africa and modern-day Spain in the third century B.C. The sailors of Carthage were among the fiercest contenders on the high seas, and masters of naval trade. They deployed towered War Elephants on the battlefield to fearsome effect, and had defensive walls so strong, they were never breached.",
"Music": [
{
"File": "Mediterranean_Waves.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/gaul.json b/binaries/data/mods/public/simulation/data/civs/gaul.json
index fdd6806fcd..001b5d9a12 100644
--- a/binaries/data/mods/public/simulation/data/civs/gaul.json
+++ b/binaries/data/mods/public/simulation/data/civs/gaul.json
@@ -1,9 +1,6 @@
{
"Code": "gaul",
"Culture": "celt",
- "Name": "Gauls",
- "Emblem": "session/portraits/emblems/emblem_celts.png",
- "History": "The Gauls were the Celtic tribes of continental Europe. Dominated by a priestly class of Druids, they featured a sophisticated culture of advanced metalworking, agriculture, trade and even road engineering. With heavy infantry and cavalry, Gallic warriors valiantly resisted Caesar's campaign of conquest and Rome's authoritarian rule.",
"Music": [
{
"File": "Celtic_Pride.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/iber.json b/binaries/data/mods/public/simulation/data/civs/iber.json
index 6c7b2c7699..fd221f0a43 100644
--- a/binaries/data/mods/public/simulation/data/civs/iber.json
+++ b/binaries/data/mods/public/simulation/data/civs/iber.json
@@ -1,9 +1,6 @@
{
"Code": "iber",
"Culture": "iber",
- "Name": "Iberians",
- "Emblem": "session/portraits/emblems/emblem_iberians.png",
- "History": "The Iberians were a people of mysterious origins and language, with a strong tradition of horsemanship and metalworking. A relatively peaceful culture, they usually fought in other's battles only as mercenaries. However, they proved tenacious when Rome sought to take their land and freedom from them, and employed pioneering guerrilla tactics and flaming javelins as they fought back.",
"Music": [
{
"File": "An_old_Warhorse_goes_to_Pasture.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/kush.json b/binaries/data/mods/public/simulation/data/civs/kush.json
index bb6a6b717b..a82d3e9d6b 100644
--- a/binaries/data/mods/public/simulation/data/civs/kush.json
+++ b/binaries/data/mods/public/simulation/data/civs/kush.json
@@ -1,9 +1,6 @@
{
"Code": "kush",
"Culture": "egyptian",
- "Name": "Kushites",
- "Emblem": "session/portraits/emblems/emblem_kushites.png",
- "History": "The Kingdom of Kush was an ancient African kingdom situated on the confluences of the Blue Nile, White Nile and River Atbara in what is now the Republic of Sudan. The Kushite era of rule in the region was established after the Bronze Age collapse of the New Kingdom of Egypt, and it was centered at Napata in its early phase. They invaded Egypt in the 8th century BC, and the Kushite emperors ruled as Pharaohs of the Twenty-fifth dynasty of Egypt for a century, until they were expelled by the Assyrians. Kushite culture was influenced heavily by the Egyptians, with Kushite pyramid building and monumental temple architecture still extent. The Kushites even worshipped many Egyptian gods, including Amun. During Classical antiquity, the Kushite imperial capital was at Meroe. In early Greek geography, the Meroitic kingdom was known as Aethiopia. The Kushite kingdom persisted until the 4th century AD, when it weakened and disintegrated due to internal rebellion, eventually succumbing to the rising power of Axum.",
"Music": [
{
"File": "Ammon-Ra.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/mace.json b/binaries/data/mods/public/simulation/data/civs/mace.json
index 4e0a191fdd..2cb9183cad 100644
--- a/binaries/data/mods/public/simulation/data/civs/mace.json
+++ b/binaries/data/mods/public/simulation/data/civs/mace.json
@@ -1,9 +1,6 @@
{
"Code": "mace",
"Culture": "hele",
- "Name": "Macedonians",
- "Emblem": "session/portraits/emblems/emblem_macedonians.png",
- "History": "Macedonia was an ancient Greek kingdom, centered in the northeastern part of the Greek peninsula. Under the leadership of Alexander the Great, Macedonian forces and allies took over most of the world they knew, including Egypt, Persia and parts of the Indian subcontinent, allowing a diffusion of Hellenic and eastern cultures for years to come.",
"Music": [
{
"File": "Rise_of_Macedon.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/maur.json b/binaries/data/mods/public/simulation/data/civs/maur.json
index ca5488815e..945cc0aba7 100644
--- a/binaries/data/mods/public/simulation/data/civs/maur.json
+++ b/binaries/data/mods/public/simulation/data/civs/maur.json
@@ -1,9 +1,6 @@
{
"Code": "maur",
"Culture": "maur",
- "Name": "Mauryas",
- "Emblem": "session/portraits/emblems/emblem_mauryas.png",
- "History": "Founded in 322 B.C. by Chandragupta Maurya, the Mauryan Empire was the first to rule most of the Indian subcontinent, and was one of the largest and most populous empires of antiquity. Its military featured bowmen who used the long-range bamboo longbow, fierce female warriors, chariots, and thousands of armored war elephants. Its philosophers, especially the famous Acharya Chanakya, contributed to such varied fields such as economics, religion, diplomacy, warfare, and good governance. Under the rule of Ashoka the Great, the empire saw 40 years of peace, harmony, and prosperity.",
"Music": [
{
"File": "An_old_Warhorse_goes_to_Pasture.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/pers.json b/binaries/data/mods/public/simulation/data/civs/pers.json
index b29012234d..24a6a4a354 100644
--- a/binaries/data/mods/public/simulation/data/civs/pers.json
+++ b/binaries/data/mods/public/simulation/data/civs/pers.json
@@ -1,9 +1,6 @@
{
"Code": "pers",
"Culture": "pers",
- "Name": "Persians",
- "Emblem": "session/portraits/emblems/emblem_persians.png",
- "History": "The Persian Empire, when ruled by the Achaemenid dynasty, was one of the greatest empires of antiquity, stretching at its zenith from the Indus Valley in the east to Greece in the west. The Persians were the pioneers of empire-building of the ancient world, successfully imposing a centralized rule over various peoples with different customs, laws, religions and languages, and building a cosmopolitan army made up of contingents from each of these nations.",
"Music": [
{
"File": "Eastern_Dreams.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/ptol.json b/binaries/data/mods/public/simulation/data/civs/ptol.json
index b263c2a6f4..d0669c1283 100644
--- a/binaries/data/mods/public/simulation/data/civs/ptol.json
+++ b/binaries/data/mods/public/simulation/data/civs/ptol.json
@@ -1,9 +1,6 @@
{
"Code": "ptol",
"Culture": "ptol",
- "Name": "Ptolemies",
- "Emblem": "session/portraits/emblems/emblem_ptolemies.png",
- "History": "The Ptolemaic dynasty was a Macedonian Greek royal family which ruled the Ptolemaic Empire in Egypt during the Hellenistic period. Their rule lasted for 275 years, from 305 BC to 30 BC. They were the last dynasty of ancient Egypt.",
"Music": [
{
"File": "Ammon-Ra.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/rome.json b/binaries/data/mods/public/simulation/data/civs/rome.json
index c6924d6a75..c80f635156 100644
--- a/binaries/data/mods/public/simulation/data/civs/rome.json
+++ b/binaries/data/mods/public/simulation/data/civs/rome.json
@@ -1,9 +1,6 @@
{
"Code": "rome",
"Culture": "rome",
- "Name": "Romans",
- "Emblem": "session/portraits/emblems/emblem_romans.png",
- "History": "The Romans controlled one of the largest empires of the ancient world, stretching at its peak from southern Scotland to the Sahara Desert, and containing between 60 million and 80 million inhabitants, one quarter of the Earth's population at that time. Rome also remained one of the strongest nations on earth for almost 800 years. The Romans were the supreme builders of the ancient world, excelled at siege warfare and had an exquisite infantry and navy.",
"Music": [
{
"File": "Juno_Protect_You.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/sele.json b/binaries/data/mods/public/simulation/data/civs/sele.json
index d744691144..ba149c10ab 100644
--- a/binaries/data/mods/public/simulation/data/civs/sele.json
+++ b/binaries/data/mods/public/simulation/data/civs/sele.json
@@ -1,9 +1,6 @@
{
"Code": "sele",
"Culture": "sele",
- "Name": "Seleucids",
- "Emblem": "session/portraits/emblems/emblem_seleucids.png",
- "History": "The Macedonian-Greek dynasty that ruled most of Alexander's former empire.",
"Music": [
{
"File": "Rise_of_Macedon.ogg",
diff --git a/binaries/data/mods/public/simulation/data/civs/spart.json b/binaries/data/mods/public/simulation/data/civs/spart.json
index e66e9b739e..b7978e595d 100644
--- a/binaries/data/mods/public/simulation/data/civs/spart.json
+++ b/binaries/data/mods/public/simulation/data/civs/spart.json
@@ -1,9 +1,6 @@
{
"Code": "spart",
"Culture": "hele",
- "Name": "Spartans",
- "Emblem": "session/portraits/emblems/emblem_spartans.png",
- "History": "Sparta was a prominent city-state in ancient Greece, and its dominant military power on land from circa 650 B.C. Spartan culture was obsessed with military training and excellence, with rigorous training for boys beginning at age seven. Thanks to its military might, Sparta led a coalition of Greek forces during the Greco-Persian Wars, and won over Athens in the Peloponnesian Wars, though at great cost.",
"Music": [
{
"File": "Helen_Leaves_Sparta.ogg",
diff --git a/binaries/data/mods/public/simulation/helpers/Player.js b/binaries/data/mods/public/simulation/helpers/Player.js
index 63a27ce33c..fc45e7dc39 100644
--- a/binaries/data/mods/public/simulation/helpers/Player.js
+++ b/binaries/data/mods/public/simulation/helpers/Player.js
@@ -75,11 +75,10 @@ function LoadPlayerSettings(settings, newPlayers)
// Initialize the player data
for (var i = 0; i < numPlayers; ++i)
{
- let cmpPlayer = QueryPlayerIDInterface(i);
- cmpPlayer.SetName(getSetting(playerData, playerDefaults, i, "Name"));
- cmpPlayer.SetCiv(getSetting(playerData, playerDefaults, i, "Civ"));
+ QueryPlayerIDInterface(i, IID_Identity).SetName(getSetting(playerData, playerDefaults, i, "Name"));
var color = getSetting(playerData, playerDefaults, i, "Color");
+ const cmpPlayer = QueryPlayerIDInterface(i);
cmpPlayer.SetColor(color.r, color.g, color.b);
// Special case for gaia
@@ -181,12 +180,7 @@ function getSetting(settings, defaults, idx, property)
function GetPlayerTemplateName(civ)
{
- let path = "special/player/player";
-
- if (Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager).TemplateExists(path + "_" + civ))
- return path + "_" + civ;
-
- return path;
+ return "special/players/" + civ;
}
/**
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player.xml b/binaries/data/mods/public/simulation/templates/special/player.xml
similarity index 98%
rename from binaries/data/mods/public/simulation/templates/special/player/player.xml
rename to binaries/data/mods/public/simulation/templates/special/player.xml
index 9aa1d6d551..a7764d4d5e 100644
--- a/binaries/data/mods/public/simulation/templates/special/player/player.xml
+++ b/binaries/data/mods/public/simulation/templates/special/player.xml
@@ -53,8 +53,6 @@
-
- Player
Player
true
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml b/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml
deleted file mode 100644
index 3cfeb438c2..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/athen_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml b/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml
deleted file mode 100644
index d52948a05e..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/brit_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml b/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml
deleted file mode 100644
index 0c0ff7f7fc..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/cart_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml b/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml
deleted file mode 100644
index c336c4ca32..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/gaul_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml b/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml
deleted file mode 100644
index 759e439630..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/iber_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml b/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml
deleted file mode 100644
index 2de992cd49..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/kush_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml b/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml
deleted file mode 100644
index fdb518bb61..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/mace_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml b/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml
deleted file mode 100644
index 3a9c57f03f..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/maur_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml b/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml
deleted file mode 100644
index 4b2b261822..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/pers_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml b/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml
deleted file mode 100644
index 43c386ca64..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- teambonuses/ptol_player_teambonus
-
-
-
-
- phase_town
- Hero
-
-
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml b/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml
deleted file mode 100644
index f64c488d5a..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- teambonuses/rome_player_teambonus
-
-
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml b/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml
deleted file mode 100644
index ba06136f85..0000000000
--- a/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- teambonuses/spart_player_teambonus
-
diff --git a/binaries/data/mods/public/simulation/templates/special/players/athen.xml b/binaries/data/mods/public/simulation/templates/special/players/athen.xml
new file mode 100644
index 0000000000..f72de6a6bc
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/athen.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/athen_player_teambonus
+
+
+ athen
+ Athenians
+ As the cradle of Western civilization and the birthplace of democracy, Athens was famed as a center for the arts, learning and philosophy. The Athenians were also powerful warriors, particularly at sea. At its peak, Athens dominated a large part of the Hellenic world for several decades.
+ session/portraits/emblems/emblem_athenians.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/brit.xml b/binaries/data/mods/public/simulation/templates/special/players/brit.xml
new file mode 100644
index 0000000000..cabbfe3b4d
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/brit.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/brit_player_teambonus
+
+
+ brit
+ Britons
+ The Britons were the Celtic tribes of the British Isles. Using chariots, longswordsmen and powerful melee soldiers, they staged fearsome revolts against Rome to protect their customs and interests. Also, they built thousands of unique structures such as hill forts, crannogs and brochs.
+ session/portraits/emblems/emblem_britons.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/cart.xml b/binaries/data/mods/public/simulation/templates/special/players/cart.xml
new file mode 100644
index 0000000000..89441bb934
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/cart.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/cart_player_teambonus
+
+
+ cart
+ Carthaginians
+ Carthage, a city-state in modern-day Tunisia, was a formidable force in the western Mediterranean, eventually taking over much of North Africa and modern-day Spain in the third century B.C. The sailors of Carthage were among the fiercest contenders on the high seas, and masters of naval trade. They deployed towered War Elephants on the battlefield to fearsome effect, and had defensive walls so strong, they were never breached.
+ session/portraits/emblems/emblem_carthaginians.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml b/binaries/data/mods/public/simulation/templates/special/players/gaia.xml
similarity index 80%
rename from binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml
rename to binaries/data/mods/public/simulation/templates/special/players/gaia.xml
index af54c0e38b..cfe0cff7e6 100644
--- a/binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml
+++ b/binaries/data/mods/public/simulation/templates/special/players/gaia.xml
@@ -1,5 +1,10 @@
+
+ gaia
+ Gaia
+ true
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/gaul.xml b/binaries/data/mods/public/simulation/templates/special/players/gaul.xml
new file mode 100644
index 0000000000..4ab29044c0
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/gaul.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/gaul_player_teambonus
+
+
+ gaul
+ Gauls
+ The Gauls were the Celtic tribes of continental Europe. Dominated by a priestly class of Druids, they featured a sophisticated culture of advanced metalworking, agriculture, trade and even road engineering. With heavy infantry and cavalry, Gallic warriors valiantly resisted Caesar's campaign of conquest and Rome's authoritarian rule.
+ session/portraits/emblems/emblem_celts.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/iber.xml b/binaries/data/mods/public/simulation/templates/special/players/iber.xml
new file mode 100644
index 0000000000..54b7e96318
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/iber.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/iber_player_teambonus
+
+
+ iber
+ Iberians
+ The Iberians were a people of mysterious origins and language, with a strong tradition of horsemanship and metalworking. A relatively peaceful culture, they usually fought in other's battles only as mercenaries. However, they proved tenacious when Rome sought to take their land and freedom from them, and employed pioneering guerrilla tactics and flaming javelins as they fought back.
+ session/portraits/emblems/emblem_iberians.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/kush.xml b/binaries/data/mods/public/simulation/templates/special/players/kush.xml
new file mode 100644
index 0000000000..e10b166215
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/kush.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/kush_player_teambonus
+
+
+ kush
+ Kushites
+ The Kingdom of Kush was an ancient African kingdom situated on the confluences of the Blue Nile, White Nile and River Atbara in what is now the Republic of Sudan. The Kushite era of rule in the region was established after the Bronze Age collapse of the New Kingdom of Egypt, and it was centered at Napata in its early phase. They invaded Egypt in the 8th century BC, and the Kushite emperors ruled as Pharaohs of the Twenty-fifth dynasty of Egypt for a century, until they were expelled by the Assyrians. Kushite culture was influenced heavily by the Egyptians, with Kushite pyramid building and monumental temple architecture still extent. The Kushites even worshipped many Egyptian gods, including Amun. During Classical antiquity, the Kushite imperial capital was at Meroe. In early Greek geography, the Meroitic kingdom was known as Aethiopia. The Kushite kingdom persisted until the 4th century AD, when it weakened and disintegrated due to internal rebellion, eventually succumbing to the rising power of Axum.
+ session/portraits/emblems/emblem_kushites.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/mace.xml b/binaries/data/mods/public/simulation/templates/special/players/mace.xml
new file mode 100644
index 0000000000..40d98e4270
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/mace.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/mace_player_teambonus
+
+
+ mace
+ Macedonians
+ Macedonia was an ancient Greek kingdom, centered in the northeastern part of the Greek peninsula. Under the leadership of Alexander the Great, Macedonian forces and allies took over most of the world they knew, including Egypt, Persia and parts of the Indian subcontinent, allowing a diffusion of Hellenic and eastern cultures for years to come.
+ session/portraits/emblems/emblem_macedonians.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/maur.xml b/binaries/data/mods/public/simulation/templates/special/players/maur.xml
new file mode 100644
index 0000000000..76864b3c2b
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/maur.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/maur_player_teambonus
+
+
+ maur
+ Mauryas
+ Founded in 322 B.C. by Chandragupta Maurya, the Mauryan Empire was the first to rule most of the Indian subcontinent, and was one of the largest and most populous empires of antiquity. Its military featured bowmen who used the long-range bamboo longbow, fierce female warriors, chariots, and thousands of armored war elephants. Its philosophers, especially the famous Acharya Chanakya, contributed to such varied fields such as economics, religion, diplomacy, warfare, and good governance. Under the rule of Ashoka the Great, the empire saw 40 years of peace, harmony, and prosperity.
+ session/portraits/emblems/emblem_mauryas.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/pers.xml b/binaries/data/mods/public/simulation/templates/special/players/pers.xml
new file mode 100644
index 0000000000..3c92994241
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/pers.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/pers_player_teambonus
+
+
+ pers
+ Persians
+ The Persian Empire, when ruled by the Achaemenid dynasty, was one of the greatest empires of antiquity, stretching at its zenith from the Indus Valley in the east to Greece in the west. The Persians were the pioneers of empire-building of the ancient world, successfully imposing a centralized rule over various peoples with different customs, laws, religions and languages, and building a cosmopolitan army made up of contingents from each of these nations.
+ session/portraits/emblems/emblem_persians.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/ptol.xml b/binaries/data/mods/public/simulation/templates/special/players/ptol.xml
new file mode 100644
index 0000000000..df68c6540b
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/ptol.xml
@@ -0,0 +1,20 @@
+
+
+
+ teambonuses/ptol_player_teambonus
+
+
+
+
+ phase_town
+ Hero
+
+
+
+
+ ptol
+ Ptolemies
+ The Ptolemaic dynasty was a Macedonian Greek royal family which ruled the Ptolemaic Empire in Egypt during the Hellenistic period. Their rule lasted for 275 years, from 305 BC to 30 BC. They were the last dynasty of ancient Egypt.
+ session/portraits/emblems/emblem_ptolemies.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/rome.xml b/binaries/data/mods/public/simulation/templates/special/players/rome.xml
new file mode 100644
index 0000000000..6127bacf48
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/rome.xml
@@ -0,0 +1,12 @@
+
+
+
+ teambonuses/rome_player_teambonus
+
+
+ rome
+ Romans
+ The Romans controlled one of the largest empires of the ancient world, stretching at its peak from southern Scotland to the Sahara Desert, and containing between 60 million and 80 million inhabitants, one quarter of the Earth's population at that time. Rome also remained one of the strongest nations on earth for almost 800 years. The Romans were the supreme builders of the ancient world, excelled at siege warfare and had an exquisite infantry and navy.
+ session/portraits/emblems/emblem_romans.png
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/player/player_sele.xml b/binaries/data/mods/public/simulation/templates/special/players/sele.xml
similarity index 57%
rename from binaries/data/mods/public/simulation/templates/special/player/player_sele.xml
rename to binaries/data/mods/public/simulation/templates/special/players/sele.xml
index 974a487706..a516ad5908 100644
--- a/binaries/data/mods/public/simulation/templates/special/player/player_sele.xml
+++ b/binaries/data/mods/public/simulation/templates/special/players/sele.xml
@@ -1,5 +1,5 @@
-
+
teambonuses/sele_player_teambonus
@@ -11,4 +11,10 @@
+
+ sele
+ Seleucids
+ The Macedonian-Greek dynasty that ruled most of Alexander's former empire.
+ session/portraits/emblems/emblem_seleucids.png
+
diff --git a/binaries/data/mods/public/simulation/templates/special/players/spart.xml b/binaries/data/mods/public/simulation/templates/special/players/spart.xml
new file mode 100644
index 0000000000..5468963b24
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/players/spart.xml
@@ -0,0 +1,10 @@
+
+
+ teambonuses/spart_player_teambonus
+
+ spart
+ Spartans
+ Sparta was a prominent city-state in ancient Greece, and its dominant military power on land from circa 650 B.C. Spartan culture was obsessed with military training and excellence, with rigorous training for boys beginning at age seven. Thanks to its military might, Sparta led a coalition of Greek forces during the Greco-Persian Wars, and won over Athens in the Peloponnesian Wars, though at great cost.
+ session/portraits/emblems/emblem_spartans.png
+
+
diff --git a/source/ps/TemplateLoader.cpp b/source/ps/TemplateLoader.cpp
index 3789d02889..c3fdaf96c3 100644
--- a/source/ps/TemplateLoader.cpp
+++ b/source/ps/TemplateLoader.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -105,6 +105,21 @@ static Status AddToTemplates(const VfsPath& pathname, const CFileInfo& UNUSED(fi
return INFO::OK;
}
+static Status AddToTemplatesUnrestricted(const VfsPath& pathname, const CFileInfo& UNUSED(fileInfo), const uintptr_t cbData)
+{
+ std::vector& templates = *(std::vector*)cbData;
+
+ VfsPath pathstem = pathname.ChangeExtension(L"");
+ std::string name = pathstem.string8().substr(ARRAY_SIZE(TEMPLATE_ROOT)-1);
+
+ // We want to ignore template_*.xml templates, since they may be incomplete.
+ if (name.substr(0, 9) == "template_")
+ return INFO::OK;
+
+ templates.push_back(name);
+ return INFO::OK;
+}
+
static Status AddActorToTemplates(const VfsPath& pathname, const CFileInfo& UNUSED(fileInfo), const uintptr_t cbData)
{
std::vector& templates = *(std::vector*)cbData;
@@ -144,6 +159,17 @@ std::vector CTemplateLoader::FindTemplates(const std::string& path,
return templates;
}
+std::vector CTemplateLoader::FindTemplatesUnrestricted(const std::string& path, bool includeSubdirectories) const
+{
+ std::vector templates;
+
+ size_t flags = includeSubdirectories ? vfs::DIR_RECURSIVE : 0;
+
+ WARN_IF_ERR(vfs::ForEachFile(g_VFS, VfsPath(TEMPLATE_ROOT) / path, AddToTemplatesUnrestricted, (uintptr_t)&templates, L"*.xml", flags));
+
+ return templates;
+}
+
const CParamNode& CTemplateLoader::GetTemplateFileData(const std::string& templateName)
{
if (std::unordered_map::const_iterator it = m_TemplateFileData.find(templateName); it != m_TemplateFileData.end())
diff --git a/source/ps/TemplateLoader.h b/source/ps/TemplateLoader.h
index efa0e96ef0..5ac829943d 100644
--- a/source/ps/TemplateLoader.h
+++ b/source/ps/TemplateLoader.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -67,6 +67,12 @@ public:
*/
std::vector FindTemplates(const std::string& path, bool includeSubdirectories, ETemplatesType templatesType) const;
+ /**
+ * Returns a list of strings that could validly be passed as @c templateName to LoadTemplateFile.
+ * Not ignoring any special directories.
+ */
+ std::vector FindTemplatesUnrestricted(const std::string& path, bool includeSubdirectories) const;
+
private:
/**
* (Re)loads the given template, regardless of whether it exists already,
diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp
index 13045a6ceb..f81dc67b1f 100644
--- a/source/simulation2/Simulation2.cpp
+++ b/source/simulation2/Simulation2.cpp
@@ -945,11 +945,6 @@ std::vector CSimulation2::GetRMSData()
return GetJSONData(L"maps/random/");
}
-std::vector CSimulation2::GetCivData()
-{
- return GetJSONData(L"simulation/data/civs/");
-}
-
std::vector CSimulation2::GetVictoryConditiondData()
{
return GetJSONData(L"simulation/data/settings/victory_conditions/");
diff --git a/source/simulation2/Simulation2.h b/source/simulation2/Simulation2.h
index 380b44b8d1..5385c30ca1 100644
--- a/source/simulation2/Simulation2.h
+++ b/source/simulation2/Simulation2.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -248,13 +248,6 @@ public:
*/
std::vector GetRMSData();
- /**
- * Get civilization data
- *
- * @return vector of strings containing JSON format data
- */
- std::vector GetCivData();
-
/**
* Get victory condition data
*
diff --git a/source/simulation2/components/CCmpRallyPointRenderer.cpp b/source/simulation2/components/CCmpRallyPointRenderer.cpp
index 08c449f7b9..6ad65d03e8 100644
--- a/source/simulation2/components/CCmpRallyPointRenderer.cpp
+++ b/source/simulation2/components/CCmpRallyPointRenderer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -269,13 +269,13 @@ void CCmpRallyPointRenderer::UpdateMarkers()
if (!cmpPlayerManager)
continue;
- CmpPtr cmpPlayer(GetSimContext(), cmpPlayerManager->GetPlayerByID(ownerId));
- if (!cmpPlayer)
+ CmpPtr cmpIdentity(GetSimContext(), cmpPlayerManager->GetPlayerByID(ownerId));
+ if (!cmpIdentity)
continue;
CmpPtr cmpVisualActor(GetSimContext(), m_MarkerEntityIds[i]);
if (cmpVisualActor)
- cmpVisualActor->SetVariant("civ", CStrW(cmpPlayer->GetCiv()).ToUTF8());
+ cmpVisualActor->SetVariant("civ", CStrW(cmpIdentity->GetCiv()).ToUTF8());
}
m_LastMarkerCount = m_RallyPoints.size() - 1;
}
diff --git a/source/simulation2/components/CCmpRallyPointRenderer.h b/source/simulation2/components/CCmpRallyPointRenderer.h
index 238568557c..c0403414c2 100644
--- a/source/simulation2/components/CCmpRallyPointRenderer.h
+++ b/source/simulation2/components/CCmpRallyPointRenderer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -26,6 +26,7 @@
#include "renderer/Renderer.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/components/ICmpFootprint.h"
+#include "simulation2/components/ICmpIdentity.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPathfinder.h"
diff --git a/source/simulation2/components/CCmpTemplateManager.cpp b/source/simulation2/components/CCmpTemplateManager.cpp
index 205eac70fb..7c5aa95cb9 100644
--- a/source/simulation2/components/CCmpTemplateManager.cpp
+++ b/source/simulation2/components/CCmpTemplateManager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -113,6 +113,8 @@ public:
virtual std::vector FindAllTemplates(bool includeActors) const;
+ virtual std::vector> GetCivData();
+
virtual std::vector FindUsedTemplates() const;
virtual std::vector GetEntitiesUsingTemplate(const std::string& templateName) const;
@@ -215,6 +217,23 @@ std::vector CCmpTemplateManager::FindAllTemplates(bool includeActor
return m_templateLoader.FindTemplates("", true, templatesType);
}
+std::vector> CCmpTemplateManager::GetCivData()
+{
+ std::vector> data;
+
+ std::vector names = m_templateLoader.FindTemplatesUnrestricted("special/players/", false);
+ data.reserve(names.size());
+ for (const std::string& name : names)
+ {
+ const CParamNode& identity = GetTemplate(name)->GetChild("Identity");
+ data.push_back(std::vector {
+ identity.GetChild("Civ").ToWString(),
+ identity.GetChild("GenericName").ToWString()
+ });
+ }
+ return data;
+}
+
std::vector CCmpTemplateManager::FindUsedTemplates() const
{
std::vector usedTemplates;
diff --git a/source/simulation2/components/ICmpIdentity.cpp b/source/simulation2/components/ICmpIdentity.cpp
index 99b7a1c3b3..86669d09da 100644
--- a/source/simulation2/components/ICmpIdentity.cpp
+++ b/source/simulation2/components/ICmpIdentity.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -40,6 +40,11 @@ public:
{
return m_Script.Call("GetPhenotype");
}
+
+ virtual std::wstring GetCiv()
+ {
+ return m_Script.Call("GetCiv");
+ }
};
REGISTER_COMPONENT_SCRIPT_WRAPPER(IdentityScripted)
diff --git a/source/simulation2/components/ICmpIdentity.h b/source/simulation2/components/ICmpIdentity.h
index 6337b93b50..0003c71757 100644
--- a/source/simulation2/components/ICmpIdentity.h
+++ b/source/simulation2/components/ICmpIdentity.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -31,6 +31,8 @@ public:
virtual std::wstring GetPhenotype() = 0;
+ virtual std::wstring GetCiv() = 0;
+
DECLARE_INTERFACE_TYPE(Identity)
};
diff --git a/source/simulation2/components/ICmpPlayer.cpp b/source/simulation2/components/ICmpPlayer.cpp
index 2b58af9063..c1608d5c91 100644
--- a/source/simulation2/components/ICmpPlayer.cpp
+++ b/source/simulation2/components/ICmpPlayer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -37,11 +37,6 @@ public:
return m_Script.Call("GetDisplayedColor");
}
- virtual std::wstring GetCiv()
- {
- return m_Script.Call("GetCiv");
- }
-
virtual CFixedVector3D GetStartingCameraPos()
{
return m_Script.Call("GetStartingCameraPos");
diff --git a/source/simulation2/components/ICmpPlayer.h b/source/simulation2/components/ICmpPlayer.h
index 02f64b1da5..cfa9384d0c 100644
--- a/source/simulation2/components/ICmpPlayer.h
+++ b/source/simulation2/components/ICmpPlayer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -33,7 +33,6 @@ class ICmpPlayer : public IComponent
{
public:
virtual CColor GetDisplayedColor() = 0;
- virtual std::wstring GetCiv() = 0;
virtual CFixedVector3D GetStartingCameraPos() = 0;
virtual CFixedVector3D GetStartingCameraRot() = 0;
diff --git a/source/simulation2/components/ICmpTemplateManager.cpp b/source/simulation2/components/ICmpTemplateManager.cpp
index fd35b08a7b..2999040e41 100644
--- a/source/simulation2/components/ICmpTemplateManager.cpp
+++ b/source/simulation2/components/ICmpTemplateManager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -27,5 +27,6 @@ DEFINE_INTERFACE_METHOD("GetTemplateWithoutValidation", ICmpTemplateManager, Get
DEFINE_INTERFACE_METHOD("TemplateExists", ICmpTemplateManager, TemplateExists)
DEFINE_INTERFACE_METHOD("GetCurrentTemplateName", ICmpTemplateManager, GetCurrentTemplateName)
DEFINE_INTERFACE_METHOD("FindAllTemplates", ICmpTemplateManager, FindAllTemplates)
+DEFINE_INTERFACE_METHOD("GetCivData", ICmpTemplateManager, GetCivData)
DEFINE_INTERFACE_METHOD("GetEntitiesUsingTemplate", ICmpTemplateManager, GetEntitiesUsingTemplate)
END_INTERFACE_WRAPPER(TemplateManager)
diff --git a/source/simulation2/components/ICmpTemplateManager.h b/source/simulation2/components/ICmpTemplateManager.h
index 09abced344..23955b6a17 100644
--- a/source/simulation2/components/ICmpTemplateManager.h
+++ b/source/simulation2/components/ICmpTemplateManager.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -103,6 +103,12 @@ public:
*/
virtual std::vector FindAllTemplates(bool includeActors) const = 0;
+ /**
+ * Returns some data of the civs from the templates.
+ * Intended for use by the map editor.
+ */
+ virtual std::vector> GetCivData() = 0;
+
/**
* Returns a list of strings that could be validly passed as @c templateName to LoadTemplate.
* Intended for use by the AI manager.
diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp
index 1891d589d3..a41a4432e3 100644
--- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp
+++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -583,12 +583,11 @@ void PlayerSettingsControl::CreateWidgets()
wxArrayString civCodes;
AtlasMessage::qGetCivData qryCiv;
qryCiv.Post();
- std::vector civData = *qryCiv.data;
- for (size_t i = 0; i < civData.size(); ++i)
+ std::vector> civData = *qryCiv.data;
+ for (const std::vector& civ : civData)
{
- AtObj civ = AtlasObject::LoadFromJSON(civData[i]);
- civNames.Add(wxString::FromUTF8(civ["Name"]));
- civCodes.Add(wxString::FromUTF8(civ["Code"]));
+ civCodes.Add(civ[0]);
+ civNames.Add(civ[1]);
}
// Load AI data
diff --git a/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp
index 095900e0a4..a8963b2420 100644
--- a/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp
+++ b/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Wildfire Games.
+/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -21,13 +21,14 @@
#include "ps/Game.h"
#include "simulation2/Simulation2.h"
-
+#include "simulation2/components/ICmpTemplateManager.h"
namespace AtlasMessage {
QUERYHANDLER(GetCivData)
{
- msg->data = g_Game->GetSimulation2()->GetCivData();
+ CmpPtr cmpTemplateManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
+ msg->data = cmpTemplateManager->GetCivData();
}
QUERYHANDLER(GetPlayerDefaults)
diff --git a/source/tools/atlas/GameInterface/Messages.h b/source/tools/atlas/GameInterface/Messages.h
index fe6ace33f3..2fa4780921 100644
--- a/source/tools/atlas/GameInterface/Messages.h
+++ b/source/tools/atlas/GameInterface/Messages.h
@@ -243,7 +243,7 @@ QUERY(VFSFileRealPath,
QUERY(GetCivData,
,
- ((std::vector, data))
+ ((std::vector>, data))
);
QUERY(GetVictoryConditionData,
diff --git a/source/tools/entity/checkrefs.pl b/source/tools/entity/checkrefs.pl
index 2bfa553a4f..e25dadc27b 100755
--- a/source/tools/entity/checkrefs.pl
+++ b/source/tools/entity/checkrefs.pl
@@ -536,8 +536,6 @@ sub add_civs
my $civ = parse_json_file($f);
- push @deps, [ $f, "art/textures/ui/" . $civ->{Emblem} ] if $civ->{Emblem};
-
push @deps, [ $f, "audio/music/" . $_->{File} ] for @{$civ->{Music}};
}
}