Skip to content

Commit

Permalink
support monster() and object() on lua
Browse files Browse the repository at this point in the history
  • Loading branch information
argrath committed Oct 3, 2023
1 parent 7a75e12 commit e474aa4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/sp_lev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit e474aa4

Please sign in to comment.