Index: binaries/data/mods/public/globalscripts/Templates.js =================================================================== --- binaries/data/mods/public/globalscripts/Templates.js +++ binaries/data/mods/public/globalscripts/Templates.js @@ -7,7 +7,7 @@ function loadCivFiles(selectableOnly) { let propertyNames = [ - "Code", "Culture", "Music", "CivBonuses", "StartEntities", + "Code", "Culture", "Name", "Emblem", "History", "Music", "CivBonuses", "StartEntities", "AINames", "SkirmishReplacements", "SelectableInGameSetup"]; let civData = {}; @@ -20,15 +20,8 @@ if (data[prop] === undefined) throw new Error(filename + " doesn't contain " + prop); - if (selectableOnly && !data.SelectableInGameSetup) - continue; - - const template = Engine.GetTemplate("special/players/" + data.Code); - data.Name = template.Identity.GenericName; - data.Emblem = "session/portraits/" + template.Identity.Icon; - data.History = template.Identity.History; - - civData[data.Code] = data; + if (!selectableOnly || data.SelectableInGameSetup) + civData[data.Code] = data; } return civData; Index: binaries/data/mods/public/l10n/messages.json =================================================================== --- binaries/data/mods/public/l10n/messages.json +++ binaries/data/mods/public/l10n/messages.json @@ -19,18 +19,6 @@ "AINames": {} } } - }, - { - "extractor": "xml", - "filemasks": [ - "simulation/templates/special/players/**.xml" - ], - "options": { - "keywords": { - "GenericName": {}, - "History": {} - } - } } ] }, Index: binaries/data/mods/public/maps/random/tests/test_Constraint.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_Constraint.js +++ binaries/data/mods/public/maps/random/tests/test_Constraint.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js +++ binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); { Index: binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js +++ binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_RectPlacer.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_RectPlacer.js +++ binaries/data/mods/public/maps/random/tests/test_RectPlacer.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js +++ binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_TileClass.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_TileClass.js +++ binaries/data/mods/public/maps/random/tests/test_TileClass.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/simulation/components/Builder.js =================================================================== --- binaries/data/mods/public/simulation/components/Builder.js +++ binaries/data/mods/public/simulation/components/Builder.js @@ -43,7 +43,7 @@ if (cmpIdentity) string = string.replace(/\{native\}/g, cmpIdentity.GetCiv()); - const entities = string.replace(/\{civ\}/g, QueryOwnerInterface(this.entity, IID_Identity).GetCiv()).split(/\s+/); + let entities = string.replace(/\{civ\}/g, cmpPlayer.GetCiv()).split(/\s+/); let disabledTemplates = cmpPlayer.GetDisabledTemplates(); Index: binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- binaries/data/mods/public/simulation/components/GuiInterface.js +++ binaries/data/mods/public/simulation/components/GuiInterface.js @@ -62,14 +62,12 @@ let numPlayers = cmpPlayerManager.GetNumPlayers(); for (let i = 0; i < numPlayers; ++i) { - 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); + let cmpPlayer = QueryPlayerIDInterface(i); + let cmpPlayerEntityLimits = QueryPlayerIDInterface(i, IID_EntityLimits); // Work out which phase we are in. let phase = ""; - const cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager); + let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager); if (cmpTechnologyManager) { if (cmpTechnologyManager.IsTechnologyResearched("phase_city")) @@ -94,8 +92,8 @@ } ret.players.push({ - "name": cmpIdentity.GetName(), - "civ": cmpIdentity.GetCiv(), + "name": cmpPlayer.GetName(), + "civ": cmpPlayer.GetCiv(), "color": cmpPlayer.GetColor(), "controlsAll": cmpPlayer.CanControlAllUnits(), "popCount": cmpPlayer.GetPopulationCount(), Index: binaries/data/mods/public/simulation/components/Player.js =================================================================== --- binaries/data/mods/public/simulation/components/Player.js +++ binaries/data/mods/public/simulation/components/Player.js @@ -56,6 +56,8 @@ 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; @@ -116,6 +118,34 @@ 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; @@ -754,10 +784,9 @@ // 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, civ)] = true; + this.disabledTemplates[template.replace(/\{civ\}/g, this.civ)] = true; }; /** Index: binaries/data/mods/public/simulation/components/Researcher.js =================================================================== --- binaries/data/mods/public/simulation/components/Researcher.js +++ binaries/data/mods/public/simulation/components/Researcher.js @@ -195,11 +195,11 @@ 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]; Index: binaries/data/mods/public/simulation/components/SkirmishReplacer.js =================================================================== --- binaries/data/mods/public/simulation/components/SkirmishReplacer.js +++ binaries/data/mods/public/simulation/components/SkirmishReplacer.js @@ -28,10 +28,11 @@ SkirmishReplacer.prototype.ReplaceEntities = function() { - const civ = QueryOwnerInterface(this.entity, IID_Identity)?.GetCiv(); - if (!civ) + var cmpPlayer = QueryOwnerInterface(this.entity); + if (!cmpPlayer) return; + var civ = cmpPlayer.GetCiv(); var replacementEntities = getReplacementEntities(civ); var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); Index: binaries/data/mods/public/simulation/components/TechnologyManager.js =================================================================== --- binaries/data/mods/public/simulation/components/TechnologyManager.js +++ binaries/data/mods/public/simulation/components/TechnologyManager.js @@ -316,7 +316,7 @@ if (this.IsTechnologyResearched(tech)) return false; - return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Identity).GetCiv())); + return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Player).GetCiv())); }; /** Index: binaries/data/mods/public/simulation/components/Trainer.js =================================================================== --- binaries/data/mods/public/simulation/components/Trainer.js +++ binaries/data/mods/public/simulation/components/Trainer.js @@ -519,7 +519,7 @@ toks.push(tok); const nativeCiv = Engine.QueryInterface(this.entity, IID_Identity)?.GetCiv(); - const playerCiv = QueryOwnerInterface(this.entity, IID_Identity)?.GetCiv(); + const playerCiv = cmpPlayer?.GetCiv(); const addedDict = addedTokens.reduce((out, token) => { out[token] = true; return out; }, {}); this.entitiesMap = toks.reduce((entMap, token) => { Index: binaries/data/mods/public/simulation/components/tests/test_Builder.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Builder.js +++ binaries/data/mods/public/simulation/components/tests/test_Builder.js @@ -40,14 +40,11 @@ }); AddMock(playerEntityID, IID_Player, { + "GetCiv": () => "iber", "GetDisabledTemplates": () => ({}), "GetPlayerID": () => playerId }); - AddMock(playerEntityID, IID_Identity, { - "GetCiv": () => "iber", - }); - AddMock(builderId, IID_Ownership, { "GetOwner": () => playerId }); @@ -69,6 +66,7 @@ }); AddMock(playerEntityID, IID_Player, { + "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "structures/athen/barracks": true }), "GetPlayerID": () => playerId }); @@ -76,6 +74,7 @@ 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 }); @@ -83,12 +82,9 @@ TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetEntitiesList(), ["structures/iber/civil_centre", "structures/iber/house"]); AddMock(playerEntityID, IID_Player, { - "GetDisabledTemplates": () => ({ "structures/athen/barracks": true }), - "GetPlayerID": () => playerId - }); - - AddMock(playerEntityID, IID_Identity, { "GetCiv": () => "athen", + "GetDisabledTemplates": () => ({ "structures/athen/barracks": true }), + "GetPlayerID": () => playerId }); TS_ASSERT_UNEVAL_EQUALS(cmpBuilder.GetEntitiesList(), ["structures/athen/civil_centre", "structures/iber/house"]); Index: binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js +++ binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js @@ -100,6 +100,8 @@ }); 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; }, @@ -126,12 +128,6 @@ "HasSharedLos": function() { return false; } }); -AddMock(100, IID_Identity, { - "GetName": function() { return "Player 1"; }, - "GetCiv": function() { return "gaia"; }, - "GetRankTechName": function() { return undefined; } -}); - AddMock(100, IID_EntityLimits, { "GetLimits": function() { return { "Foo": 10 }; }, "GetCounts": function() { return { "Foo": 5 }; }, @@ -192,6 +188,8 @@ }); 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; }, @@ -218,12 +216,6 @@ "HasSharedLos": function() { return false; } }); -AddMock(101, IID_Identity, { - "GetName": function() { return "Player 2"; }, - "GetCiv": function() { return "mace"; }, - "GetRankTechName": function() { return undefined; } -}); - AddMock(101, IID_EntityLimits, { "GetLimits": function() { return { "Bar": 20 }; }, "GetCounts": function() { return { "Bar": 0 }; }, Index: binaries/data/mods/public/simulation/components/tests/test_Researcher.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Researcher.js +++ binaries/data/mods/public/simulation/components/tests/test_Researcher.js @@ -23,13 +23,10 @@ }); 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, @@ -56,10 +53,8 @@ ); AddMock(playerEntityID, IID_Player, { - "GetDisabledTechnologies": () => ({ "gather_fishing_net": true }) -}); -AddMock(playerEntityID, IID_Identity, { "GetCiv": () => "athen", + "GetDisabledTechnologies": () => ({ "gather_fishing_net": true }) }); TS_ASSERT_UNEVAL_EQUALS(cmpResearcher.GetTechnologiesList(), ["phase_town_athen", "phase_city_athen"]); @@ -71,11 +66,9 @@ 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"] @@ -102,13 +95,10 @@ }); 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, Index: binaries/data/mods/public/simulation/components/tests/test_Technologies.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Technologies.js +++ binaries/data/mods/public/simulation/components/tests/test_Technologies.js @@ -74,9 +74,7 @@ AddMock(SYSTEM_ENTITY, IID_PlayerManager, { "GetPlayerByID": id => playerEntityID }); -AddMock(playerEntityID, IID_Identity, { - "GetCiv": () => "gaia" -}); + template.cost = { "food": 100 }; Index: binaries/data/mods/public/simulation/components/tests/test_Trainer.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Trainer.js +++ binaries/data/mods/public/simulation/components/tests/test_Trainer.js @@ -39,14 +39,11 @@ }); AddMock(playerEntityID, IID_Player, { + "GetCiv": () => "iber", "GetDisabledTemplates": () => ({}), "GetPlayerID": () => playerID }); -AddMock(playerEntityID, IID_Identity, { - "GetCiv": () => "iber", -}); - AddMock(entityID, IID_Ownership, { "GetOwner": () => playerID }); @@ -75,6 +72,7 @@ }); AddMock(playerEntityID, IID_Player, { + "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }), "GetPlayerID": () => playerID }); @@ -86,6 +84,7 @@ ); AddMock(playerEntityID, IID_Player, { + "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "units/iber/infantry_swordsman_b": true }), "GetPlayerID": () => playerID }); @@ -97,12 +96,9 @@ ); AddMock(playerEntityID, IID_Player, { - "GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }), - "GetPlayerID": () => playerID -}); - -AddMock(playerEntityID, IID_Identity, { "GetCiv": () => "athen", + "GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }), + "GetPlayerID": () => playerID }); cmpTrainer.CalculateEntitiesMap(); @@ -112,14 +108,11 @@ ); 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(), @@ -157,6 +150,7 @@ const cmpPlayer = AddMock(playerEntityID, IID_Player, { "BlockTraining": () => {}, + "GetCiv": () => "iber", "GetPlayerID": () => playerID, "RefundResources": (resources) => { TS_ASSERT_UNEVAL_EQUALS(resources, cost); Index: binaries/data/mods/public/simulation/data/civs/athen.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/athen.json +++ binaries/data/mods/public/simulation/data/civs/athen.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/brit.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/brit.json +++ binaries/data/mods/public/simulation/data/civs/brit.json @@ -1,6 +1,9 @@ { "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": "The_Fledgling_Kingdom.ogg", Index: binaries/data/mods/public/simulation/data/civs/cart.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/cart.json +++ binaries/data/mods/public/simulation/data/civs/cart.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/gaul.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/gaul.json +++ binaries/data/mods/public/simulation/data/civs/gaul.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/han.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/han.json +++ binaries/data/mods/public/simulation/data/civs/han.json @@ -1,6 +1,9 @@ { "Code": "han", "Culture": "china", + "Name": "Han Chinese", + "Emblem": "session/portraits/emblems/emblem_chinese.png", + "History": "The Han dynasty (206 BC – AD 220) was the second imperial dynasty of China, preceded by the Qin dynasty (221–207 BC) and succeeded by the Three Kingdoms period (AD 220–280). It is considered a golden age in Chinese history, and China made significant progress in arts and sciences during the Han period. The core of the Han empire was around the Wei River, and the Han capital was Chang'an, very close to the Qin capital Xianyang (both are now part of Xi'an, Shaanxi).", "Music": [ { "File": "Red_Dawn.ogg", Index: binaries/data/mods/public/simulation/data/civs/iber.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/iber.json +++ binaries/data/mods/public/simulation/data/civs/iber.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/kush.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/kush.json +++ binaries/data/mods/public/simulation/data/civs/kush.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/mace.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/mace.json +++ binaries/data/mods/public/simulation/data/civs/mace.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/maur.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/maur.json +++ binaries/data/mods/public/simulation/data/civs/maur.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/pers.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/pers.json +++ binaries/data/mods/public/simulation/data/civs/pers.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/ptol.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/ptol.json +++ binaries/data/mods/public/simulation/data/civs/ptol.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/rome.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/rome.json +++ binaries/data/mods/public/simulation/data/civs/rome.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/sele.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/sele.json +++ binaries/data/mods/public/simulation/data/civs/sele.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/data/civs/spart.json =================================================================== --- binaries/data/mods/public/simulation/data/civs/spart.json +++ binaries/data/mods/public/simulation/data/civs/spart.json @@ -1,6 +1,9 @@ { "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", Index: binaries/data/mods/public/simulation/helpers/Player.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Player.js +++ binaries/data/mods/public/simulation/helpers/Player.js @@ -59,10 +59,11 @@ for (let i = 0; i < numPlayers; ++i) { - QueryPlayerIDInterface(i, IID_Identity).SetName(getPlayerSetting(i, "Name")); + let cmpPlayer = QueryPlayerIDInterface(i); + cmpPlayer.SetName(getPlayerSetting(i, "Name")); + cmpPlayer.SetCiv(getPlayerSetting(i, "Civ")); - const color = getPlayerSetting(i, "Color"); - const cmpPlayer = QueryPlayerIDInterface(i); + var color = getPlayerSetting(i, "Color"); cmpPlayer.SetColor(color.r, color.g, color.b); // Special case for gaia @@ -129,7 +130,12 @@ function GetPlayerTemplateName(civ) { - return "special/players/" + civ; + let path = "template_player"; + + if (Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager).TemplateExists(path + "_" + civ)) + return path + "_" + civ; + + return path; } /** Index: binaries/data/mods/public/simulation/templates/special/players/athen.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/athen.xml +++ binaries/data/mods/public/simulation/templates/special/players/athen.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_athenians.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/brit.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/brit.xml +++ binaries/data/mods/public/simulation/templates/special/players/brit.xml @@ -3,10 +3,4 @@ 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. - emblems/emblem_britons.png - Index: binaries/data/mods/public/simulation/templates/special/players/cart.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/cart.xml +++ binaries/data/mods/public/simulation/templates/special/players/cart.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_carthaginians.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/gaia.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/gaia.xml +++ binaries/data/mods/public/simulation/templates/special/players/gaia.xml @@ -1,11 +1,5 @@ - - gaia - Gaia - emblems/emblem_gaia.png - true - Index: binaries/data/mods/public/simulation/templates/special/players/gaul.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/gaul.xml +++ binaries/data/mods/public/simulation/templates/special/players/gaul.xml @@ -3,10 +3,4 @@ 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. - emblems/emblem_celts.png - Index: binaries/data/mods/public/simulation/templates/special/players/han.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/han.xml +++ binaries/data/mods/public/simulation/templates/special/players/han.xml @@ -5,19 +5,13 @@ - 1 1 1 + 1 4 9 - - han - Han Chinese - The Han dynasty (206 BC – AD 220) was the second imperial dynasty of China, preceded by the Qin dynasty (221–207 BC) and succeeded by the Three Kingdoms period (AD 220–280). It is considered a golden age in Chinese history, and China made significant progress in arts and sciences during the Han period. The core of the Han empire was around the Wei River, and the Han capital was Chang'an, very close to the Qin capital Xianyang (both are now part of Xi'an, Shaanxi). - emblems/emblem_chinese.png - special/formations/anti_cavalry Index: binaries/data/mods/public/simulation/templates/special/players/iber.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/iber.xml +++ binaries/data/mods/public/simulation/templates/special/players/iber.xml @@ -3,10 +3,4 @@ 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. - emblems/emblem_iberians.png - Index: binaries/data/mods/public/simulation/templates/special/players/kush.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/kush.xml +++ binaries/data/mods/public/simulation/templates/special/players/kush.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_kushites.png - special/formations/syntagma Index: binaries/data/mods/public/simulation/templates/special/players/mace.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/mace.xml +++ binaries/data/mods/public/simulation/templates/special/players/mace.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_macedonians.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/maur.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/maur.xml +++ binaries/data/mods/public/simulation/templates/special/players/maur.xml @@ -3,10 +3,4 @@ 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. - emblems/emblem_mauryas.png - Index: binaries/data/mods/public/simulation/templates/special/players/pers.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/pers.xml +++ binaries/data/mods/public/simulation/templates/special/players/pers.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_persians.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/ptol.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/ptol.xml +++ binaries/data/mods/public/simulation/templates/special/players/ptol.xml @@ -11,12 +11,6 @@ - - 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. - emblems/emblem_ptolemies.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/rome.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/rome.xml +++ binaries/data/mods/public/simulation/templates/special/players/rome.xml @@ -3,12 +3,6 @@ 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. - emblems/emblem_romans.png - special/formations/testudo Index: binaries/data/mods/public/simulation/templates/special/players/sele.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/sele.xml +++ binaries/data/mods/public/simulation/templates/special/players/sele.xml @@ -11,12 +11,6 @@ - - sele - Seleucids - The Macedonian-Greek dynasty that ruled most of Alexander's former empire. - emblems/emblem_seleucids.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/special/players/spart.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/players/spart.xml +++ binaries/data/mods/public/simulation/templates/special/players/spart.xml @@ -1,12 +1,6 @@ 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. - emblems/emblem_spartans.png - special/formations/phalanx Index: binaries/data/mods/public/simulation/templates/template_player.xml =================================================================== --- binaries/data/mods/public/simulation/templates/template_player.xml +++ binaries/data/mods/public/simulation/templates/template_player.xml @@ -49,10 +49,6 @@ - - Player - true - Index: source/ps/TemplateLoader.h =================================================================== --- source/ps/TemplateLoader.h +++ source/ps/TemplateLoader.h @@ -67,12 +67,6 @@ */ 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, Index: source/ps/TemplateLoader.cpp =================================================================== --- source/ps/TemplateLoader.cpp +++ source/ps/TemplateLoader.cpp @@ -105,21 +105,6 @@ 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; @@ -159,17 +144,6 @@ 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()) Index: source/simulation2/Simulation2.h =================================================================== --- source/simulation2/Simulation2.h +++ source/simulation2/Simulation2.h @@ -248,6 +248,13 @@ */ std::vector GetRMSData(); + /** + * Get civilization data + * + * @return vector of strings containing JSON format data + */ + std::vector GetCivData(); + /** * Get victory condition data * Index: source/simulation2/Simulation2.cpp =================================================================== --- source/simulation2/Simulation2.cpp +++ source/simulation2/Simulation2.cpp @@ -945,6 +945,11 @@ 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/"); Index: source/simulation2/components/CCmpRallyPointRenderer.h =================================================================== --- source/simulation2/components/CCmpRallyPointRenderer.h +++ source/simulation2/components/CCmpRallyPointRenderer.h @@ -26,7 +26,6 @@ #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" Index: source/simulation2/components/CCmpRallyPointRenderer.cpp =================================================================== --- source/simulation2/components/CCmpRallyPointRenderer.cpp +++ source/simulation2/components/CCmpRallyPointRenderer.cpp @@ -273,13 +273,13 @@ if (!cmpPlayerManager) continue; - CmpPtr cmpIdentity(GetSimContext(), cmpPlayerManager->GetPlayerByID(ownerId)); - if (!cmpIdentity) + CmpPtr cmpPlayer(GetSimContext(), cmpPlayerManager->GetPlayerByID(ownerId)); + if (!cmpPlayer) continue; CmpPtr cmpVisualActor(GetSimContext(), m_MarkerEntityIds[i]); if (cmpVisualActor) - cmpVisualActor->SetVariant("civ", CStrW(cmpIdentity->GetCiv()).ToUTF8()); + cmpVisualActor->SetVariant("civ", CStrW(cmpPlayer->GetCiv()).ToUTF8()); } m_LastMarkerCount = m_RallyPoints.size() - 1; } Index: source/simulation2/components/CCmpTemplateManager.cpp =================================================================== --- source/simulation2/components/CCmpTemplateManager.cpp +++ source/simulation2/components/CCmpTemplateManager.cpp @@ -113,8 +113,6 @@ std::vector FindAllTemplates(bool includeActors) const override; - std::vector> GetCivData() override; - std::vector FindUsedTemplates() const override; std::vector GetEntitiesUsingTemplate(const std::string& templateName) const override; @@ -217,23 +215,6 @@ 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; Index: source/simulation2/components/ICmpIdentity.h =================================================================== --- source/simulation2/components/ICmpIdentity.h +++ source/simulation2/components/ICmpIdentity.h @@ -31,8 +31,6 @@ virtual std::wstring GetPhenotype() = 0; - virtual std::wstring GetCiv() = 0; - DECLARE_INTERFACE_TYPE(Identity) }; Index: source/simulation2/components/ICmpIdentity.cpp =================================================================== --- source/simulation2/components/ICmpIdentity.cpp +++ source/simulation2/components/ICmpIdentity.cpp @@ -40,11 +40,6 @@ { return m_Script.Call("GetPhenotype"); } - - std::wstring GetCiv() override - { - return m_Script.Call("GetCiv"); - } }; REGISTER_COMPONENT_SCRIPT_WRAPPER(IdentityScripted) Index: source/simulation2/components/ICmpPlayer.h =================================================================== --- source/simulation2/components/ICmpPlayer.h +++ source/simulation2/components/ICmpPlayer.h @@ -33,6 +33,7 @@ { public: virtual CColor GetDisplayedColor() = 0; + virtual std::wstring GetCiv() = 0; virtual CFixedVector3D GetStartingCameraPos() = 0; virtual CFixedVector3D GetStartingCameraRot() = 0; Index: source/simulation2/components/ICmpPlayer.cpp =================================================================== --- source/simulation2/components/ICmpPlayer.cpp +++ source/simulation2/components/ICmpPlayer.cpp @@ -37,6 +37,11 @@ return m_Script.Call("GetDisplayedColor"); } + std::wstring GetCiv() override + { + return m_Script.Call("GetCiv"); + } + CFixedVector3D GetStartingCameraPos() override { return m_Script.Call("GetStartingCameraPos"); Index: source/simulation2/components/ICmpTemplateManager.h =================================================================== --- source/simulation2/components/ICmpTemplateManager.h +++ source/simulation2/components/ICmpTemplateManager.h @@ -103,12 +103,6 @@ */ 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. Index: source/simulation2/components/ICmpTemplateManager.cpp =================================================================== --- source/simulation2/components/ICmpTemplateManager.cpp +++ source/simulation2/components/ICmpTemplateManager.cpp @@ -27,6 +27,5 @@ 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) Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp @@ -583,11 +583,12 @@ wxArrayString civCodes; AtlasMessage::qGetCivData qryCiv; qryCiv.Post(); - std::vector> civData = *qryCiv.data; - for (const std::vector& civ : civData) + std::vector civData = *qryCiv.data; + for (size_t i = 0; i < civData.size(); ++i) { - civCodes.Add(civ[0]); - civNames.Add(civ[1]); + AtObj civ = AtlasObject::LoadFromJSON(civData[i]); + civNames.Add(wxString::FromUTF8(civ["Name"])); + civCodes.Add(wxString::FromUTF8(civ["Code"])); } // Load AI data Index: source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp @@ -21,14 +21,13 @@ #include "ps/Game.h" #include "simulation2/Simulation2.h" -#include "simulation2/components/ICmpTemplateManager.h" + namespace AtlasMessage { QUERYHANDLER(GetCivData) { - CmpPtr cmpTemplateManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY); - msg->data = cmpTemplateManager->GetCivData(); + msg->data = g_Game->GetSimulation2()->GetCivData(); } QUERYHANDLER(GetPlayerDefaults) Index: source/tools/atlas/GameInterface/Messages.h =================================================================== --- source/tools/atlas/GameInterface/Messages.h +++ source/tools/atlas/GameInterface/Messages.h @@ -243,7 +243,7 @@ QUERY(GetCivData, , - ((std::vector>, data)) + ((std::vector, data)) ); QUERY(GetVictoryConditionData,