Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Tykvesh

Add support for data like 1.#INF, 1.#QNAN to prevent corruptions

Recommended Posts

Sometimes the game tries to save weird data like infinite numbers, not-a-number numbers, etc. Because the game doesn't know how to read such data from the save file's string, the world will be considered corrupted.

Here's an example:

[00:00:08]: [string "scripts/shardindex.lua"]:195: Corrupt Save file [session/4ED11F7829D3FB93/0000002167]
LUA ERROR stack traceback:
=[C]:-1 in (global) assert (C) <-1--1>
scripts/shardindex.lua:195 in (upvalue) OnLoadSaveDataFile (Lua) <181-200>
     savedata = [string "return {world_network={persistdata={worldtemperature={seasontem..."]:1: '}' expected near '#'

A snippet from that broken save's string that prevents it from loading:

workable={maxwork=-1,workleft=1.#QNAN}}
Link to comment
Share on other sites

  • Developer

CarlZalph is right, the issue isn't that its saving them, its that they are being generated/saved in the first place.
Along with that, the performance costs of testing for these invalid values would be astronomical, increasing the time it takes to save you game by a large amount, it's not feasible resolve this from saving/loading, but rather preventing corrupted values in the first place.

Link to comment
Share on other sites

  • Developer

There seem to be a fair number of them popping up lately. Thank you for taking the time to help people out and try to restore their world's.

I'll investigate it some more tomorrow and see if there is something that can be done. I'd rather the game crash on save than corrupt their world's.

Link to comment
Share on other sites