mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 08:25:45 -07:00
General robustness patch from James Harvey:
- most game_size() functions now work in doubles internally and round to nearest, meaning that they have less tendency to try to alter a size they returned happily from a previous call - couple of fiddly fixes (memory leaks, precautionary casts in printf argument lists) - midend_deserialise() now constructs an appropriate drawstate, which I can't think how I overlooked myself since I _thought_ I went through the entire midend structure field by field! [originally from svn r6041]
This commit is contained in:
9
midend.c
9
midend.c
@ -149,6 +149,7 @@ void midend_free(midend_data *me)
|
||||
random_free(me->random);
|
||||
sfree(me->states);
|
||||
sfree(me->desc);
|
||||
sfree(me->privdesc);
|
||||
sfree(me->seedstr);
|
||||
sfree(me->aux_info);
|
||||
me->ourgame->free_params(me->params);
|
||||
@ -1351,7 +1352,7 @@ char *midend_deserialise(midend_data *me,
|
||||
uistr = val;
|
||||
val = NULL;
|
||||
} else if (!strcmp(key, "TIME")) {
|
||||
elapsed = strtod(val, NULL);
|
||||
elapsed = atof(val);
|
||||
} else if (!strcmp(key, "NSTATES")) {
|
||||
nstates = atoi(val);
|
||||
if (nstates <= 0) {
|
||||
@ -1516,6 +1517,12 @@ char *midend_deserialise(midend_data *me,
|
||||
|
||||
midend_set_timer(me);
|
||||
|
||||
if (me->drawstate)
|
||||
me->ourgame->free_drawstate(me->drawstate);
|
||||
me->drawstate =
|
||||
me->ourgame->new_drawstate(me->states[me->statepos-1].state);
|
||||
midend_size_new_drawstate(me);
|
||||
|
||||
ret = NULL; /* success! */
|
||||
|
||||
cleanup:
|
||||
|
Reference in New Issue
Block a user