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", "Name", "Emblem", "History", "Music", "CivBonuses", "StartEntities", + "Code", "Culture", "Music", "CivBonuses", "StartEntities", "Formations", "AINames", "SkirmishReplacements", "SelectableInGameSetup"]; let civData = {}; @@ -20,6 +20,11 @@ if (data[prop] === undefined) throw new Error(filename + " doesn't contain " + prop); + const template = Engine.GetTemplate("special/player/player_" + data.Code); + data.Name = template.Identity.GenericName; + data.Emblem = template.Identity.Icon; + data.History = template.Identity.History; + if (!selectableOnly || data.SelectableInGameSetup) civData[data.Code] = data; } 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()); - 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: binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- binaries/data/mods/public/simulation/components/GuiInterface.js +++ binaries/data/mods/public/simulation/components/GuiInterface.js @@ -64,6 +64,7 @@ { let cmpPlayer = QueryPlayerIDInterface(i); let cmpPlayerEntityLimits = QueryPlayerIDInterface(i, IID_EntityLimits); + const cmpIdentity = QueryPlayerIDInterface(i, IID_Identity); // Work out which phase we are in. let phase = ""; @@ -92,8 +93,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: binaries/data/mods/public/simulation/components/Identity.js =================================================================== --- binaries/data/mods/public/simulation/components/Identity.js +++ binaries/data/mods/public/simulation/components/Identity.js @@ -181,6 +181,16 @@ this.phenotype = phenotype; }; +Identity.prototype.SetName = function(newName) +{ + this.name = newName; +}; + +Identity.prototype.GetName = function() +{ + return this.name || this.template.GenericName; +}; + function IdentityMirage() {} IdentityMirage.prototype.Init = function(cmpIdentity) { 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 @@ -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: binaries/data/mods/public/simulation/components/Researcher.js =================================================================== --- binaries/data/mods/public/simulation/components/Researcher.js +++ binaries/data/mods/public/simulation/components/Researcher.js @@ -184,10 +184,13 @@ if (!cmpTechnologyManager) return []; + const civ = QueryOwnerInterface(this.entity, IID_Identity)?.GetCiv(); + if (!civ) + return []; + const cmpPlayer = QueryOwnerInterface(this.entity); if (!cmpPlayer) return []; - const civ = cmpPlayer.GetCiv(); let techs = string.split(/\s+/); 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,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: 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_Player).GetCiv())); + return this.CheckTechnologyRequirements(DeriveTechnologyRequirements(template, Engine.QueryInterface(this.entity, IID_Identity).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 @@ -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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: 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,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: binaries/data/mods/public/simulation/helpers/Player.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Player.js +++ binaries/data/mods/public/simulation/helpers/Player.js @@ -76,8 +76,7 @@ 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"); cmpPlayer.SetColor(color.r, color.g, color.b); Index: binaries/data/mods/public/simulation/templates/special/player/player.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player.xml +++ binaries/data/mods/public/simulation/templates/special/player/player.xml @@ -53,7 +53,6 @@ - Player Player true Index: binaries/data/mods/public/simulation/templates/special/player/player_athen.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_athen.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_athen.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_brit.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_brit.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_brit.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_cart.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_cart.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_cart.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_gaia.xml @@ -1,5 +1,10 @@ + + gaia + Gaia + true + Index: binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_gaul.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_iber.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_iber.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_iber.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_kush.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_kush.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_kush.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_mace.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_mace.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_mace.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_maur.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_maur.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_maur.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_pers.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_pers.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_pers.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_ptol.xml @@ -11,4 +11,10 @@ + + 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: binaries/data/mods/public/simulation/templates/special/player/player_rome.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_rome.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_rome.xml @@ -3,4 +3,10 @@ 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: binaries/data/mods/public/simulation/templates/special/player/player_sele.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_sele.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_sele.xml @@ -11,4 +11,10 @@ + + sele + Seleucids + The Macedonian-Greek dynasty that ruled most of Alexander's former empire. + session/portraits/emblems/emblem_seleucids.png + Index: binaries/data/mods/public/simulation/templates/special/player/player_spart.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player_spart.xml +++ binaries/data/mods/public/simulation/templates/special/player/player_spart.xml @@ -1,4 +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: source/simulation2/Simulation2.h =================================================================== --- source/simulation2/Simulation2.h +++ source/simulation2/Simulation2.h @@ -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: source/simulation2/Simulation2.cpp =================================================================== --- source/simulation2/Simulation2.cpp +++ 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: source/simulation2/components/CCmpRallyPointRenderer.h =================================================================== --- source/simulation2/components/CCmpRallyPointRenderer.h +++ 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: source/simulation2/components/CCmpRallyPointRenderer.cpp =================================================================== --- source/simulation2/components/CCmpRallyPointRenderer.cpp +++ 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: source/simulation2/components/CCmpTemplateManager.cpp =================================================================== --- source/simulation2/components/CCmpTemplateManager.cpp +++ 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,10 @@ virtual std::vector FindAllTemplates(bool includeActors) const; + virtual std::vector FindTemplates(const std::string& path, bool recursive) const; + + virtual std::vector> GetCivData() const; + virtual std::vector FindUsedTemplates() const; virtual std::vector GetEntitiesUsingTemplate(const std::string& templateName) const; @@ -215,6 +219,28 @@ return m_templateLoader.FindTemplates("", true, templatesType); } +std::vector CCmpTemplateManager::FindTemplates(const std::string& path, bool recursive) const +{ + return m_templateLoader.FindTemplates(path, recursive, SIMULATION_TEMPLATES); +} + +std::vector> CCmpTemplateManager::GetCivData() const +{ + std::vector> data; + + std::vector names = FindTemplates("templates/special/player", false); + for (std::vector::iterator it = names.begin(); it != names.end(); ++it) + { + std::string name(it->begin(), it->end()); +// const CParamNode& identity = GetTemplate(name)->GetChild("Identity"); +// data.push_back(std::vector( +// identity.GetChild("Civ").ToString(), +// identity.GetChild("Name").ToString() +// )); + } + 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,6 +31,8 @@ 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,6 +40,11 @@ { return m_Script.Call("GetPhenotype"); } + + virtual std::wstring GetCiv() + { + 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 @@ -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: source/simulation2/components/ICmpPlayer.cpp =================================================================== --- source/simulation2/components/ICmpPlayer.cpp +++ 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: source/simulation2/components/ICmpTemplateManager.h =================================================================== --- source/simulation2/components/ICmpTemplateManager.h +++ 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 @@ -105,6 +105,13 @@ /** * Returns a list of strings that could be validly passed as @c templateName to LoadTemplate. + * (This includes "actor|foo" etc names). + * Intended for use by the map editor. This is likely to be quite slow. + */ + virtual std::vector> GetCivData() const = 0; + + /** + * Returns a list of strings that could be validly passed as @c templateName to LoadTemplate. * Intended for use by the AI manager. */ virtual std::vector FindUsedTemplates() const = 0; Index: source/simulation2/components/ICmpTemplateManager.cpp =================================================================== --- source/simulation2/components/ICmpTemplateManager.cpp +++ 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: 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 @@ -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(wxString::FromUTF8(civ[0])); + civNames.Add(wxString::FromUTF8(civ[1])); } // 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 @@ -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: 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,