fix pull request #471 - error message segfault
for invalid 'O' values when option error messages are issued after theme rooms have left iflags.in_lua set. The pull request just turned the flag off but lua code turns back on and off after that for other dungeon levels. nhlua probably shouldn't be sharing the same error routine as options processing, or at least it should toggle the flag on and off at need instead of pretending that it can be global. Fixes #471
This commit is contained in:
@@ -2899,7 +2899,8 @@ config_erradd(const char *buf)
|
||||
buf = "Unknown error";
|
||||
|
||||
if (iflags.in_lua) {
|
||||
struct _config_error_errmsg *dat = (struct _config_error_errmsg *) alloc(sizeof (struct _config_error_errmsg));
|
||||
struct _config_error_errmsg *dat
|
||||
= (struct _config_error_errmsg *) alloc(sizeof *dat);
|
||||
|
||||
dat->next = config_error_msg;
|
||||
dat->line_num = config_error_data->line_num;
|
||||
|
||||
@@ -277,6 +277,8 @@ makerooms(void)
|
||||
} else {
|
||||
/* success; save state for this dungeon branch */
|
||||
g.luathemes[u.uz.dnum] = (genericptr_t) themes;
|
||||
/* keep themes context, so not 'nhl_done(themes);' */
|
||||
iflags.in_lua = FALSE; /* can affect error messages */
|
||||
}
|
||||
}
|
||||
if (!themes) /* don't try again when making next level */
|
||||
@@ -299,11 +301,11 @@ makerooms(void)
|
||||
}
|
||||
} else {
|
||||
if (themes) {
|
||||
g.in_mk_themerooms = TRUE;
|
||||
iflags.in_lua = g.in_mk_themerooms = TRUE;
|
||||
g.themeroom_failed = FALSE;
|
||||
lua_getglobal(themes, "themerooms_generate");
|
||||
lua_call(themes, 0, 0);
|
||||
g.in_mk_themerooms = FALSE;
|
||||
iflags.in_lua = g.in_mk_themerooms = FALSE;
|
||||
if (g.themeroom_failed
|
||||
&& ((themeroom_tries++ > 10)
|
||||
|| (g.nroom >= (MAXNROFROOMS / 6))))
|
||||
|
||||
Reference in New Issue
Block a user