Skip to content

Commit 1861e63

Browse files
Bump PGCG.commonItems from 15.3.0 to 16.0.0 (#2774)
Updated [PGCG.commonItems](https://github.com/ParadoxGameConverters/commonItems.NET) from 15.3.0 to 16.0.0. <details> <summary>Release notes</summary> _Sourced from [PGCG.commonItems's releases](https://github.com/ParadoxGameConverters/commonItems.NET/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/ParadoxGameConverters/commonItems.NET/commits). </details> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=PGCG.commonItems&package-manager=nuget&previous-version=15.3.0&new-version=16.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: iht <[email protected]>
1 parent c5dfa66 commit 1861e63

File tree

9 files changed

+19
-20
lines changed

9 files changed

+19
-20
lines changed

ImperatorToCK3/CK3/Characters/Character.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public uint GetAge(Date date) {
8585
if (deathDate is null) {
8686
return (uint)date.DiffInYears(birthDate);
8787
}
88-
return (uint)deathDate.DiffInYears(birthDate);
88+
return (uint)deathDate.Value.DiffInYears(birthDate);
8989
}
9090
public string GetAgeSex(Date date) {
9191
if (GetAge(date) >= 16) {
@@ -106,7 +106,10 @@ public Date BirthDate {
106106
public Date? DeathDate {
107107
get {
108108
var entriesDict = History.Fields["death"].DateToEntriesDict;
109-
return entriesDict.Count == 0 ? null : entriesDict.AsValueEnumerable().First().Key;
109+
if (entriesDict.Count == 0) {
110+
return null;
111+
}
112+
return entriesDict.AsValueEnumerable().First().Key;
110113
}
111114
set {
112115
var historyField = History.Fields["death"];
@@ -317,7 +320,7 @@ Configuration config
317320
}
318321
}
319322

320-
BirthDate = preImperatorRuler.BirthDate!;
323+
BirthDate = preImperatorRuler.BirthDate!.Value;
321324
DeathDate = preImperatorRuler.DeathDate!;
322325

323326
// determine culture and religion

ImperatorToCK3/CK3/Characters/CharacterCollection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ Date GetEstimatedMarriageDate(Imperator.Characters.Character imperatorCharacter,
266266
var birthDateOfCommonChild = GetBirthDateOfFirstCommonChild(imperatorCharacter, imperatorSpouse);
267267
if (birthDateOfCommonChild is not null) {
268268
// We assume the child was conceived after marriage.
269-
var estimatedConceptionDate = birthDateOfCommonChild.ChangeByDays(-280);
269+
var estimatedConceptionDate = birthDateOfCommonChild.Value.ChangeByDays(-280);
270270
if (marriageDeathDate is not null && marriageDeathDate < estimatedConceptionDate) {
271-
estimatedConceptionDate = marriageDeathDate.ChangeByDays(-1);
271+
estimatedConceptionDate = marriageDeathDate.Value.ChangeByDays(-1);
272272
}
273273
return estimatedConceptionDate;
274274
}
275275

276276
if (marriageDeathDate is not null) {
277-
return marriageDeathDate.ChangeByDays(-1); // Death is not a good moment to marry.
277+
return marriageDeathDate.Value.ChangeByDays(-1); // Death is not a good moment to marry.
278278
}
279279

280280
return conversionDate;

ImperatorToCK3/CK3/Titles/Title.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ public void LoadTitles(BufferedReader reader, ColorFactory colorFactory) {
787787
public Date GetDateOfLastHolderChange() {
788788
var field = History.Fields["holder"];
789789
var dates = new SortedSet<Date>(field.DateToEntriesDict.Keys);
790-
var lastDate = dates.Max;
791-
return lastDate ?? new Date(1, 1, 1);
790+
791+
return dates.Count > 0 ? dates.Max : new Date(1, 1, 1);
792792
}
793793

794794
public HashSet<string> GetAllHolderIds() {

ImperatorToCK3/CommonUtils/DiffHistoryField.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ public void AddEntryToHistory(Date? date, string keyword, object value) {
6767
if (date is null) {
6868
InitialEntries.Add(newEntry);
6969
} else {
70-
if (DateToEntriesDict.TryGetValue(date, out var entriesList)) {
70+
if (DateToEntriesDict.TryGetValue(date.Value, out var entriesList)) {
7171
entriesList.Add(newEntry);
7272
} else {
73-
DateToEntriesDict.Add(date, new List<KeyValuePair<string, object>> {
74-
newEntry
75-
});
73+
DateToEntriesDict.Add(date.Value, [newEntry]);
7674
}
7775
}
7876
} else {

ImperatorToCK3/CommonUtils/LiteralHistoryField.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ public void AddEntryToHistory(Date? date, string setter, object value) {
5656
if (date is null) {
5757
InitialEntries.Add(new KeyValuePair<string, object>(setter, value));
5858
} else {
59-
if (DateToEntriesDict.TryGetValue(date, out var entriesList)) {
59+
if (DateToEntriesDict.TryGetValue(date.Value, out var entriesList)) {
6060
entriesList.Add(new KeyValuePair<string, object>(setter, value));
6161
}
6262
else {
63-
DateToEntriesDict[date] = new List<KeyValuePair<string, object>> {
64-
new(setter, value)
65-
};
63+
DateToEntriesDict[date.Value] = [new(setter, value)];
6664
}
6765
}
6866
}

ImperatorToCK3/CommonUtils/SimpleHistoryField.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void AddEntryToHistory(Date? date, string setter, object value) {
5555
if (date is null) {
5656
InitialEntries.Add(new KeyValuePair<string, object>(setter, value));
5757
} else {
58-
DateToEntriesDict[date] = [
58+
DateToEntriesDict[date.Value] = [
5959
new(setter, value),
6060
];
6161
}

ImperatorToCK3/Imperator/Characters/Unborn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public Unborn(ulong motherId, ulong fatherId, Date birthDate, bool isBastard) {
3434
return null;
3535
}
3636

37-
return new Unborn((ulong)motherId, (ulong)fatherId, birthDate, isBastard);
37+
return new Unborn((ulong)motherId, (ulong)fatherId, birthDate.Value, isBastard);
3838
}
3939
}

ImperatorToCK3/ImperatorToCK3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4545
</PackageReference>
4646
<PackageReference Include="MurmurHash.NETStandard" Version="1.0.0" />
47-
<PackageReference Include="PGCG.commonItems" Version="15.3.0" />
47+
<PackageReference Include="PGCG.commonItems" Version="16.0.0" />
4848
<PackageReference Include="PGCG.commonItems.SourceGenerators" Version="1.0.9" />
4949
<PackageReference Include="Polly" Version="8.6.4" />
5050
<PackageReference Include="Roslynator.Analyzers" Version="4.14.1">

ImperatorToCK3/Outputter/CharacterOutputter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void WriteCharacter(StringBuilder sb, Character character, Date co
3232
Date goldDate = ck3BookmarkDate;
3333
var deathDate = character.DeathDate;
3434
if (deathDate is not null && deathDate < ck3BookmarkDate) {
35-
goldDate = deathDate;
35+
goldDate = deathDate.Value;
3636
}
3737
character.History.AddFieldValue(goldDate, "effects", "effect", effectStr);
3838
}

0 commit comments

Comments
 (0)