Skip to content

Commit

Permalink
Prevent holes in counties history (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Sep 1, 2024
1 parent 3d1dca4 commit da615f3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ImperatorToCK3/CK3/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,18 @@ private void UseNeighborProvincesToRemoveIslam(HashSet<Province> muslimProvinces
private void GenerateFillerHoldersForUnownedLands(CultureCollection cultures, Configuration config) {
Logger.Info("Generating filler holders for unowned lands...");
var date = config.CK3BookmarkDate;
var unheldCounties = LandedTitles
.Where(c => c.Rank == TitleRank.county && c.GetHolderId(date) == "0")
.ToImmutableList();
List<Title> unheldCounties = [];
foreach (var county in LandedTitles.Counties) {
var holderId = county.GetHolderId(date);
if (holderId == "0") {
unheldCounties.Add(county);
} else if (Characters.TryGetValue(holderId, out var holder)) {
if (holder.DeathDate is not null && holder.DeathDate <= date) {
Logger.Debug($"Adding {county.Id} to unheld counties because holder {holderId} is dead.");
unheldCounties.Add(county);
}
}
}

var duchyIdToHolderDict = new Dictionary<string, Character>();

Expand Down

0 comments on commit da615f3

Please sign in to comment.