Skip to content

Commit

Permalink
Merge pull request #326 from edbmods/bugfixes-1.4.3
Browse files Browse the repository at this point in the history
Bugfixes 1.4.3
  • Loading branch information
edbmods authored Dec 28, 2022
2 parents ea51f4e + 9ae8e2e commit 09ee37b
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
[assembly: AssemblyVersion("1.1.1")]

// Increment for each new release
[assembly: AssemblyFileVersion("1.4.2")]
[assembly: AssemblyFileVersion("1.4.3")]
2 changes: 1 addition & 1 deletion Resources/About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

If you get a set of starting colonists that you like, save them as a preset so that you can start your game the same way next time.

[Version 1.4.2]
[Version 1.4.3]
</description>
<loadAfter>
<li>net.pardeike.rimworld.mod.harmony</li>
Expand Down
2 changes: 1 addition & 1 deletion Resources/About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>EdB.PrepareCarefully</identifier>
<version>1.4.2</version>
<version>1.4.3</version>
<showCrossPromotions>false</showCrossPromotions>
<manifestUri>https://github.com/edbmods/EdBPrepareCarefully/raw/master/Resources/About/Manifest.xml</manifestUri>
<downloadUri>https://github.com/edbmods/EdBPrepareCarefully/releases/latest</downloadUri>
Expand Down
8 changes: 8 additions & 0 deletions Resources/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
_____________________________________________________________________________

Version 1.4.3
_____________________________________________________________________________

- Fixed a problem initializing the mod when faction labels are null. This
fixes compatibility with a number of other mods.

_____________________________________________________________________________

Version 1.4.2
Expand Down
16 changes: 8 additions & 8 deletions Source/EquipmentDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public List<EquipmentRecord> Resources {
return e.type == TypeResources;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -448,7 +448,7 @@ public List<EquipmentRecord> Food {
return e.type == TypeFood;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -460,7 +460,7 @@ public List<EquipmentRecord> Weapons {
return e.type == TypeWeapons;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -472,7 +472,7 @@ public List<EquipmentRecord> Apparel {
return e.type == TypeApparel;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -484,7 +484,7 @@ public List<EquipmentRecord> Animals {
return e.type == TypeAnimals;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -496,7 +496,7 @@ public List<EquipmentRecord> Implants {
return e.type == TypeMedical;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -508,7 +508,7 @@ public List<EquipmentRecord> Buildings {
return e.type == TypeBuildings;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand All @@ -520,7 +520,7 @@ public List<EquipmentRecord> Other {
return e.type == TypeUncategorized;
});
result.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/OptionsApparel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using RimWorld;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -40,7 +40,7 @@ public void Sort() {
return 1;
}
else {
return x.label.CompareTo(y.label);
return string.Compare(x.label, y.label);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Source/OptionsHair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Sort() {
return 1;
}
else {
return x.label.CompareTo(y.label);
return string.Compare(x.label, y.label);
}
};
maleHairs.Sort(sorter);
Expand Down
2 changes: 1 addition & 1 deletion Source/PanelAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public PanelAppearance() {
return 1;
}
else {
return a.LabelCap.Resolve().CompareTo(b.LabelCap.Resolve());
return string.Compare(a.LabelCap.Resolve(), b.LabelCap.Resolve());
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Source/PanelEquipmentAvailable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ protected void SortByCost(ViewEquipmentList view, int direction) {
return result;
}
}
return x.Label.CompareTo(y.Label);
return string.Compare(x.Label, y.Label);
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ProviderBackstories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public ProviderBackstories() {

// Create sorted versions of the backstory lists
sortedChildhoodBackstories = new List<BackstoryDef>(childhoodBackstories);
sortedChildhoodBackstories.Sort((b1, b2) => b1.TitleCapFor(Gender.Male).CompareTo(b2.TitleCapFor(Gender.Male)));
sortedChildhoodBackstories.Sort((b1, b2) => string.Compare(b1.TitleCapFor(Gender.Male), b2.TitleCapFor(Gender.Male)));
sortedAdulthoodBackstories = new List<BackstoryDef>(adulthoodBackstories);
sortedAdulthoodBackstories.Sort((b1, b2) => b1.TitleCapFor(Gender.Male).CompareTo(b2.TitleCapFor(Gender.Male)));
sortedAdulthoodBackstories.Sort((b1, b2) => string.Compare(b1.TitleCapFor(Gender.Male), b2.TitleCapFor(Gender.Male)));
}

private void InitializeBackstoriesForPawnKind(PawnKindDef def) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ProviderEquipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected void Initialize() {
foreach (var type in types) {
List<EquipmentRecord> list = PrepareCarefully.Instance.EquipmentDatabase.AllEquipmentOfType(type).ToList();
list.Sort((EquipmentRecord a, EquipmentRecord b) => {
return a.Label.CompareTo(b.Label);
return string.Compare(a.Label, b.Label);
});
equipmentDictionary.Add(type, list);
}
Expand Down
19 changes: 11 additions & 8 deletions Source/ProviderPawnKinds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ProviderPawnKinds() {
//Logger.Debug("Excluding pawnKindDef because it's non-human {0}, {1}", kindDef.defName, kindDef.LabelCap);
continue;
}
if (kindDef.LabelCap.NullOrEmpty()) {
if (kindDef.LabelCap.ToString().NullOrEmpty()) {
continue;
}
if (kindDef.defaultFactionType != null) {
Expand All @@ -85,20 +85,23 @@ public ProviderPawnKinds() {
foreach (var pair in uniquePawnKindsByFaction) {
var faction = pair.Key;
var pawnKinds = new List<PawnKindDef>(pair.Value);
//Logger.Debug("Sorting unique pawns kinds by faction: " + faction?.defName);
pawnKinds.Sort((a, b) => {
return a.LabelCap.ToString().CompareTo(b.LabelCap.ToString());
});
pawnKindsByFaction.Add(new FactionPawnKinds() {
Faction = faction,
PawnKinds = pawnKinds
return string.Compare(a.LabelCap.ToString(), b.LabelCap.ToString());
});
if (!faction.LabelCap.ToString().NullOrEmpty()) {
pawnKindsByFaction.Add(new FactionPawnKinds() {
Faction = faction,
PawnKinds = pawnKinds
});
}
}

pawnKindsByFaction.Sort((a, b) => {
return a.Faction.LabelCap.ToString().CompareTo(b.Faction.LabelCap.ToString());
return string.Compare(a.Faction?.LabelCap.ToString(), b.Faction?.LabelCap.ToString());
});
otherPawnKinds.Sort((a, b) => {
return a.LabelCap.ToString().CompareTo(b.LabelCap.ToString());
return string.Compare(a.LabelCap.ToString(), b.LabelCap.ToString());
});

}
Expand Down
4 changes: 2 additions & 2 deletions Source/ProviderTraits.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using RimWorld;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -31,7 +31,7 @@ public ProviderTraits() {

// Create a sorted version of the trait list.
sortedTraits = new List<Trait>(traits);
sortedTraits.Sort((t1, t2) => t1.LabelCap.CompareTo(t2.LabelCap));
sortedTraits.Sort((t1, t2) => string.Compare(t1.LabelCap, t2.LabelCap));
}
}
}
2 changes: 1 addition & 1 deletion Source/RelationshipManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private List<ParentChildGroup> SortAndDedupeParentChildGroups(IEnumerable<Parent
return (a == null) ? -1 : 1;
}
}
return a.Id.CompareTo(b.Id);
return string.Compare(a.Id, b.Id);
});
}

Expand Down

0 comments on commit 09ee37b

Please sign in to comment.