Skip to content

Commit

Permalink
Fix error.log spam about illegal government for filler counts (#2126)
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Sep 1, 2024
1 parent 3f83761 commit 34aee13
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ImperatorToCK3/CK3/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,19 @@ private void GenerateFillerHoldersForUnownedLands(CultureCollection cultures, Co
};
holder.SetFaithId(faithId, null);
holder.SetCultureId(culture.Id, null);
holder.History.AddFieldValue(date, "government", "change_government", "tribal_government");
Characters.AddOrReplace(holder);

var countyHoldingTypes = county.CountyProvinceIds
.Select(id => Provinces.TryGetValue(id, out var province) ? province : null)
.Where(p => p is not null)
.Select(p => p!.GetHoldingType(date))
.Where(t => t is not null)
.Select(t => t!)
.ToHashSet();
string government = countyHoldingTypes.Contains("castle_holding")
? "feudal_government"
: "tribal_government";

county.SetHolder(holder, date);
if (config.FillerDukes) {
var duchy = county.DeJureLiege;
Expand All @@ -936,10 +946,10 @@ private void GenerateFillerHoldersForUnownedLands(CultureCollection cultures, Co
}

duchy.SetHolder(holder, date);
duchy.SetGovernment("tribal_government", date);
duchy.SetGovernment(government, date);
duchyIdToHolderDict[duchy.Id] = holder;
} else {
county.SetGovernment("tribal_government", date);
county.SetGovernment(government, date);
}
}
}
Expand Down

0 comments on commit 34aee13

Please sign in to comment.