from the currently configured ones, and then bring the Random Seed
box back up, the wrong parameters get shown, and the resulting
random seed is incorrect for the current game.
At least, it was, until this checkin.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5808
cda61777-01e9-0310-a592-
d414129be87e
char **preset_names;
int npresets, presetsize;
char **preset_names;
int npresets, presetsize;
- game_params *params, *tmpparams;
+ game_params *params, *curparams;
struct midend_state_entry *states;
game_drawstate *drawstate;
game_state *oldstate;
struct midend_state_entry *states;
game_drawstate *drawstate;
game_state *oldstate;
me->nstates = me->statesize = me->statepos = 0;
me->states = NULL;
me->params = ourgame->default_params();
me->nstates = me->statesize = me->statepos = 0;
me->states = NULL;
me->params = ourgame->default_params();
me->desc = NULL;
me->seedstr = NULL;
me->aux_info = NULL;
me->desc = NULL;
me->seedstr = NULL;
me->aux_info = NULL;
if (me->aux_info)
me->ourgame->free_aux_info(me->aux_info);
me->ourgame->free_params(me->params);
if (me->aux_info)
me->ourgame->free_aux_info(me->aux_info);
me->ourgame->free_params(me->params);
- if (me->tmpparams)
- me->ourgame->free_params(me->tmpparams);
+ if (me->curparams)
+ me->ourgame->free_params(me->curparams);
newseed[i] = '0' + random_upto(me->random, 10);
sfree(me->seedstr);
me->seedstr = dupstr(newseed);
newseed[i] = '0' + random_upto(me->random, 10);
sfree(me->seedstr);
me->seedstr = dupstr(newseed);
+
+ if (me->curparams)
+ me->ourgame->free_params(me->curparams);
+ me->curparams = me->ourgame->dup_params(me->params);
me->aux_info = NULL;
rs = random_init(me->seedstr, strlen(me->seedstr));
me->aux_info = NULL;
rs = random_init(me->seedstr, strlen(me->seedstr));
- me->desc = me->ourgame->new_desc
- (me->tmpparams ? me->tmpparams : me->params, rs, &me->aux_info);
+ me->desc = me->ourgame->new_desc(me->curparams, rs, &me->aux_info);
-
- if (me->tmpparams) {
- me->ourgame->free_params(me->tmpparams);
- me->tmpparams = NULL;
- }
* the former is likely to persist across many code
* changes).
*/
* the former is likely to persist across many code
* changes).
*/
- parstr = me->ourgame->encode_params(me->params, which == CFG_SEED);
+ parstr = me->ourgame->encode_params(me->curparams, which == CFG_SEED);
if (which == CFG_DESC) {
ret[0].sval = snewn(strlen(parstr) + strlen(me->desc) + 2, char);
sprintf(ret[0].sval, "%s:%s", parstr, me->desc);
if (which == CFG_DESC) {
ret[0].sval = snewn(strlen(parstr) + strlen(me->desc) + 2, char);
sprintf(ret[0].sval, "%s:%s", parstr, me->desc);
me->ourgame->free_params(tmpparams);
return error;
}
me->ourgame->free_params(tmpparams);
return error;
}
- if (me->tmpparams)
- me->ourgame->free_params(me->tmpparams);
- me->tmpparams = tmpparams;
+ if (me->curparams)
+ me->ourgame->free_params(me->curparams);
+ me->curparams = tmpparams;
/*
* Now filter only the persistent parts of this state into
/*
* Now filter only the persistent parts of this state into