Hey all!
i´m trying to add new buildings with a mod. they work super fine on a new game. But after save and load i get hash collision errors for as it looks every thing:
(http://fs5.directupload.net/images/160828/niwh4b65.png)
it only happens after i load up a save game (save is new, nothing is build, nothing is done, just started new game and saved)
the output.log dont have any other informations as the exception message in the call stack.
in A14 it works just fine
also all mountain tiles are flat
(http://fs5.directupload.net/images/160828/mkyuxoqe.png)
any advices how to fix that?
1) IL spy or any other reflector (there are no "decompilers")
2) Notepad++
3) Use keywords to find place, where check is located
Verse.Log.Error(string.Concat(new object[] { "Hash collision between ", this.<def>__2, " and ", this.<thingDefsByShortHash>__0[this.<def>__2.shortHash], ": both have short hash ", this.<def>__2.shortHash }));
4) Then, follow keywords to find, how hash is computed for objects
5)
public static void GiveShortHash(Def def)
{
if (def.shortHash != 0)
{
Log.Error(def + " already has short hash.");
}
else
{
ushort item = (ushort) (GenText.StableStringHash(def.defName) % 0xffff);
int num2 = 0;
while (takenHashes.Contains(item) || (item == 0))
{
item = (ushort) (item + 1);
num2++;
if (num2 > 0x3e8)
{
Log.Message("Short hashes are saturated because there are too many definitions. Compressed saveload will fail.");
}
}
def.shortHash = item;
takenHashes.Add(item);
}
}
6) You have too many zeros, probably
public override void PostLoad()
{
base.PostLoad();
ShortHashGiver.GiveShortHash(this);
}
not executed properly
7) Make sure, that your objects have proper postload code and no hook is injected into given method
8) Check log (it's located inside _data folder) for warnings and errors, probably you have too many objects
Ok got it. It seems, my ThingDef classes dont had a defName for hash generation.
thanks
Also note that changing anything about floors and terrain requires a new game or you will get the "sand bug".
Quote from: Hatti on August 27, 2016, 10:44:34 PM
Ok got it. It seems, my ThingDef classes dont had a defName for hash generation.
thanks
very good that you managed to solve problem self, you have bright future ahead, keep going.
Thanks for posting the solution that you found.
I was having a similar issue but hadnt had time to look into it. I will try that fix when I get back to my machine.