Closed LeifAndersen closed 6 years ago
Oh interesting. It looks like it was actually saving when it crashed. The only function that would be looking up "FACING_" is:
static void save(cJSON *root)
{
cJSON_AddStringToObject(root, "type", "Bob");
cJSON_AddNumberToObject(root, "x", world.bob->checkpoints[0].x);
cJSON_AddNumberToObject(root, "y", world.bob->checkpoints[0].y);
cJSON_AddStringToObject(root, "facing", getLookupName("FACING_", world.bob->facing));
}
Maybe it would make sense to have an optional default value that that function can take. And only call exit if one can't be found and no default value is given?
Also worth noting, when I restarted the game, it thought I had completed the mission, but forgot all of the items I'd collected. So I didn't get any mission complete screen, but could also quit and save any time I wanted.
I'm also not sure if it reset my life+battery counters. Or maybe its now permanently at +1 to what it was.
A value of 2 for FACING_ would imply that Bob was dying at the time that the game was saved:
https://github.com/stephenjsweeney/blobwarsAttrition/blob/master/src/defs.h#L158
Was this the case? It's the only reason he should've been in this state.
re: the mission inconsistent state - is this using the latest code in develop that is saving the game atomically?
Edit: now looking at the code, Bob may have also been in a stunned state. I'll see about resetting that when the game is saved.
Updated in the develop branch.
A value of 2 for FACING_ would imply that Bob was dying at the time that the game was saved:
I don't know for sure. I do know I got shot and was bouncing around(, or maybe it was enemies, the screen was very chaotic...) So its possible.
re: the mission inconsistent state - is this using the latest code in develop that is saving the game atomically?
IIRC, I was testing this under v1.1 in master.
Edit: now looking at the code, Bob may have also been in a stunned state. I'll see about resetting that when the game is saved.
Ah, okay, that would be more likely...being in a stunned state while winning the level.
Updated in the develop branch.
Okay cool. I'll see if I can reproduce there.
This seems to be fixed in the dev branch.
I was playing beach 3, I just got the heart and unlocked the battery powered doors, and the game crashed. Here is the output for the program:
I'd have to look at the code to be sure, but this almost looks like an of by one error.