@@ -75,7 +75,7 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
7575 Logger . Info ( "*** Hello CK3, let's get painting. ***" ) ;
7676
7777 warMapper . DetectUnmappedWarGoals ( impWorld . ModFS ) ;
78-
78+
7979 DetermineCK3Dlcs ( config ) ;
8080 LoadAndDetectCK3Mods ( config ) ;
8181
@@ -90,14 +90,14 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
9090 WorldOutputter . CreateModFolder ( outputModPath ) ;
9191 // This will also convert all Liquid templates into simple text files.
9292 WorldOutputter . CopyBlankModFilesToOutput ( outputModPath , config . GetCK3ModFlags ( ) ) ;
93-
93+
9494 // Include a fake mod pointing to blankMod in the output folder.
9595 LoadedMods . Add ( new Mod ( "blankMod" , outputModPath ) ) ;
9696 ModFS = new ModFilesystem ( Path . Combine ( config . CK3Path , "game" ) , LoadedMods ) ;
9797
9898 var ck3Defines = new Defines ( ) ;
9999 ck3Defines . LoadDefines ( ModFS ) ;
100-
100+
101101 ColorFactory ck3ColorFactory = new ( ) ;
102102 // Now that we have the mod filesystem, we can initialize the localization database.
103103 Parallel . Invoke (
@@ -121,10 +121,11 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
121121 FileTweaker . ModifyAndRemovePartsOfFiles ( ModFS , outputModPath , config ) . Wait ( ) ;
122122 }
123123 ) ;
124-
124+
125125 System . Collections . Generic . OrderedDictionary < string , bool > ck3ModFlags = config . GetCK3ModFlags ( ) ;
126-
126+
127127 Parallel . Invoke (
128+ ( ) => provinceMapper . DetectInvalidMappings ( impWorld . MapData , MapData ) , // depends on ProvinceMapper and MapData
128129 ( ) => { // depends on ck3ColorFactory and CulturalPillars
129130 // Load CK3 cultures from CK3 mod filesystem.
130131 Logger . Info ( "Loading cultural pillars..." ) ;
@@ -142,9 +143,9 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
142143 } ,
143144 ( ) => LoadMenAtArmsTypes ( ModFS , ScriptValues ) , // depends on ScriptValues
144145 ( ) => { // depends on LocDB and CK3CoaMapper
145- // Load vanilla CK3 landed titles and their history
146+ // Load vanilla CK3 landed titles and their history
146147 LandedTitles . LoadTitles ( ModFS , LocDB , ck3ColorFactory ) ;
147-
148+
148149 if ( config . StaticDeJure ) {
149150 Logger . Info ( "Setting static de jure kingdoms and empires..." ) ;
150151
@@ -154,25 +155,25 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
154155
155156 Logger . IncrementProgress ( ) ;
156157 }
157-
158+
158159 LandedTitles . SetCoatsOfArms ( CK3CoaMapper ) ;
159-
160+
160161 LandedTitles . LoadHistory ( config , ModFS ) ;
161162 LandedTitles . LoadCulturalNamesFromConfigurables ( ) ;
162163 }
163164 ) ;
164-
165+
165166 // Load regions.
166167 ck3RegionMapper = new CK3RegionMapper ( ModFS , LandedTitles ) ;
167168 imperatorRegionMapper = impWorld . ImperatorRegionMapper ;
168-
169+
169170 CultureMapper cultureMapper = null ! ;
170171 TraitMapper traitMapper = null ! ;
171172 DNAFactory dnaFactory = null ! ;
172173 Parallel . Invoke (
173174 ( ) => { // depends on ck3ColorFactory and landed titles being loaded
174- // Load CK3 religions from game and blankMod.
175- // Holy sites need to be loaded after landed titles.
175+ // Load CK3 religions from game and blankMod.
176+ // Holy sites need to be loaded after landed titles.
176177 Religions . LoadDoctrines ( ModFS ) ;
177178 Logger . Info ( "Loaded CK3 doctrines." ) ;
178179 Religions . LoadConverterHolySites ( "configurables/converter_holy_sites.txt" ) ;
@@ -190,15 +191,15 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
190191 Religions . RemoveChristianAndIslamicSyncretismFromAllFaiths ( ) ;
191192 // Now that all the faiths are loaded, remove liege entries from the history of religious head titles.
192193 LandedTitles . RemoveLiegeEntriesFromReligiousHeadHistory ( Religions ) ;
193-
194+
194195 Religions . LoadReplaceableHolySites ( "configurables/replaceable_holy_sites.txt" ) ;
195196 Logger . Info ( "Loaded replaceable holy sites." ) ;
196197 } ,
197-
198+
198199 ( ) => cultureMapper = new CultureMapper ( imperatorRegionMapper , ck3RegionMapper , Cultures ) ,
199-
200+
200201 ( ) => traitMapper = new ( "configurables/trait_map.txt" , ModFS ) ,
201-
202+
202203 ( ) => {
203204 Logger . Info ( "Initializing DNA factory..." ) ;
204205 dnaFactory = new ( impWorld . ModFS , ModFS ) ;
@@ -210,14 +211,14 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
210211 Logger . IncrementProgress ( ) ;
211212 }
212213 ) ;
213-
214+
214215 var religionMapper = new ReligionMapper ( Religions , imperatorRegionMapper , ck3RegionMapper ) ;
215-
216+
216217 Parallel . Invoke (
217218 ( ) => Cultures . ImportTechnology ( impWorld . Countries , cultureMapper , provinceMapper , impWorld . InventionsDB , impWorld . LocDB , ck3ModFlags ) ,
218-
219+
219220 ( ) => { // depends on religionMapper
220- // Check if all I:R religions have a base mapping.
221+ // Check if all I:R religions have a base mapping.
221222 foreach ( var irReligionId in impWorld . Religions . Select ( r => r . Id ) ) {
222223 var baseMapping = religionMapper . Match ( irReligionId , null , null , null , null , config ) ;
223224 if ( baseMapping is null ) {
@@ -231,25 +232,25 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
231232 }
232233 } ,
233234 ( ) => { // depends on cultureMapper
234- // Check if all I:R cultures have a base mapping.
235+ // Check if all I:R cultures have a base mapping.
235236 var irCultureIds = impWorld . CulturesDB . SelectMany ( g => g . Select ( c => c . Id ) ) ;
236237 foreach ( var irCultureId in irCultureIds ) {
237- var baseMapping = cultureMapper . Match ( irCultureId , null , null , null ) ;
238- if ( baseMapping is null ) {
238+ var baseMapping = cultureMapper . Match ( irCultureId , null , null , null ) ;
239+ if ( baseMapping is null ) {
239240 string cultureStr = "ID: " + irCultureId ;
240241 var localizedName = impWorld . LocDB . GetLocBlockForKey ( irCultureId ) ? [ "english" ] ;
241242 if ( localizedName is not null ) {
242243 cultureStr += $ ", name: { localizedName } ";
243244 }
244- Logger . Warn ( $ "No base mapping found for I:R culture { cultureStr } !") ;
245- }
246- }
245+ Logger . Warn ( $ "No base mapping found for I:R culture { cultureStr } !") ;
246+ }
247+ }
247248 } ,
248249 ( ) => { // depends on TraitMapper and CK3 characters being loaded
249250 Characters . RemoveUndefinedTraits ( traitMapper ) ;
250251 }
251252 ) ;
252-
253+
253254 Characters . ImportImperatorCharacters (
254255 impWorld ,
255256 religionMapper ,
@@ -324,14 +325,14 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
324325 impWorld . CoaMapper ,
325326 countyLevelGovernorships
326327 ) ;
327-
328+
328329 // Give counties to rulers and governors.
329330 OverwriteCountiesHistory ( impWorld . Countries , impWorld . JobsDB . Governorships , countyLevelCountries , countyLevelGovernorships , impWorld . Characters , impWorld . Provinces , CorrectedDate ) ;
330331 ImportImperatorHoldingsIfNotDisabledByConfiguration ( impWorld , config ) ;
331332
332333 LandedTitles . ImportDevelopmentFromImperator ( Provinces , CorrectedDate , config . ImperatorCivilizationWorth ) ;
333334 LandedTitles . RemoveInvalidLandlessTitles ( config . CK3BookmarkDate ) ;
334-
335+
335336 // Apply region-specific tweaks.
336337 HandleIcelandAndFaroeIslands ( impWorld , config ) ;
337338
@@ -343,15 +344,15 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
343344 if ( ! config . StaticDeJure ) {
344345 LandedTitles . SetDeJureKingdomsAndEmpires ( config . CK3BookmarkDate , Cultures , Characters , MapData , LocDB ) ;
345346 }
346-
347+
347348 Dynasties . SetCoasForRulingDynasties ( LandedTitles , config . CK3BookmarkDate ) ;
348-
349+
349350 Characters . RemoveEmployerIdFromLandedCharacters ( LandedTitles , CorrectedDate ) ;
350351 Characters . PurgeUnneededCharacters ( LandedTitles , Dynasties , DynastyHouses , config . CK3BookmarkDate ) ;
351352 // We could convert Imperator character DNA while importing the characters.
352353 // But that'd be wasteful, because some of them are purged. So, we do it now.
353354 Characters . ConvertImperatorCharacterDNA ( dnaFactory ) ;
354-
355+
355356 // If there's a gap between the I:R save date and the CK3 bookmark date,
356357 // generate successors for old I:R characters instead of making them live for centuries.
357358 if ( config . CK3BookmarkDate . DiffInYears ( impWorld . EndDate ) > 1 ) {
@@ -361,20 +362,20 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac
361362 // Gold needs to be distributed after characters' successors are generated.
362363 Characters . DistributeCountriesGold ( LandedTitles , config ) ;
363364 Characters . ImportLegions ( LandedTitles , impWorld . Units , impWorld . Characters , CorrectedDate , unitTypeMapper , MenAtArmsTypes , provinceMapper , LocDB , config ) ;
364-
365+
365366 // After the purging of unneeded characters, we should clean up the title history.
366367 LandedTitles . CleanUpHistory ( Characters , config . CK3BookmarkDate ) ;
367-
368+
368369 // Now that the title history is basically done, convert officials as council members and courtiers.
369370 LandedTitles . ImportImperatorGovernmentOffices ( impWorld . JobsDB . OfficeJobs , Religions , impWorld . EndDate ) ;
370371
371372 Parallel . Invoke (
372373 ( ) => ImportImperatorWars ( impWorld , config . CK3BookmarkDate ) ,
373-
374+
374375 ( ) => {
375376 var holySiteEffectMapper = new HolySiteEffectMapper ( "configurables/holy_site_effect_mappings.txt" ) ;
376377 Religions . DetermineHolySites ( Provinces , impWorld . Religions , holySiteEffectMapper , config . CK3BookmarkDate ) ;
377-
378+
378379 Religions . GenerateMissingReligiousHeads ( LandedTitles , Characters , Provinces , Cultures , config . CK3BookmarkDate ) ;
379380 Logger . IncrementProgress ( ) ;
380381 } ,
0 commit comments