Skip to content

Commit

Permalink
DiscoveredBy Vanilla Feature (#562)
Browse files Browse the repository at this point in the history
* mb fixes

* DiscoveredBy Vanilla Feature

* clang

---------

Co-authored-by: Zemurin <[email protected]>
  • Loading branch information
Zemurin and Zemurin authored Jul 8, 2024
1 parent 7d1d4a7 commit a890f5a
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1.6.0 = {
1.12.0 = {
link = { comment = "## Asia" }
link = { comment = "# Machuria, Siberia" }
link = { ck3 = 12488 eu4 = 4653 } # c_xianzhou_sumo_china -> Maolian
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1.6.0 = {
1.12.0 = {
link = { comment = "## Asia" }
link = { comment = "# Machuria, Siberia" }
link = { ck3 = 12488 eu4 = 4653 } # c_xianzhou_sumo_china -> Maolian
Expand Down
31 changes: 25 additions & 6 deletions CK3ToEU4/Data_Files/fronter-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ option = { # We support this, but manually, if players wish it.
tooltip = AZTECTIP
radioSelector = {
radioOption = {
name = 2
displayName = AZTEC2
tooltip = AZTEC2TIP
name = 1
displayName = AZTEC1
tooltip = AZTEC1TIP
default = true
}
radioOption = {
name = 3
displayName = AZTEC3
tooltip = AZTEC3TIP
name = 2
displayName = AZTEC2
tooltip = AZTEC2TIP
default = false
}
}
Expand Down Expand Up @@ -285,6 +285,25 @@ option = { #Dynastic names
}
}
}
option = { #Provincial discovered_by
name = discoveredBy
displayName = DISCOVEREDBY
tooltip = DISCOVEREDBYTIP
radioSelector = {
radioOption = {
name = 1
displayName = DISCOVEREDBY1
tooltip = DISCOVEREDBY1TIP
default = true
}
radioOption = {
name = 2
displayName = DISCOVEREDBY2
tooltip = DISCOVEREDBY2TIP
default = false
}
}
}
option = {
name = output_name
displayName = MODNAME
Expand Down
15 changes: 11 additions & 4 deletions CK3ToEU4/Data_Files/options_l_english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ l_english:
GULAG3TIP: "Leave as is."
AZTEC: "Should we summon the Aztecs?"
AZTECTIP: "How should we deal with Sunset Invasion?"
AZTEC2: "No, for the love of God."
AZTEC2TIP: "The New World will be in its vanilla state."
AZTEC3: "Yes, for Mictlantecuhtli!"
AZTEC3TIP: "The Aztec-Incan War will be remembered by historians."
AZTEC1: "No, for the love of God."
AZTEC1TIP: "The New World will be in its vanilla state."
AZTEC2: "Yes, for Mictlantecuhtli!"
AZTEC2TIP: "The Aztec-Incan War will be remembered by historians."
INSTITUTIONS: "Should institutions and idea selection be dynamic?"
INSTITUTIONSTIP: "Should we use the vanilla institution spawn rules/idea selection or should we use a dynamic system?"
INSTITUTIONS1: "Historic (Vanilla)"
Expand All @@ -90,3 +90,10 @@ l_english:
SPLITVASSALS: "Split large vassals into EU4 vassal states?"
SPLITVASSALSTIP: "Only extraordinarily large vassals will be granted autonomy."
YES1: "Yes [recommended]"
DISCOVEREDBY: "CK Provinces are visible/discovered by:"
DISCOVEREDBYTIP: "Who sees the provinces in CK scope?"
DISCOVEREDBY1: "Vanilla (default)."
DISCOVEREDBYTIP1: "Import vanilla visibility."
DISCOVEREDBY2: "Dynamic."
DISCOVEREDBYTIP2: "Basically, everyone in scope."

18 changes: 12 additions & 6 deletions CK3ToEU4/Data_Files/options_l_french.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ l_french:
DEVELO1TIP: "La bonne façon."
DEVELO2: "Non, respectez la vanille EU4 [déconseillé]"
DEVELO2TIP: "Laissez tel quel."
MULTIPROV: "Élargir les sources de transfert de développement ?"
MULTIPROV: "Élargir les sources de transfert de développement?"
MULTIPROVTIP: "Utile pour les jeux MP compétitifs afin de retenir les développeurs.."
MULTIPROV1: "Maintenir une propagation de développement stable."
MULTIPROV1TIP: "Le défaut."
Expand All @@ -67,17 +67,17 @@ l_french:
GULAG3TIP: "Laissez tel quel."
AZTEC: "Faut-il invoquer les Aztèques?"
AZTECTIP: "Comment devons-nous faire face à l'Invasion du Crépuscule?"
AZTEC2: "Non, pour l'amour de Dieu."
AZTEC2TIP: "Le Nouveau Monde sera dans son état vanille."
AZTEC3: "Oui, pour Mictlantecuhtli!"
AZTEC3TIP: "Les historiens se souviendront de la guerre aztèque-inca."
AZTEC1: "Non, pour l'amour de Dieu."
AZTEC1TIP: "Le Nouveau Monde sera dans son état vanille."
AZTEC2: "Oui, pour Mictlantecuhtli!"
AZTEC2TIP: "Les historiens se souviendront de la guerre aztèque-inca."
INSTITUTIONS: "Est-ce que les institutions et la sélection des idées doivent être dynamiques?"
INSTITUTIONSTIP: "Choisissons-nous des règles d'apparition des institutions et de sélection des idées selon le jeu vanille ou un système plus dynamique?"
INSTITUTIONS1: "Historique (jeu vanille)"
INSTITUTIONS1TIP: "On suive les règles du jeu vanille."
INSTITUTIONS2: "Dynamique"
INSTITUTIONS2TIP: "On crée des règles dynamiques."
DYNASTICNAMES: "Utilisons-nous des noms dynastiques lorsqu’ils sont disponibles ?"
DYNASTICNAMES: "Utilisons-nous des noms dynastiques lorsqu’ils sont disponibles?"
DYNASTICNAMESTIP: "Principalement pour les nations islamiques qui utilisent le nom de la dynastie dans leur titre."
DYNASTICNAMES1: "Oui, je veux des Ottomans."
DYNASTICNAMES1TIP: "Utiliser lorsque cela est possible et approprié."
Expand All @@ -90,4 +90,10 @@ l_french:
SPLITVASSALS: "Diviser les grands vassaux en États vassaux de EU4?"
SPLITVASSALSTIP: "Seulement les vassaux extraordinairement grands se verront accorder l'autonomie."
YES1: "Oui [recommandé]"
DISCOVEREDBY: "Les provinces CK sont visibles/découvertes par:"
DISCOVEREDBYTIP: "Qui voit les provinces dans le périmètre CK?"
DISCOVEREDBY1: "Vanille (par défaut)."
DISCOVEREDBYTIP1: "Importez la visibilité Vanilla."
DISCOVEREDBY2: "Dynamique."
DISCOVEREDBYTIP2: "En gros, tout le monde est concerné."

14 changes: 10 additions & 4 deletions CK3ToEU4/Data_Files/options_l_german.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ l_german:
GULAG3TIP: "Lass es wie es ist."
AZTEC: "Sollen wir die Azteken herbeirufen?"
AZTECTIP: "Wie sollen wir mit dem Sunset Invasion umgehen?"
AZTEC2: "Nein, Gottes Liebe!"
AZTEC2TIP: "Die Neue Welt wird in ihrem Vanillezustand sein."
AZTEC3: "Ja, für Mictlantecuhtli!"
AZTEC3TIP: "An den Azteken-Inka-Krieg werden sich Historiker erinnern."
AZTEC1: "Nein, Gottes Liebe!"
AZTEC1TIP: "Die Neue Welt wird in ihrem Vanillezustand sein."
AZTEC2: "Ja, für Mictlantecuhtli!"
AZTEC2TIP: "An den Azteken-Inka-Krieg werden sich Historiker erinnern."
INSTITUTIONS: "Sollten Institutionenerzeugungen und Ideenauswahl dynamisch sein?"
INSTITUTIONSTIP: "Sollten wir die Regeln über Institutionenerzeugungen und Ideenauswahl gemäß Vanilla kopieren oder neu und dynamisch schaffen?"
INSTITUTIONS1: "Geschichtisch (gemäß Vanilla)"
Expand All @@ -90,3 +90,9 @@ l_german:
SPLITVASSALS: "Große Vasallen in EU4-Vasallenstaaten aufteilen?"
SPLITVASSALSTIP: "Nur außerordentlich große Vasallen erhalten Autonomie."
YES1: "Ja [Empfohlen]"
DISCOVEREDBY: "CK-Provinzen sind sichtbar/entdeckt durch:"
DISCOVEREDBYTIP: "Wer sieht die Provinzen im CK-Bereich?"
DISCOVEREDBY1: "Vanille (Standard)."
DISCOVEREDBYTIP1: "Importieren Sie Vanilla-Sichtbarkeit."
DISCOVEREDBY2: "Dynamisch."
DISCOVEREDBYTIP2: "Grundsätzlich gilt: Jeder, der im Rahmen des Geltungsbereichs liegt."
14 changes: 10 additions & 4 deletions CK3ToEU4/Data_Files/options_l_italian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ l_italian:
GULAG3TIP: "Lascia com'è."
AZTEC: "Dovremmo invocare gli Aztechi?"
AZTECTIP: "Come dovremmo affrontare l'Invasione del Crepuscolo?"
AZTEC2: "No, per amore di Dio."
AZTEC2TIP: "Il Nuovo Mondo sarà nel suo stato di vaniglia."
AZTEC3: "Sì, per Mictlantecuhtli!"
AZTEC3TIP: "La guerra azteca-inca sarà ricordata dagli storici."
AZTEC1: "No, per amore di Dio."
AZTEC1TIP: "Il Nuovo Mondo sarà nel suo stato di vaniglia."
AZTEC2: "Sì, per Mictlantecuhtli!"
AZTEC2TIP: "La guerra azteca-inca sarà ricordata dagli storici."
INSTITUTIONS: "L'apparizione delle istituzioni e la selezione delle idee dovrebbero essere dinamiche?"
INSTITUTIONSTIP: "Seguiamo le regole di apparizione delle istituzioni e di selezione delle idee del vanilla o creiamo un sistema dinamico?"
INSTITUTIONS1: "Storico (Vanilla)"
Expand All @@ -90,3 +90,9 @@ l_italian:
SPLITVASSALS: "Suddividere i grandi vassalli in stati vassalli di EU4?"
SPLITVASSALSTIP: "Solo i vassalli straordinariamente grandi avranno l'autonomia."
YES1: "Sì [consigliato]"
DISCOVEREDBY: "Le province CK sono visibili/scoperte da:"
DISCOVEREDBYTIP: "Chi vede le province nell'ambito CK?"
DISCOVEREDBY1: "Vaniglia (predefinito)."
DISCOVEREDBYTIP1: "Importa la visibilità Vanilla."
DISCOVEREDBY2: "Dinamico"
DISCOVEREDBYTIP2: "Fondamentalmente, tutti nel campo di applicazione."
14 changes: 10 additions & 4 deletions CK3ToEU4/Data_Files/options_l_latin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ l_latin:
GULAG3TIP: "Relinque sicut est."
AZTEC: "Invocandi sunt Azteci?"
AZTECTIP: "Quomodo scribitur de Impetu Crepusculi?"
AZTEC2: "No, pro amorem Dei!"
AZTEC2TIP: "Mondus novus erit more vanillae."
AZTEC3: "Age, pro Mictlantecuhtli!"
AZTEC3TIP: "Bellum Aztecum-Incarum memorandum est ab historicis."
AZTEC1: "No, pro amorem Dei!"
AZTEC1TIP: "Mondus novus erit more vanillae."
AZTEC2: "Age, pro Mictlantecuhtli!"
AZTEC2TIP: "Bellum Aztecum-Incarum memorandum est ab historicis."
INSTITUTIONS: "Numquid ut instituta ratio admodum lectio?"
INSTITUTIONSTIP: "Si praecepta non uti vanilla institutione pariunt/dynamicam systematis ideam delectu atque etiam quid utimur?"
INSTITUTIONS1: "Historiae Ecclesiasticae (Vanilla)"
Expand All @@ -90,3 +90,9 @@ l_latin:
SPLITVASSALS: "Dividantur magna tributaria regna in tributaria parviora EU4?"
SPLITVASSALSTIP: "Tantum permagnis tributariis regnis detur potestas."
YES1: "Age [optio melior]"
DISCOVEREDBY: "CK Provinciae conspiciuntur/inventae sunt:"
DISCOVEREDBYTIP: "Quis provincias in CK ambitu videt?"
DISCOVEREDBY1: "Vanilla (per annum)."
DISCOVEREDBYTIP1: "Importare vanilla visibilitas."
DISCOVEREDBY2: "Dynamic."
DISCOVEREDBYTIP2: "Plerumque, omnes in scope."
14 changes: 10 additions & 4 deletions CK3ToEU4/Data_Files/options_l_russian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ l_russian:
GULAG3TIP: "Оставить как есть."
AZTEC: "Должны ли мы вызвать ацтеков?"
AZTECTIP: "Как мы должны иметь дело с Вторжением Заката?"
AZTEC2: "Нет, ради любви Бога."
AZTEC2TIP: "Новый Мир будет в своем ванильном состоянии."
AZTEC3: "Да, для Миктлантекутли!"
AZTEC3TIP: "Война ацтеков и инков запомнится историкам."
AZTEC1: "Нет, ради любви Бога."
AZTEC1TIP: "Новый Мир будет в своем ванильном состоянии."
AZTEC2: "Да, для Миктлантекутли!"
AZTEC2TIP: "Война ацтеков и инков запомнится историкам."
INSTITUTIONS: "Должны ли Институты и выбор идей быть динамичными?"
INSTITUTIONSTIP: "Должны ли мы использовать ванильные правила появления институтов/выбора идей или лучше использовать динамичную систему?"
INSTITUTIONS1: "Исторические (Ванилла)"
Expand All @@ -90,3 +90,9 @@ l_russian:
SPLITVASSALS: "Разделить огромных вассалов на вассальные страны из EU4?"
SPLITVASSALSTIP: "Только очень огромные вассалы получать автономию."
YES1: "Да [рекомендуется]"
DISCOVEREDBY: "Провинции СК видны/обнаружены:"
DISCOVEREDBYTIP: "Кто видит провинции в сфере действия СК?"
DISCOVEREDBY2: "Ваниль (по умолчанию)."
DISCOVEREDBYTIP2: "Импортируйте ванильную видимость."
DISCOVEREDBY1: "Динамический."
DISCOVEREDBYTIP1: "В общем, все в рамках."
5 changes: 5 additions & 0 deletions CK3ToEU4/Source/Configuration/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ void Configuration::registerKeys()
dynasticNames = DYNASTICNAMES(std::stoi(dynasticNamesString.getString()));
Log(LogLevel::Info) << "Dynastic Names set to: " << dynasticNamesString.getString();
});
registerKeyword("discoveredBy", [this](std::istream& theStream) {
const commonItems::singleString discoveredByString(theStream);
discoveredBy = DISCOVEREDBY(std::stoi(discoveredByString.getString()));
Log(LogLevel::Info) << "Discovered By set to: " << discoveredByString.getString();
});
registerRegex(commonItems::catchallRegex, commonItems::ignoreItem);
}

Expand Down
14 changes: 10 additions & 4 deletions CK3ToEU4/Source/Configuration/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class Configuration: commonItems::parser
};
enum class SUNSET
{
DEFAULT = 1,
DISABLED = 2,
ACTIVE = 3
DISABLED = 1,
ACTIVE = 2
};
enum class I_AM_HRE
{
Expand Down Expand Up @@ -82,6 +81,11 @@ class Configuration: commonItems::parser
ENABLED = 1,
DISABLED = 2
};
enum class DISCOVEREDBY
{
VANILLA = 1,
DYNAMIC = 2
};

[[nodiscard]] const auto& getSaveGamePath() const { return SaveGamePath; }
[[nodiscard]] const auto& getCK3Path() const { return CK3Path; }
Expand All @@ -102,6 +106,7 @@ class Configuration: commonItems::parser
[[nodiscard]] const auto& getSplitVassals() const { return splitVassals; }
[[nodiscard]] const auto& getPlayerTitle() const { return playerTitle; }
[[nodiscard]] const auto& getDynasticNames() const { return dynasticNames; }
[[nodiscard]] const auto& getDiscoveredBy() const { return discoveredBy; }

void setCraftFlagForPlayerTitle(const std::string& title) { playerTitle = title; }

Expand All @@ -125,13 +130,14 @@ class Configuration: commonItems::parser
SHATTER_HRE_LEVEL shatterHRELevel = SHATTER_HRE_LEVEL::DUTCHY;
SHATTER_LEVEL shatterLevel = SHATTER_LEVEL::DUTCHY;
SIBERIA siberia = SIBERIA::CLEAR_SIBERIA;
SUNSET sunset = SUNSET::DEFAULT;
SUNSET sunset = SUNSET::DISABLED;
INSTITUTIONS dynamicInstitutions = INSTITUTIONS::HISTORIC;
DEVELOPMENT development = DEVELOPMENT::IMPORT;
MULTIPROVDEVTRANSFER multiProvinceDevelopmentTransfer = MULTIPROVDEVTRANSFER::DEFAULT;
DEJURE dejure = DEJURE::ENABLED;
SPLITVASSALS splitVassals = SPLITVASSALS::YES;
DYNASTICNAMES dynasticNames = DYNASTICNAMES::ENABLED;
DISCOVEREDBY discoveredBy = DISCOVEREDBY::VANILLA;

std::optional<std::string> playerTitle;
};
Expand Down
6 changes: 3 additions & 3 deletions CK3ToEU4/Source/EU4World/EU4World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ EU4::World::World(const CK3::World& sourceWorld, const Configuration& theConfigu
Log(LogLevel::Progress) << "58 %";

// Next we import ck provinces and translate them ontop a significant part of all imported provinces.
importCK3Provinces(sourceWorld);
importCK3Provinces(theConfiguration.getDiscoveredBy());
Log(LogLevel::Progress) << "59 %";

// With Ck provinces linked to those eu4 provinces they affect, we can adjust eu4 province dev values.
Expand Down Expand Up @@ -548,7 +548,7 @@ void EU4::World::importVanillaProvinces(const std::string& eu4Path, bool invasio
}
}

void EU4::World::importCK3Provinces(const CK3::World& sourceWorld)
void EU4::World::importCK3Provinces(Configuration::DISCOVEREDBY discoveredBy)
{
Log(LogLevel::Info) << "-> Importing CK3 Provinces";
auto counter = 0;
Expand All @@ -569,7 +569,7 @@ void EU4::World::importCK3Provinces(const CK3::World& sourceWorld)
else
{
// And finally, initialize it.
province.second->initializeFromCK3Title(sourceProvince->second, cultureMapper, religionMapper, locDegrader, regionMapper);
province.second->initializeFromCK3Title(sourceProvince->second, cultureMapper, religionMapper, locDegrader, regionMapper, discoveredBy);
counter++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion CK3ToEU4/Source/EU4World/EU4World.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class World
date startDate,
bool dynasticNames);
void importVanillaProvinces(const std::string& eu4Path, bool invasion);
void importCK3Provinces(const CK3::World& sourceWorld);
void importCK3Provinces(Configuration::DISCOVEREDBY discoveredBy);
[[nodiscard]] std::optional<std::pair<std::string, std::shared_ptr<CK3::Title>>> determineProvinceSource(
const std::map<std::string, std::shared_ptr<CK3::Title>>& ck3Titles) const;

Expand Down
17 changes: 11 additions & 6 deletions CK3ToEU4/Source/EU4World/Province/EU4Province.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ void EU4::Province::initializeFromCK3Title(const std::shared_ptr<CK3::Title>& or
const mappers::CultureMapper& cultureMapper,
const mappers::ReligionMapper& religionMapper,
const mappers::LocDegraderMapper& locDegrader,
const std::shared_ptr<mappers::RegionMapper>& regionMapper)
const std::shared_ptr<mappers::RegionMapper>& regionMapper,
Configuration::DISCOVEREDBY discoveredBy)
{
srcProvince = origProvince;

details.discoveredBy = {"western", "eastern", "ottoman", "muslim", "indian", "east_african", "nomad_group", "sub_saharan"}; // hardcoding for now.
if (regionMapper->provinceIsInRegion(provID, "india_superregion") || regionMapper->provinceIsInRegion(provID, "east_indies_superregion") ||
regionMapper->provinceIsInRegion(provID, "east_siberia_region") || regionMapper->provinceIsInRegion(provID, "mongolia_region") ||
regionMapper->provinceIsInRegion(provID, "tibet_region"))
details.discoveredBy.insert("chinese");
// Vanilla setting doesn't touch visibility.
if (discoveredBy == Configuration::DISCOVEREDBY::DYNAMIC)
{
details.discoveredBy = {"western", "eastern", "ottoman", "muslim", "indian", "east_african", "nomad_group", "sub_saharan"}; // hardcoding for now.
if (regionMapper->provinceIsInRegion(provID, "india_superregion") || regionMapper->provinceIsInRegion(provID, "east_indies_superregion") ||
regionMapper->provinceIsInRegion(provID, "east_siberia_region") || regionMapper->provinceIsInRegion(provID, "mongolia_region") ||
regionMapper->provinceIsInRegion(provID, "tibet_region"))
details.discoveredBy.insert("chinese");
}

// If we're initializing this from CK3 full-fledged titles, and having a holder and development is a given.
// There are no uncolonized provinces in CK3.
Expand Down
4 changes: 3 additions & 1 deletion CK3ToEU4/Source/EU4World/Province/EU4Province.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef EU4_PROVINCE_H
#define EU4_PROVINCE_H

#include "../../Configuration/Configuration.h"
#include "../../Mappers/LocDegraderMapper/LocDegraderMapper.h"
#include "../../Mappers/RegionMapper/RegionMapper.h"
#include "ProvinceDetails.h"
Expand Down Expand Up @@ -33,7 +34,8 @@ class Province
const mappers::CultureMapper& cultureMapper,
const mappers::ReligionMapper& religionMapper,
const mappers::LocDegraderMapper& locDegrader,
const std::shared_ptr<mappers::RegionMapper>& regionMapper);
const std::shared_ptr<mappers::RegionMapper>& regionMapper,
Configuration::DISCOVEREDBY discoveredBy);
void registerManualName(const mappers::LocDegraderMapper& locDegrader);

[[nodiscard]] const auto& getHistoryCountryFile() const { return historyProvincesFile; }
Expand Down

0 comments on commit a890f5a

Please sign in to comment.