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:
@@ -547,6 +547,8 @@ engraving with non-blade dulled the weapon anyway (pr #464)
|
||||
'sortdiscoveries:s' had a spurious generic header shown at the start of the
|
||||
last class if there were any artifacts or unique items discovered
|
||||
loss of saddle by opening magic left hero mounted on unsaddled steed
|
||||
avoid segfault during error reporting for bad 'O' value(s) after theme rooms
|
||||
have been initialized, leaving iflags.in_lua set
|
||||
|
||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||
also included tty support
|
||||
|
||||
@@ -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