gender-specific names can be used in .lua files with the gender upheld
Revert "monster name references in .lua files"
This reverts commit 0e0aa7bdf6.
This commit is contained in:
+6
-6
@@ -135,12 +135,12 @@ des.monster("giant spider")
|
|||||||
des.monster("s")
|
des.monster("s")
|
||||||
des.monster("s")
|
des.monster("s")
|
||||||
-- ladies of the evening
|
-- ladies of the evening
|
||||||
des.monster("amorous demon", 02, 08)
|
des.monster("succubus", 02, 08)
|
||||||
des.monster("amorous demon", 08, 08)
|
des.monster("succubus", 08, 08)
|
||||||
des.monster("amorous demon", 02, 14)
|
des.monster("incubus", 02, 14)
|
||||||
des.monster("amorous demon", 08, 14)
|
des.monster("incubus", 08, 14)
|
||||||
des.monster("amorous demon", 02, 17)
|
des.monster("incubus", 02, 17)
|
||||||
des.monster("amorous demon", 08, 17)
|
des.monster("incubus", 08, 17)
|
||||||
-- Police station (with drunken prisoners)
|
-- Police station (with drunken prisoners)
|
||||||
des.monster({ id = "Kop Kaptain", x=24, y=09, peaceful = 0 })
|
des.monster({ id = "Kop Kaptain", x=24, y=09, peaceful = 0 })
|
||||||
des.monster({ id = "Kop Lieutenant", x=20, y=09, peaceful = 0 })
|
des.monster({ id = "Kop Lieutenant", x=20, y=09, peaceful = 0 })
|
||||||
|
|||||||
+3
-1
@@ -468,8 +468,10 @@ arbitrate when there is a conflict between gender term (male or female) and
|
|||||||
wizard mode sanity check complained about Wizard's clone mimicking a monster
|
wizard mode sanity check complained about Wizard's clone mimicking a monster
|
||||||
new ^G gender-naming handling code required a guard against null permonst
|
new ^G gender-naming handling code required a guard against null permonst
|
||||||
pointer which could occur under some circumstances
|
pointer which could occur under some circumstances
|
||||||
replace some monster names in .lua files with their new equivalents
|
replace "aligned priest" entries in Pri-loca.lua, astral.lua, minetn-1.lua,
|
||||||
|
and sanctum.lua, with "aligned cleric"
|
||||||
attempting to swap places with a peaceful monster might cause it to flee
|
attempting to swap places with a peaceful monster might cause it to flee
|
||||||
|
gender-specific monster names can be used in .lua files with the gender upheld
|
||||||
|
|
||||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||||
also included tty support
|
also included tty support
|
||||||
|
|||||||
+35
-18
@@ -110,8 +110,8 @@ static long FDECL(line_dist_coord, (long, long, long, long, long, long));
|
|||||||
static void FDECL(l_push_wid_hei_table, (lua_State *, int, int));
|
static void FDECL(l_push_wid_hei_table, (lua_State *, int, int));
|
||||||
static int FDECL(get_table_align, (lua_State *));
|
static int FDECL(get_table_align, (lua_State *));
|
||||||
static int FDECL(get_table_monclass, (lua_State *));
|
static int FDECL(get_table_monclass, (lua_State *));
|
||||||
static int FDECL(find_montype, (lua_State *, const char *));
|
static int FDECL(find_montype, (lua_State *, const char *, int *));
|
||||||
static int FDECL(get_table_montype, (lua_State *));
|
static int FDECL(get_table_montype, (lua_State *, int *));
|
||||||
static int FDECL(get_table_int_or_random, (lua_State *, const char *, int));
|
static int FDECL(get_table_int_or_random, (lua_State *, const char *, int));
|
||||||
static int FDECL(get_table_buc, (lua_State *));
|
static int FDECL(get_table_buc, (lua_State *));
|
||||||
static int FDECL(get_table_objclass, (lua_State *));
|
static int FDECL(get_table_objclass, (lua_State *));
|
||||||
@@ -3011,31 +3011,39 @@ lua_State *L;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_montype(L, s)
|
find_montype(L, s, mgender)
|
||||||
lua_State *L UNUSED;
|
lua_State *L UNUSED;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
int *mgender;
|
||||||
{
|
{
|
||||||
int i;
|
int i, mgend = NEUTRAL;
|
||||||
|
|
||||||
for (i = LOW_PM; i < NUMMONS; i++)
|
i = name_to_monplus(s, (const char **) 0, &mgend);
|
||||||
if (!strcmpi(mons[i].pmnames[NEUTRAL], s)
|
if (i >= LOW_PM && i < NUMMONS) {
|
||||||
|| (mons[i].pmnames[MALE] != 0
|
if (is_male(&mons[i]) || is_female(&mons[i]))
|
||||||
&& !strcmpi(mons[i].pmnames[MALE], s))
|
mgend = is_female(&mons[i]) ? FEMALE : MALE;
|
||||||
|| (mons[i].pmnames[FEMALE] != 0
|
else
|
||||||
&& !strcmpi(mons[i].pmnames[FEMALE], s)))
|
mgend = (mgend == FEMALE) ? FEMALE
|
||||||
return i;
|
: (mgend == MALE) ? MALE : rn2(2);
|
||||||
|
if (mgender)
|
||||||
|
*mgender = mgend;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
if (mgender)
|
||||||
|
*mgender = NEUTRAL;
|
||||||
return NON_PM;
|
return NON_PM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_table_montype(L)
|
get_table_montype(L, mgender)
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
|
int *mgender;
|
||||||
{
|
{
|
||||||
char *s = get_table_str_opt(L, "id", NULL);
|
char *s = get_table_str_opt(L, "id", NULL);
|
||||||
int ret = NON_PM;
|
int ret = NON_PM;
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
ret = find_montype(L, s);
|
ret = find_montype(L, s, mgender);
|
||||||
Free(s);
|
Free(s);
|
||||||
if (ret == NON_PM)
|
if (ret == NON_PM)
|
||||||
nhl_error(L, "Unknown monster id");
|
nhl_error(L, "Unknown monster id");
|
||||||
@@ -3074,7 +3082,7 @@ lua_State *L;
|
|||||||
{
|
{
|
||||||
int argc = lua_gettop(L);
|
int argc = lua_gettop(L);
|
||||||
monster tmpmons;
|
monster tmpmons;
|
||||||
int mx = -1, my = -1;
|
int mx = -1, my = -1, mgend = NEUTRAL;
|
||||||
char *mappear = NULL;
|
char *mappear = NULL;
|
||||||
|
|
||||||
create_des_coder();
|
create_des_coder();
|
||||||
@@ -3106,7 +3114,9 @@ lua_State *L;
|
|||||||
tmpmons.id = NON_PM;
|
tmpmons.id = NON_PM;
|
||||||
} else {
|
} else {
|
||||||
tmpmons.class = -1;
|
tmpmons.class = -1;
|
||||||
tmpmons.id = find_montype(L, paramstr);
|
tmpmons.id = find_montype(L, paramstr, &mgend);
|
||||||
|
tmpmons.female = (mgend == FEMALE) ? FEMALE
|
||||||
|
: (mgend == MALE) ? MALE : rn2(2);
|
||||||
}
|
}
|
||||||
} else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING
|
} else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING
|
||||||
&& lua_type(L, 2) == LUA_TTABLE) {
|
&& lua_type(L, 2) == LUA_TTABLE) {
|
||||||
@@ -3119,7 +3129,9 @@ lua_State *L;
|
|||||||
tmpmons.id = NON_PM;
|
tmpmons.id = NON_PM;
|
||||||
} else {
|
} else {
|
||||||
tmpmons.class = -1;
|
tmpmons.class = -1;
|
||||||
tmpmons.id = find_montype(L, paramstr);
|
tmpmons.id = find_montype(L, paramstr, &mgend);
|
||||||
|
tmpmons.female = (mgend == FEMALE) ? FEMALE
|
||||||
|
: (mgend == MALE) ? MALE : rn2(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (argc == 3) {
|
} else if (argc == 3) {
|
||||||
@@ -3133,7 +3145,9 @@ lua_State *L;
|
|||||||
tmpmons.id = NON_PM;
|
tmpmons.id = NON_PM;
|
||||||
} else {
|
} else {
|
||||||
tmpmons.class = -1;
|
tmpmons.class = -1;
|
||||||
tmpmons.id = find_montype(L, paramstr);
|
tmpmons.id = find_montype(L, paramstr, &mgend);
|
||||||
|
tmpmons.female = (mgend == FEMALE) ? FEMALE
|
||||||
|
: (mgend == MALE) ? MALE : rn2(2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lcheck_param_table(L);
|
lcheck_param_table(L);
|
||||||
@@ -3174,7 +3188,10 @@ lua_State *L;
|
|||||||
|
|
||||||
get_table_xy_or_coord(L, &mx, &my);
|
get_table_xy_or_coord(L, &mx, &my);
|
||||||
|
|
||||||
tmpmons.id = get_table_montype(L);
|
tmpmons.id = get_table_montype(L, &mgend);
|
||||||
|
if (mgend != NEUTRAL)
|
||||||
|
tmpmons.female = mgend;
|
||||||
|
|
||||||
tmpmons.class = get_table_monclass(L);
|
tmpmons.class = get_table_monclass(L);
|
||||||
|
|
||||||
lua_getfield(L, 1, "inventory");
|
lua_getfield(L, 1, "inventory");
|
||||||
|
|||||||
Reference in New Issue
Block a user