Skip to content

Commit

Permalink
HPM Fronter option (#702)
Browse files Browse the repository at this point in the history
* HPM Fronter option

* Requested changes

* Fix for ConfigurationTests
  • Loading branch information
cetvrtak authored Apr 21, 2021
1 parent 4848a71 commit 2f27e15
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 6 deletions.
10 changes: 8 additions & 2 deletions EU4ToVic2Tests/ConfigurationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ bool fakeDoesFolderExist(const std::string& folder)
{
return true;
}
else if (folder == "C:\\Vic2Path/mod/HPM")
{
return true;
}
else
{
return false;
Expand Down Expand Up @@ -272,7 +276,7 @@ TEST(EU4ToVic2_ConfigurationTests, Vic2PathCanPointToHpm)
Configuration testConfiguration;
std::stringstream input;
input << "Vic2directory = \"C:\\Vic2Path\"";
input << "hybrid_enabled = \"2\"";
input << "hybrid_mod = \"2\"";
testConfiguration.instantiate(input, fakeDoesFolderExist, fakeDoesFileExist);

ASSERT_EQ("C:\\Vic2Path/mod/HPM", testConfiguration.getVic2Path());
Expand Down Expand Up @@ -499,7 +503,9 @@ TEST(EU4ToVic2_ConfigurationTests, HybridDefaultsDisabled)
TEST(EU4ToVic2_ConfigurationTests, HybridCanBeEnabled)
{
Configuration testConfiguration;
std::stringstream input("hybrid_enabled = \"2\"");
std::stringstream input;
input << "Vic2directory = \"C:\\Vic2Path\"";
input << "hybrid_mod = \"2\"";
testConfiguration.instantiate(input, fakeDoesFolderExist, fakeDoesFileExist);

ASSERT_TRUE(testConfiguration.isHpmEnabled());
Expand Down
18 changes: 18 additions & 0 deletions EU4toV2/Data_Files/fronter-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,24 @@ option = {
}
}
}
option = {
name = hybrid_mod
displayName = HYBRIDMOD
tooltip = HYBRIDMODTIP
radioSelector = {
radioOption = {
name = 1
displayName = HYBRIDMOD1
default = true
}
radioOption = {
name = 2
displayName = HYBRIDMOD2
tooltip = HYBRIDMOD2TIP
default = false
}
}
}
option = {
name = output_name
displayName = MODNAME
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ l_english:
AZTEC2TIP: "The New World will be in its vanilla state."
AZTEC3: "Yes, for Mictlantecuhtli!"
AZTEC3TIP: "The Aztec-Incan War will be remembered by historians."
HYBRIDMOD: "Make hybrid mod with: (Do NOT enable base mod with the Converter's output)"
HYBRIDMODTIP: "Create a hybrid mod with another preinstalled mod"
HYBRIDMOD1: "None (default)"
HYBRIDMOD2: "HPM"
HYBRIDMOD2TIP: "HPM must be installed locally into Vic2's mod folder"
MODNAME: "Mod Output Name (optional):"
MODNAMETIP: "Please, stick to Latin letters"
MODNAMETIP2: "Optional name for the converted mod (default name is the one of the savegame)"
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_french.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ l_french:
AZTEC3: "Oui, pour Mictlantecuhtli!"
AZTEC3TIP: "Les historiens se souviendront de la guerre aztèque-inca."
MODNAME: "Nom de sortie du mod (facultatif):"
HYBRIDMOD: "Créer un mod hybride avec: (N'activez pas le mod base avec la sortie du convertisseur)"
HYBRIDMODTIP: "Création d'un mod hybridé avec un autre préinstallé"
HYBRIDMOD1: "Aucun (défaut)"
HYBRIDMOD2: "HPM (Mod du Projet Historique)"
HYBRIDMOD2TIP: "HPM doit être installé localement dans le dossier mod de Vic2"
MODNAMETIP: "Veuillez vous en tenir aux lettres latines"
MODNAMETIP2: "Nom facultatif pour le mod converti (le nom par défaut est celui de la sauvegarde)"
LIT: "Alphabétisation maximale"
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_german.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ l_german:
AZTEC2TIP: "Die Neue Welt wird in ihrem Vanillezustand sein."
AZTEC3: "Ja, für Mictlantecuhtli!"
AZTEC3TIP: "An den Azteken-Inka-Krieg werden sich Historiker erinnern."
HYBRIDMOD: "Einen Hybrid-Mod nach ... erstellen: (Aktivieren Sie den Basismod NICHT mit dem Ausgang des Konverters)"
HYBRIDMODTIP: "Erstellung eines Hybrid-Mods nach einem vorinstallierten Mod"
HYBRIDMOD1: "Nichts (Standard)"
HYBRIDMOD2: "HPM (Historisches Projektes Mod)"
HYBRIDMOD2TIP: "HPM muss lokal im Mod-Ordner von Vic2 installiert werden."
MODNAME: "Mod Output Name (optional):"
MODNAMETIP: "Bitte halten Sie sich an lateinische Buchstaben"
MODNAMETIP2: "Optionaler Name für den konvertierten Mod (Standardname ist derselbe des Savegames)"
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_italian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ l_italian:
AZTEC2TIP: "Il Nuovo Mondo sarà nel suo stato di vaniglia."
AZTEC3: "Sì, per Mictlantecuhtli!"
AZTEC3TIP: "La guerra azteca-inca sarà ricordata dagli storici."
HYBRIDMOD: "Crea una mod ibridata con: (NON attivare la mod di base con l'output del convertitore)"
HYBRIDMODTIP: "Creazione di una mod ibrida basata su una preinstallata"
HYBRIDMOD1: "Nessuna (opzione default)"
HYBRIDMOD2: "HPM (Mod Progetto Storico)"
HYBRIDMOD2TIP: "HPM deve essere installato localmente nella cartella mod di Vic2"
MODNAME: "Nome della mod (opzionale):"
MODNAMETIP: "Per favore, usa solo lettere latine"
MODNAMETIP2: "Nome facoltativo per la mod convertita (il nome predefinito è quello del salvataggio)"
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_latin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ l_latin:
AZTEC2TIP: "Mondus novus erit more vanillae."
AZTEC3: "Age, pro Mictlantecuhtli!"
AZTEC3TIP: "Bellum Aztecum-Incarum memorandum est ab historicis."
HYBRIDMOD: "Correctio mixta creari: (Nolito correctioni matrici uti una cum correctioni conversoris)"
HYBRIDMODTIP: "Creatio correctionis mixtæ secundum correctionem jam in computatro"
HYBRIDMOD1: "Nihilo mixta (optio basica)"
HYBRIDMOD2: "HPM (Correctioni Historici Proiectus) mixta"
HYBRIDMOD2TIP: "fertur in vic2 HPM debet installed in folder mod"
MODNAME: "Nomen correctionis (facultativum):"
MODNAMETIP: "Quaeso, tantum utere litteris Latinis."
MODNAMETIP2: "Nomen facultativum correctionis versae (nomen predefinitum est idem conditi ludi)"
Expand Down
5 changes: 5 additions & 0 deletions EU4toV2/Data_Files/options_l_russian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ l_russian:
AZTEC2TIP: "Новый Мир будет в своем ванильном состоянии."
AZTEC3: "Да, для Миктлантекутли!"
AZTEC3TIP: "Война ацтеков и инков запомнится историкам."
HYBRIDMOD: "Создать мод-гибрид с: (Не включать базовый мод вместе с Конвертированным)"
HYBRIDMODTIP: "Создать Гибридный мод вместе уже установленным модом"
HYBRIDMOD1: "Никаким (Стандартна опция)"
HYBRIDMOD2: "Никаким (Стандартна опция)"
HYBRIDMOD2TIP: "HPM должен быть установлен локально в папку мода Vic2"
MODNAME: "Имя выхода мода (необязательно):"
MODNAMETIP: "Пожалуйста, придерживайтесь латинских букв"
MODNAMETIP2: "Необязательное имя для конвертируемого мода (по умолчанию это имя сохраненной игры)"
Expand Down
10 changes: 6 additions & 4 deletions EU4toV2/Source/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ void Configuration::instantiate(std::istream& theStream, bool (*DoesFolderExist)
convertAll = convertAllString == "yes";
LOG(LogLevel::Info) << "Convert All: " << convertAllString;
});
registerKeyword("hybrid_enabled", [this](std::istream& theStream) {
const auto hybridEnabledString = commonItems::getString(theStream);
hybridMod = HYBRIDMOD(std::stoi(hybridEnabledString));
LOG(LogLevel::Info) << "Hybrid mod enabled: " << hybridEnabledString;
registerKeyword("hybrid_mod", [this](std::istream& theStream) {
const auto hybridModString = commonItems::getString(theStream);
hybridMod = HYBRIDMOD(std::stoi(hybridModString));
LOG(LogLevel::Info) << "Hybrid mod: " << hybridModString;
});
registerKeyword("output_name", [this](std::istream& theStream) {
incomingOutputName = commonItems::getString(theStream);
Expand All @@ -116,6 +116,8 @@ void Configuration::instantiate(std::istream& theStream, bool (*DoesFolderExist)
setOutputName();
if (isHpmEnabled())
{
if (!DoesFolderExist(Vic2Path + "/mod/HPM"))
throw std::runtime_error(Vic2Path + "/mod/HPM does not exist!");
Vic2Path += "/mod/HPM";
}
Log(LogLevel::Progress) << "3 %";
Expand Down
1 change: 1 addition & 0 deletions EU4toV2/Source/V2World/V2World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ void V2::World::output(const mappers::VersionParser& versionParser) const
copyHpmFiles();
outputGTFO(countries);
outputReturnCores(countries);
Log(LogLevel::Error) << "HPM Hybrid created. Do NOT enable HPM in Vic2 launcher, just this mod.";
}

// verify countries got written
Expand Down

0 comments on commit 2f27e15

Please sign in to comment.