From 727c6fa0d64d3432198eb4e3d09e29ed13ab3b5b Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Mon, 27 Mar 2023 15:58:26 +0900 Subject: [PATCH] support monster() and object() on lua --- src/sp_lev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index 066cd7f1d..b80d3c443 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3111,7 +3111,7 @@ get_table_montype(lua_State *L, int *mgender) int ret = NON_PM; if (s) { - ret = find_montype(L, s, mgender); + ret = find_montype(L, utf8toic(s), mgender); Free(s); if (ret == NON_PM) nhl_error(L, "Unknown monster id"); @@ -3191,7 +3191,7 @@ lspo_monster(lua_State *L) tmpmons.id = NON_PM; } else { tmpmons.class = -1; - tmpmons.id = find_montype(L, paramstr, &mgend); + tmpmons.id = find_montype(L, utf8toic(paramstr), &mgend); tmpmons.female = (mgend == FEMALE) ? FEMALE : (mgend == MALE) ? MALE : rn2(2); } @@ -3206,7 +3206,7 @@ lspo_monster(lua_State *L) tmpmons.id = NON_PM; } else { tmpmons.class = -1; - tmpmons.id = find_montype(L, paramstr, &mgend); + tmpmons.id = find_montype(L, utf8toic(paramstr), &mgend); tmpmons.female = (mgend == FEMALE) ? FEMALE : (mgend == MALE) ? MALE : rn2(2); } @@ -3222,7 +3222,7 @@ lspo_monster(lua_State *L) tmpmons.id = NON_PM; } else { tmpmons.class = -1; - tmpmons.id = find_montype(L, paramstr, &mgend); + tmpmons.id = find_montype(L, utf8toic(paramstr), &mgend); tmpmons.female = (mgend == FEMALE) ? FEMALE : (mgend == MALE) ? MALE : rn2(2); } @@ -3461,7 +3461,7 @@ static int get_table_objtype(lua_State *L) { char *s = get_table_str_opt(L, "id", NULL); - int ret = find_objtype(L, s); + int ret = find_objtype(L, utf8toic(s)); Free(s); return ret; @@ -3519,7 +3519,7 @@ lspo_object(lua_State *L) tmpobj.id = STRANGE_OBJECT; } else { tmpobj.class = -1; - tmpobj.id = find_objtype(L, paramstr); + tmpobj.id = find_objtype(L, utf8toic(paramstr)); } } else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING && lua_type(L, 2) == LUA_TTABLE) { @@ -3532,7 +3532,7 @@ lspo_object(lua_State *L) tmpobj.id = STRANGE_OBJECT; } else { tmpobj.class = -1; - tmpobj.id = find_objtype(L, paramstr); + tmpobj.id = find_objtype(L, utf8toic(paramstr)); } } else if (argc == 3 && lua_type(L, 2) == LUA_TNUMBER && lua_type(L, 3) == LUA_TNUMBER) { @@ -3546,7 +3546,7 @@ lspo_object(lua_State *L) tmpobj.id = STRANGE_OBJECT; } else { tmpobj.class = -1; - tmpobj.id = find_objtype(L, paramstr); + tmpobj.id = find_objtype(L, utf8toic(paramstr)); } } else { lcheck_param_table(L);