Skip to content

Commit

Permalink
configurables/converter_cultures.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Aug 26, 2023
1 parent 81df246 commit 5e504d7
Show file tree
Hide file tree
Showing 37 changed files with 1,062 additions and 1,320 deletions.
7 changes: 6 additions & 1 deletion ImperatorToCK3/CK3/Cultures/CultureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ public void LoadCultures(ModFilesystem ck3ModFS) {
parser.ParseGameFolder("common/culture/cultures", ck3ModFS, "txt", true, logFilePaths: true);
}

// TODO: load optional cultures from configurables
public void LoadConverterCultures(string converterCulturesPath) {
var parser = new Parser();
parser.RegisterRegex(CommonRegexes.String, (reader, cultureId) => LoadCulture(cultureId, reader));
parser.IgnoreAndLogUnregisteredItems();
parser.ParseFile(converterCulturesPath);
}

private void LoadCulture(string cultureId, BufferedReader cultureReader) {
cultureDataParser.ParseStream(cultureReader);
Expand Down
8 changes: 4 additions & 4 deletions ImperatorToCK3/CK3/Religions/ReligionCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public void LoadReligions(ModFilesystem ck3ModFS, ColorFactory colorFactory) {
parser.ParseGameFolder("common/religion/religions", ck3ModFS, "txt", recursive: true);
}

public void LoadOptionalFaiths(string optionalFaithsPath, ColorFactory colorFactory) {
public void LoadConverterFaiths(string converterFaithsPath, ColorFactory colorFactory) {
var parser = new Parser();
parser.RegisterRegex(CommonRegexes.String, (religionReader, religionId) => {
var optReligion = new Religion(religionId, religionReader, this, colorFactory);
// Check if religion already exists. If it does, add optional faiths to it.
// Otherwise, add the optional faith's religion.
// Check if religion already exists. If it does, add converter faiths to it.
// Otherwise, add the converter faith's religion.
if (TryGetValue(religionId, out var religion)) {
foreach (var faith in optReligion.Faiths) {
religion.Faiths.Add(faith);
Expand All @@ -57,7 +57,7 @@ public void LoadOptionalFaiths(string optionalFaithsPath, ColorFactory colorFact
}
});
parser.RegisterRegex(CommonRegexes.Catchall, ParserHelpers.IgnoreAndLogItem);
parser.ParseFile(optionalFaithsPath);
parser.ParseFile(converterFaithsPath);
}

private void RegisterHolySitesKeywords(Parser parser) {
Expand Down
6 changes: 4 additions & 2 deletions ImperatorToCK3/CK3/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public World(Imperator.World impWorld, Configuration config) {
Cultures.LoadNameLists(ModFS);
Logger.Info("Loading cultures...");
Cultures.LoadCultures(ModFS);
Logger.Info("Loading converter cultures...");
Cultures.LoadConverterCultures("configurables/converter_cultures.txt");
Logger.IncrementProgress();

LoadMenAtArmsTypes(ModFS, ScriptValues);
Expand Down Expand Up @@ -143,8 +145,8 @@ public World(Imperator.World impWorld, Configuration config) {
Logger.Info("Loading religions from CK3 game and mods...");
Religions.LoadReligions(ModFS, ck3ColorFactory);
Logger.IncrementProgress();
Logger.Info("Loading optional converter faiths...");
Religions.LoadOptionalFaiths("configurables/optional_faiths.txt", ck3ColorFactory);
Logger.Info("Loading converter faiths...");
Religions.LoadConverterFaiths("configurables/converter_faiths.txt", ck3ColorFactory);
Logger.IncrementProgress();
Religions.LoadReplaceableHolySites("configurables/replaceable_holy_sites.txt");

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5e504d7

Please sign in to comment.