Index: ps/trunk/binaries/data/mods/public/globalscripts/Templates.js =================================================================== --- ps/trunk/binaries/data/mods/public/globalscripts/Templates.js +++ ps/trunk/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 @@ 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; Index: ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateLoader.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateLoader.js +++ ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateLoader.js @@ -222,11 +222,13 @@ */ 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,18 +323,12 @@ * 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. */ TemplateLoader.prototype.AuraTranslateKeys = ["auraName", "auraDescription"]; Index: ps/trunk/binaries/data/mods/public/l10n/messages.json =================================================================== --- ps/trunk/binaries/data/mods/public/l10n/messages.json +++ ps/trunk/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": {} + ] + } } ] }, Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_Constraint.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_Constraint.js +++ ps/trunk/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 }; Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js +++ ps/trunk/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"); { Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js +++ ps/trunk/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 }; Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_RectPlacer.js +++ ps/trunk/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 }; Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js +++ ps/trunk/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 }; Index: ps/trunk/binaries/data/mods/public/maps/random/tests/test_TileClass.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/tests/test_TileClass.js +++ ps/trunk/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 }; Index: ps/trunk/binaries/data/mods/public/simulation/components/Builder.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Builder.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Builder.js @@ -43,7 +43,7 @@ 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(); Index: ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js +++ ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -62,12 +62,14 @@ 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 @@ } ret.players.push({ - "name": cmpPlayer.GetName(), - "civ": cmpPlayer.GetCiv(), + "name": cmpIdentity.GetName(), + "civ": cmpIdentity.GetCiv(), "color": cmpPlayer.GetColor(), "controlsAll": cmpPlayer.CanControlAllUnits(), "popCount": cmpPlayer.GetPopulationCount(), Index: ps/trunk/binaries/data/mods/public/simulation/components/Identity.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Identity.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Identity.js @@ -181,6 +181,22 @@ 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) { Index: ps/trunk/binaries/data/mods/public/simulation/components/Player.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Player.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Player.js @@ -50,8 +50,6 @@ 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 @@ 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 @@ // 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; }; /** Index: ps/trunk/binaries/data/mods/public/simulation/components/Researcher.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Researcher.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Researcher.js @@ -180,18 +180,26 @@ 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]; Index: ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js +++ ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js @@ -28,11 +28,10 @@ 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); Index: ps/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js +++ ps/trunk/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_Player).GetCiv())); + return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Identity).GetCiv())); }; /** Index: ps/trunk/binaries/data/mods/public/simulation/components/Trainer.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Trainer.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Trainer.js @@ -513,7 +513,7 @@ 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) => { Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Builder.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Builder.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Builder.js @@ -40,11 +40,14 @@ }); 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 @@ }); AddMock(playerEntityID, IID_Player, { - "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "structures/athen/barracks": true }), "GetPlayerID": () => playerId }); @@ -74,7 +76,6 @@ 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 @@ 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 }); Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js @@ -100,8 +100,6 @@ }); 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 @@ "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(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 @@ "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 }; }, Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Researcher.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Researcher.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Researcher.js @@ -23,10 +23,13 @@ }); 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 @@ ); 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 @@ 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 @@ }); 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: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Technologies.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Technologies.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Technologies.js @@ -74,7 +74,9 @@ AddMock(SYSTEM_ENTITY, IID_PlayerManager, { "GetPlayerByID": id => playerEntityID }); - +AddMock(playerEntityID, IID_Identity, { + "GetCiv": () => "gaia" +}); template.cost = { "food": 100 }; Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Trainer.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Trainer.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Trainer.js @@ -39,11 +39,14 @@ }); 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(playerEntityID, IID_Player, { - "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "units/athen/infantry_swordsman_b": true }), "GetPlayerID": () => playerID }); @@ -84,7 +86,6 @@ ); AddMock(playerEntityID, IID_Player, { - "GetCiv": () => "iber", "GetDisabledTemplates": () => ({ "units/iber/infantry_swordsman_b": true }), "GetPlayerID": () => playerID }); @@ -96,11 +97,14 @@ ); 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 @@ ); 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 @@ const cmpPlayer = AddMock(playerEntityID, IID_Player, { "BlockTraining": () => {}, - "GetCiv": () => "iber", "GetPlayerID": () => playerID, "RefundResources": (resources) => { TS_ASSERT_UNEVAL_EQUALS(resources, cost); Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/athen.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/athen.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/brit.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/brit.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/cart.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/cart.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/gaul.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/gaul.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/iber.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/iber.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/kush.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/kush.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/mace.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/mace.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/maur.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/maur.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/pers.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/pers.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/ptol.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/ptol.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/rome.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/rome.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/sele.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/sele.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/data/civs/spart.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/civs/spart.json +++ ps/trunk/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", Index: ps/trunk/binaries/data/mods/public/simulation/helpers/Player.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/helpers/Player.js +++ ps/trunk/binaries/data/mods/public/simulation/helpers/Player.js @@ -75,11 +75,10 @@ // 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 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; } /** Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml @@ -0,0 +1,120 @@ + + + + 80 + 160 + 60000 + + + 200 + 12 + 0.04 + 4 + 0 + 8 + + + + 50 + 1 + 10 + 0 + 1 + 1 + 1 + 1 + 5 + 2 + 0 + 2 + 4 + 1 + 1 + 1 + 30 + 20 + 1 + + + + 15 + + + 4 + + + 5 + + + + + phase_town + + + + + Player + true + + + + + 1.0 + 1.0 + 1.0 + 1.0 + + + 1.0 + 1.0 + 1.0 + 1.0 + + + unlock_shared_los + unlock_shared_dropsites + 1.0 + + + + 0.0 + 0.0 + 0.0 + 0.0 + + 1000 + + + + interface/alarm/alarm_defeated.xml + interface/alarm/alarm_defeated_ally.xml + interface/alarm/alarm_defeated_enemy.xml + interface/alarm/alarm_no_idle_unit.xml + + + + + + Cavalry + Champion + Domestic + FemaleCitizen + Hero + Infantry + Ship + Siege + Trader + Worker + + + Economic + CivCentre + Fortress + House + Military + Outpost + Wonder + + + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player.xml @@ -1,122 +0,0 @@ - - - - 80 - 160 - 60000 - - - 200 - 12 - 0.04 - 4 - 0 - 8 - - - - 50 - 1 - 10 - 0 - 1 - 1 - 1 - 1 - 5 - 2 - 0 - 2 - 4 - 1 - 1 - 1 - 30 - 20 - 1 - - - - 15 - - - 4 - - - 5 - - - - - phase_town - - - - - - Player - Player - true - - - - - 1.0 - 1.0 - 1.0 - 1.0 - - - 1.0 - 1.0 - 1.0 - 1.0 - - - unlock_shared_los - unlock_shared_dropsites - 1.0 - - - - 0.0 - 0.0 - 0.0 - 0.0 - - 1000 - - - - interface/alarm/alarm_defeated.xml - interface/alarm/alarm_defeated_ally.xml - interface/alarm/alarm_defeated_enemy.xml - interface/alarm/alarm_no_idle_unit.xml - - - - - - Cavalry - Champion - Domestic - FemaleCitizen - Hero - Infantry - Ship - Siege - Trader - Worker - - - Economic - CivCentre - Fortress - House - Military - Outpost - Wonder - - - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_athen.xml @@ -1,6 +0,0 @@ - - - - teambonuses/athen_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_brit.xml @@ -1,6 +0,0 @@ - - - - teambonuses/brit_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_cart.xml @@ -1,6 +0,0 @@ - - - - teambonuses/cart_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml @@ -1,22 +0,0 @@ - - - - - - 1.0 - - - 1.0 - 1.0 - 1.0 - 1.0 - - - 1.0 - 1.0 - 1.0 - 1.0 - - - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml @@ -1,6 +0,0 @@ - - - - teambonuses/gaul_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_iber.xml @@ -1,6 +0,0 @@ - - - - teambonuses/iber_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_kush.xml @@ -1,6 +0,0 @@ - - - - teambonuses/kush_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_mace.xml @@ -1,6 +0,0 @@ - - - - teambonuses/mace_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_maur.xml @@ -1,6 +0,0 @@ - - - - teambonuses/maur_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_pers.xml @@ -1,6 +0,0 @@ - - - - teambonuses/pers_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml @@ -1,14 +0,0 @@ - - - - teambonuses/ptol_player_teambonus - - - - - phase_town - Hero - - - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_rome.xml @@ -1,6 +0,0 @@ - - - - teambonuses/rome_player_teambonus - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_sele.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_sele.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_sele.xml @@ -1,14 +0,0 @@ - - - - teambonuses/sele_player_teambonus - - - - - phase_town - Hero - - - - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player/player_spart.xml @@ -1,4 +0,0 @@ - - - teambonuses/spart_player_teambonus - Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/athen.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/athen.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/brit.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/brit.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/cart.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/cart.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/gaia.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/gaia.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/players/gaia.xml @@ -0,0 +1,27 @@ + + + + gaia + Gaia + true + + + + + 1.0 + + + 1.0 + 1.0 + 1.0 + 1.0 + + + 1.0 + 1.0 + 1.0 + 1.0 + + + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/gaul.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/gaul.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/iber.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/iber.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/kush.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/kush.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/mace.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/mace.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/maur.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/maur.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/pers.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/pers.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/ptol.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/ptol.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/rome.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/rome.xml +++ ps/trunk/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 + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/sele.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/sele.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/special/players/sele.xml @@ -0,0 +1,20 @@ + + + + teambonuses/sele_player_teambonus + + + + + phase_town + Hero + + + + + sele + Seleucids + The Macedonian-Greek dynasty that ruled most of Alexander's former empire. + session/portraits/emblems/emblem_seleucids.png + + Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/players/spart.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/special/players/spart.xml +++ ps/trunk/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 + + Index: ps/trunk/source/ps/TemplateLoader.h =================================================================== --- ps/trunk/source/ps/TemplateLoader.h +++ ps/trunk/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 @@ */ 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: ps/trunk/source/ps/TemplateLoader.cpp =================================================================== --- ps/trunk/source/ps/TemplateLoader.cpp +++ ps/trunk/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 @@ 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 @@ 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: ps/trunk/source/simulation2/Simulation2.h =================================================================== --- ps/trunk/source/simulation2/Simulation2.h +++ ps/trunk/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 @@ -249,13 +249,6 @@ std::vector GetRMSData(); /** - * Get civilization data - * - * @return vector of strings containing JSON format data - */ - std::vector GetCivData(); - - /** * Get victory condition data * * @return vector of strings containing JSON format data Index: ps/trunk/source/simulation2/Simulation2.cpp =================================================================== --- ps/trunk/source/simulation2/Simulation2.cpp +++ ps/trunk/source/simulation2/Simulation2.cpp @@ -945,11 +945,6 @@ 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: ps/trunk/source/simulation2/components/CCmpRallyPointRenderer.h =================================================================== --- ps/trunk/source/simulation2/components/CCmpRallyPointRenderer.h +++ ps/trunk/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" Index: ps/trunk/source/simulation2/components/CCmpRallyPointRenderer.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpRallyPointRenderer.cpp +++ ps/trunk/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 @@ 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; } Index: ps/trunk/source/simulation2/components/CCmpTemplateManager.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpTemplateManager.cpp +++ ps/trunk/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 @@ 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 @@ 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: ps/trunk/source/simulation2/components/ICmpIdentity.h =================================================================== --- ps/trunk/source/simulation2/components/ICmpIdentity.h +++ ps/trunk/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 @@ virtual std::wstring GetPhenotype() = 0; + virtual std::wstring GetCiv() = 0; + DECLARE_INTERFACE_TYPE(Identity) }; Index: ps/trunk/source/simulation2/components/ICmpIdentity.cpp =================================================================== --- ps/trunk/source/simulation2/components/ICmpIdentity.cpp +++ ps/trunk/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 @@ { return m_Script.Call("GetPhenotype"); } + + virtual std::wstring GetCiv() + { + return m_Script.Call("GetCiv"); + } }; REGISTER_COMPONENT_SCRIPT_WRAPPER(IdentityScripted) Index: ps/trunk/source/simulation2/components/ICmpPlayer.h =================================================================== --- ps/trunk/source/simulation2/components/ICmpPlayer.h +++ ps/trunk/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 @@ { public: virtual CColor GetDisplayedColor() = 0; - virtual std::wstring GetCiv() = 0; virtual CFixedVector3D GetStartingCameraPos() = 0; virtual CFixedVector3D GetStartingCameraRot() = 0; Index: ps/trunk/source/simulation2/components/ICmpPlayer.cpp =================================================================== --- ps/trunk/source/simulation2/components/ICmpPlayer.cpp +++ ps/trunk/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 @@ return m_Script.Call("GetDisplayedColor"); } - virtual std::wstring GetCiv() - { - return m_Script.Call("GetCiv"); - } - virtual CFixedVector3D GetStartingCameraPos() { return m_Script.Call("GetStartingCameraPos"); Index: ps/trunk/source/simulation2/components/ICmpTemplateManager.h =================================================================== --- ps/trunk/source/simulation2/components/ICmpTemplateManager.h +++ ps/trunk/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 @@ -104,6 +104,12 @@ 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: ps/trunk/source/simulation2/components/ICmpTemplateManager.cpp =================================================================== --- ps/trunk/source/simulation2/components/ICmpTemplateManager.cpp +++ ps/trunk/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("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: ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp =================================================================== --- ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp +++ ps/trunk/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 @@ 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 Index: ps/trunk/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp =================================================================== --- ps/trunk/source/tools/atlas/GameInterface/Handlers/PlayerHandlers.cpp +++ ps/trunk/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) Index: ps/trunk/source/tools/atlas/GameInterface/Messages.h =================================================================== --- ps/trunk/source/tools/atlas/GameInterface/Messages.h +++ ps/trunk/source/tools/atlas/GameInterface/Messages.h @@ -243,7 +243,7 @@ QUERY(GetCivData, , - ((std::vector, data)) + ((std::vector>, data)) ); QUERY(GetVictoryConditionData, Index: ps/trunk/source/tools/entity/checkrefs.pl =================================================================== --- ps/trunk/source/tools/entity/checkrefs.pl +++ ps/trunk/source/tools/entity/checkrefs.pl @@ -536,8 +536,6 @@ 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}}; } }