Skip to content

Commit 8dd291c

Browse files
authored
A frontend option to skip holding owners import (#2688) #minor
closes #2563
1 parent 0218e64 commit 8dd291c

File tree

5 files changed

+50
-2
lines changed

5 files changed

+50
-2
lines changed

ImperatorToCK3/CK3/World.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,12 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
346346

347347
// Give counties to rulers and governors.
348348
OverwriteCountiesHistory(impWorld.Countries, impWorld.JobsDB.Governorships, countyLevelCountries, countyLevelGovernorships, impWorld.Characters, impWorld.Provinces, CorrectedDate);
349-
// Import holding owners as barons and counts.
350-
LandedTitles.ImportImperatorHoldings(Provinces, impWorld.Characters, impWorld.EndDate);
349+
// Import holding owners as barons and counts (optional).
350+
if (!config.SkipHoldingOwnersImport) {
351+
LandedTitles.ImportImperatorHoldings(Provinces, impWorld.Characters, impWorld.EndDate);
352+
} else {
353+
Logger.Info("Skipping holding owners import per configuration.");
354+
}
351355

352356
LandedTitles.ImportDevelopmentFromImperator(Provinces, CorrectedDate, config.ImperatorCivilizationWorth);
353357
LandedTitles.RemoveInvalidLandlessTitles(config.CK3BookmarkDate);

ImperatorToCK3/Configuration.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public sealed class Configuration {
2828
public LegionConversion LegionConversion { get; set; } = LegionConversion.MenAtArms;
2929
public Date CK3BookmarkDate { get; set; } = new(0, 1, 1);
3030
public bool SkipDynamicCoAExtraction { get; set; } = false;
31+
public bool SkipHoldingOwnersImport { get; set; } = true;
3132
public bool FallenEagleEnabled { get; private set; }
3233
public bool WhenTheWorldStoppedMakingSenseEnabled { get; private set; }
3334
public bool RajasOfAsiaEnabled { get; private set; }
@@ -153,6 +154,15 @@ private void RegisterKeys(Parser parser) {
153154
Logger.Error($"Undefined error, {nameof(SkipDynamicCoAExtraction)} value was: {valueString}; Error message: {e}");
154155
}
155156
});
157+
parser.RegisterKeyword("SkipHoldingOwnersImport", reader => {
158+
var valueString = reader.GetString();
159+
try {
160+
SkipHoldingOwnersImport = Convert.ToInt32(valueString, CultureInfo.InvariantCulture) == 1;
161+
Logger.Info($"{nameof(SkipHoldingOwnersImport)} set to: {SkipHoldingOwnersImport}");
162+
} catch (Exception e) {
163+
Logger.Error($"Undefined error, {nameof(SkipHoldingOwnersImport)} value was: {valueString}; Error message: {e}");
164+
}
165+
});
156166
parser.RegisterRegex(CommonRegexes.Catchall, ParserHelpers.IgnoreAndLogItem);
157167
}
158168

ImperatorToCK3/Data_Files/fronter_configuration/fronter-options.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,26 @@ option = {
139139
}
140140
}
141141

142+
option = {
143+
name = SkipHoldingOwnersImport
144+
displayName = SKIP_HOLDING_OWNERS_IMPORT
145+
tooltip = SKIP_HOLDING_OWNERS_IMPORT_TIP
146+
radioSelector = {
147+
radioOption = {
148+
name = 1
149+
displayName = SKIP_HOLDING_OWNERS_IMPORT_1
150+
tooltip = SKIP_HOLDING_OWNERS_IMPORT_1_TIP
151+
default = true
152+
}
153+
radioOption = {
154+
name = 0
155+
displayName = SKIP_HOLDING_OWNERS_IMPORT_0
156+
tooltip = SKIP_HOLDING_OWNERS_IMPORT_0_TIP
157+
default = false
158+
}
159+
}
160+
}
161+
142162
option = {
143163
name = output_name
144164
displayName = MODNAME

ImperatorToCK3/Data_Files/fronter_configuration/options_l_english.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,10 @@ l_english:
6262
SKIP_DYNAMIC_COA_EXTRACTION_0_TIP: "The converter will launch Imperator to extract all game-generated flags."
6363
SKIP_DYNAMIC_COA_EXTRACTION_1: "Yes"
6464
SKIP_DYNAMIC_COA_EXTRACTION_1_TIP: "The converted will not launch Imperator to extract all game-generated flags."
65+
66+
SKIP_HOLDING_OWNERS_IMPORT: "Should importing holding owners be skipped?"
67+
SKIP_HOLDING_OWNERS_IMPORT_TIP: "Whether the converter should import Imperator holding owners as barons and counts."
68+
SKIP_HOLDING_OWNERS_IMPORT_0: "No"
69+
SKIP_HOLDING_OWNERS_IMPORT_0_TIP: "The converter will import holding owners as barons and counts."
70+
SKIP_HOLDING_OWNERS_IMPORT_1: "Yes"
71+
SKIP_HOLDING_OWNERS_IMPORT_1_TIP: "The converter will not import holding owners as barons and counts."

ImperatorToCK3/Data_Files/fronter_configuration/options_l_simp_chinese.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ l_simp_chinese:
1818
MODNAME: "MOD导出名称(可选):"
1919
MODNAMETIP: "请使用Latin字母"
2020
MODNAMETIP2: "可选的MOD导出名称(默认名称使用存档名之一)"
21+
22+
SKIP_HOLDING_OWNERS_IMPORT: "是否跳过导入领地所有者?"
23+
SKIP_HOLDING_OWNERS_IMPORT_TIP: "是否将 Imperator 的领地所有者导入为男爵和伯爵。"
24+
SKIP_HOLDING_OWNERS_IMPORT_0: ""
25+
SKIP_HOLDING_OWNERS_IMPORT_0_TIP: "转换器会将领地所有者导入为男爵和伯爵。"
26+
SKIP_HOLDING_OWNERS_IMPORT_1: ""
27+
SKIP_HOLDING_OWNERS_IMPORT_1_TIP: "转换器不会将领地所有者导入为男爵和伯爵。"

0 commit comments

Comments
 (0)