From 1d5d6ead651174a10f554e5a27ae0caa6511e2c6 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 19 Mar 2020 14:40:12 +0100 Subject: [PATCH] Fix misleading naming --- src/lua_hooklib.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 078732541..549d1a3ef 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -81,9 +81,7 @@ struct hook_s UINT16 id; union { mobjtype_t mt; - char *skinname; - char *musname; - char *funcname; + char *str; } s; boolean error; }; @@ -152,16 +150,16 @@ static int lib_addHook(lua_State *L) break; case hook_BotAI: case hook_ShouldJingleContinue: - hook.s.skinname = NULL; + hook.s.str = NULL; if (lua_isstring(L, 2)) { // lowercase copy - hook.s.skinname = Z_StrDup(lua_tostring(L, 2)); - strlwr(hook.s.skinname); + hook.s.str = Z_StrDup(lua_tostring(L, 2)); + strlwr(hook.s.str); } break; case hook_LinedefExecute: // Linedef executor functions - hook.s.skinname = Z_StrDup(luaL_checkstring(L, 2)); - strupr(hook.s.skinname); + hook.s.str = Z_StrDup(luaL_checkstring(L, 2)); + strupr(hook.s.str); break; default: break; @@ -1064,7 +1062,7 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) for (hookp = roothook; hookp; hookp = hookp->next) { if (hookp->type != hook_BotAI - || (hookp->s.skinname && strcmp(hookp->s.skinname, ((skin_t*)tails->skin)->name))) + || (hookp->s.str && strcmp(hookp->s.str, ((skin_t*)tails->skin)->name))) continue; if (lua_gettop(gL) == 0) @@ -1126,7 +1124,7 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) for (hookp = linedefexecutorhooks; hookp; hookp = hookp->next) { - if (strcmp(hookp->s.funcname, line->text)) + if (strcmp(hookp->s.str, line->text)) continue; if (lua_gettop(gL) == 0) @@ -1664,7 +1662,7 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) for (hookp = roothook; hookp; hookp = hookp->next) { if (hookp->type != hook_ShouldJingleContinue - || (hookp->s.musname && strcmp(hookp->s.musname, musname))) + || (hookp->s.str && strcmp(hookp->s.str, musname))) continue; if (lua_gettop(gL) == 0)