Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
301 stars 47 forks source link

Incorrect warning message #55

Closed KroArtem closed 8 years ago

KroArtem commented 8 years ago

I was playing a quest which objectives were to defeat Boii and some other stuff, but the game freezed (and the system too). This is what I'll investigate later. However, when I rebooted and tried to launch autosave, it said "Warning not saved with this version." which is not true. This is exactly the same version.

My versions: Wyrmsun: 39d369d261f852662f93d67263a7efd5125802a1 Wyrmgus: Andrettin/Wyrmgus@67e192375633aa7ca1fa4e8fb0c26b3d602a7586

Savegame: https://www.dropbox.com/s/8stuhsce5jkbz9j/autosave.sav.gz?dl=0

Andrettin commented 8 years ago

I have noticed this as well. It seems to be occurring since Stratagus changed version to 3.4.0.

KroArtem commented 8 years ago

Well, I tried to figure it out but failed. :) When the game is saved, this line adds info about version to the file:

file.printf("---  \"comment\", \"Generated by Stratagus Version " VERSION "\",\n");

However, when savegame is read, a check occurs:

char buf[32];

const char *version = LuaToString(l, j + 1);
strncpy(buf, VERSION, sizeof(buf));
if (strcmp(buf, version)) {
    fprintf(stderr, "Warning not saved with this version.\n");

char buf[32] couldn't be enough for a version+gitrev.

I had problems with debugging it in IDE, but when I changed buf[32] to buf[64] outside of IDE and compiled it, I didn't have any problems with saving/loading.

Andrettin commented 8 years ago

I'm sorry, I didn't understand - using char buf[64] solved the issue or not?

KroArtem commented 8 years ago

Yes, it solved. I just pointed out that I had problems with IDE.

Andrettin commented 8 years ago

Awesome :) I've uploaded the fix: https://github.com/Andrettin/Wyrmgus/commit/d63df98c6faf450f52acaa1592e5d50cd04fff25