Merge branch 'NetHack-3.7'
This commit is contained in:
@@ -789,6 +789,7 @@ traceback_handler(L)
|
||||
lua_State *L;
|
||||
{
|
||||
luaL_traceback(L, L, lua_tostring(L, 1), 0);
|
||||
/* TODO: call impossible() if fuzzing? */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
84
src/sp_lev.c
84
src/sp_lev.c
@@ -216,7 +216,6 @@ xchar x1, y1, x2, y2;
|
||||
int prop;
|
||||
{
|
||||
register xchar x, y;
|
||||
/* struct rm *lev; */ /* REVIEW: unreferenced */
|
||||
|
||||
x1 = max(x1, 1);
|
||||
x2 = min(x2, COLNO - 1);
|
||||
@@ -2361,7 +2360,7 @@ get_table_montype(L)
|
||||
lua_State *L;
|
||||
{
|
||||
char *s = get_table_str_opt(L, "id", NULL);
|
||||
int ret = NON_PM /*, i */ /* REVIEW: unreferenced */;
|
||||
int ret = NON_PM;
|
||||
|
||||
if (s) {
|
||||
ret = find_montype(L, s);
|
||||
@@ -2892,11 +2891,9 @@ lua_State *L;
|
||||
long ecoord;
|
||||
const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL };
|
||||
const int engrtypes2i[] = { DUST, ENGRAVE, BURN, MARK, ENGR_BLOOD, 0 };
|
||||
xchar x, y;
|
||||
xchar x = -1, y = -1;
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
x = y = 0; /* FIXME: quiet a warning for else clause below.
|
||||
should it actually be -1? */
|
||||
create_des_coder();
|
||||
|
||||
if (argc == 1) {
|
||||
@@ -2915,8 +2912,6 @@ lua_State *L;
|
||||
txt = dupstr(luaL_checkstring(L, 3));
|
||||
} else {
|
||||
nhl_error(L, "Wrong parameters");
|
||||
/* FIXME: this clause left etyp uninitialized so initialization
|
||||
to DUST was added above to quiet a macosx warning */
|
||||
}
|
||||
|
||||
if (x == -1 && y == -1)
|
||||
@@ -3168,7 +3163,7 @@ lua_State *L;
|
||||
const int stairdirs2i[] = { 0, 1 };
|
||||
|
||||
long scoord;
|
||||
int ax = -1, ay = -1; /* FIXME: initializers added, macosx warning */
|
||||
int ax = -1, ay = -1;
|
||||
int up;
|
||||
int ltype = lua_type(L, 1);
|
||||
|
||||
@@ -3331,7 +3326,8 @@ const struct {
|
||||
{ "anti magic", ANTI_MAGIC },
|
||||
{ "polymorph", POLY_TRAP },
|
||||
{ "vibrating square", VIBRATING_SQUARE },
|
||||
{ 0, 0 } };
|
||||
{ "random", -1 },
|
||||
{ 0, NO_TRAP } };
|
||||
|
||||
int
|
||||
get_table_traptype_opt(L, name, defval)
|
||||
@@ -3352,6 +3348,19 @@ int defval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
int
|
||||
get_traptype_byname(trapname)
|
||||
char *trapname;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; trap_types[i].name; i++)
|
||||
if (!strcmpi(trapname, trap_types[i].name))
|
||||
return trap_types[i].type;
|
||||
|
||||
return NO_TRAP;
|
||||
}
|
||||
|
||||
/* trap({ type = "hole", x = 1, y = 1 }); */
|
||||
/* trap("hole", 3, 4); */
|
||||
/* trap("level teleport", {5, 8}); */
|
||||
@@ -3363,49 +3372,27 @@ lua_State *L;
|
||||
{
|
||||
spltrap tmptrap;
|
||||
int x, y;
|
||||
/* long tcoord; */ /* REVIEW: unreferenced */
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
create_des_coder();
|
||||
|
||||
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
|
||||
const char *trapstr = luaL_checkstring(L, 1);
|
||||
int i;
|
||||
|
||||
tmptrap.type = -1;
|
||||
for (i = 0; trap_types[i].name; i++)
|
||||
if (!strcmpi(trapstr, trap_types[i].name)) {
|
||||
tmptrap.type = trap_types[i].type;
|
||||
break;
|
||||
}
|
||||
tmptrap.type = get_traptype_byname(trapstr);
|
||||
x = y = -1;
|
||||
} else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING
|
||||
&& lua_type(L, 2) == LUA_TTABLE) {
|
||||
const char *trapstr = luaL_checkstring(L, 1);
|
||||
int i;
|
||||
|
||||
tmptrap.type = -1;
|
||||
for (i = 0; trap_types[i].name; i++)
|
||||
if (!strcmpi(trapstr, trap_types[i].name)) {
|
||||
tmptrap.type = trap_types[i].type;
|
||||
break;
|
||||
}
|
||||
tmptrap.type = get_traptype_byname(trapstr);
|
||||
get_coord(L, 2, &x, &y);
|
||||
} else if (argc == 3) {
|
||||
const char *trapstr = luaL_checkstring(L, 1);
|
||||
int i;
|
||||
tmptrap.type = -1;
|
||||
for (i = 0; trap_types[i].name; i++)
|
||||
if (!strcmpi(trapstr, trap_types[i].name)) {
|
||||
tmptrap.type = trap_types[i].type;
|
||||
break;
|
||||
}
|
||||
|
||||
tmptrap.type = get_traptype_byname(trapstr);
|
||||
x = luaL_checkinteger(L, 2);
|
||||
y = luaL_checkinteger(L, 3);
|
||||
|
||||
if (tmptrap.type == -1)
|
||||
nhl_error(L, "Unknown trap type");
|
||||
|
||||
} else {
|
||||
lcheck_param_table(L);
|
||||
|
||||
@@ -3420,6 +3407,9 @@ lua_State *L;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmptrap.type == NO_TRAP)
|
||||
nhl_error(L, "Unknown trap type");
|
||||
|
||||
if (x == -1 && y == -1)
|
||||
tmptrap.coord = SP_COORD_PACK_RANDOM(0);
|
||||
else
|
||||
@@ -4328,11 +4318,12 @@ lua_State *L;
|
||||
{
|
||||
terrain tmpterrain;
|
||||
xchar x, y;
|
||||
/* char *ter; */ /* REVIEW: unreferenced */
|
||||
struct selectionvar *sel = NULL;
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
create_des_coder();
|
||||
tmpterrain.tlit = 0;
|
||||
tmpterrain.ter = INVALID_TYPE;
|
||||
|
||||
if (argc == 1) {
|
||||
lcheck_param_table(L);
|
||||
@@ -4357,12 +4348,10 @@ lua_State *L;
|
||||
} else if (argc == 2) {
|
||||
sel = l_selection_check(L, 1);
|
||||
tmpterrain.ter = check_mapchr(luaL_checkstring(L, 2));
|
||||
tmpterrain.tlit = luaL_optinteger(L, 3, 0); /* FIXME: this can never be here, argc==2 */
|
||||
} else if (argc == 3) {
|
||||
x = luaL_checkinteger(L, 1);
|
||||
y = luaL_checkinteger(L, 2);
|
||||
tmpterrain.ter = check_mapchr(luaL_checkstring(L, 3));
|
||||
tmpterrain.tlit = 0;
|
||||
} else {
|
||||
nhl_error(L, "wrong parameters");
|
||||
}
|
||||
@@ -4390,7 +4379,6 @@ lspo_replace_terrain(L)
|
||||
lua_State *L;
|
||||
{
|
||||
replaceterrain rt;
|
||||
/* char *toter, *fromter; */ /* REVIEW: unreferenced */
|
||||
xchar totyp, fromtyp;
|
||||
|
||||
create_des_coder();
|
||||
@@ -4571,8 +4559,7 @@ const char *name;
|
||||
int *x1, *y1, *x2, *y2;
|
||||
boolean optional;
|
||||
{
|
||||
int arrlen /*, i*/ /* REVIEW: unreferenced */;
|
||||
/* int retvals[4]; */ /* REVIEW: unreferenced */
|
||||
int arrlen;
|
||||
|
||||
lua_getfield(L, 1, name);
|
||||
if (optional && lua_type(L, -1) == LUA_TNIL) {
|
||||
@@ -4904,7 +4891,6 @@ lua_State *L;
|
||||
const char *const dbopens[] = { "open", "closed", "random", NULL };
|
||||
const int dbopens2i[] = { 1, 0, -1, -2 };
|
||||
xchar x, y;
|
||||
/* int dbopen; */
|
||||
int mx, my, dir;
|
||||
int db_open;
|
||||
long dcoord;
|
||||
@@ -4922,7 +4908,6 @@ lua_State *L;
|
||||
y = my;
|
||||
|
||||
get_location_coord(&x, &y, DRY | WET | HOT, g.coder->croom, dcoord);
|
||||
/* REVIEW: from here down was using dbopen previously */
|
||||
if (db_open == -1)
|
||||
db_open = !rn2(2);
|
||||
if (!create_drawbridge(x, y, dir, db_open ? TRUE : FALSE))
|
||||
@@ -5088,9 +5073,6 @@ lua_State *L;
|
||||
int argc = lua_gettop(L);
|
||||
boolean freesel = FALSE;
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
/* REVIEW: compiler warning,
|
||||
all assignments conditional
|
||||
so initializer was added */
|
||||
|
||||
create_des_coder();
|
||||
|
||||
@@ -5123,9 +5105,6 @@ lua_State *L;
|
||||
int argc = lua_gettop(L);
|
||||
boolean freesel = FALSE;
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
/* REVIEW: compiler warning,
|
||||
all assignments conditional
|
||||
so initializer was added */
|
||||
|
||||
create_des_coder();
|
||||
|
||||
@@ -5192,15 +5171,14 @@ lua_State *L;
|
||||
/* reset_level is only needed for testing purposes */
|
||||
int
|
||||
lspo_reset_level(L)
|
||||
lua_State *L UNUSED; /* macosx complaint needed UNUSED */
|
||||
lua_State *L UNUSED;
|
||||
{
|
||||
boolean wtower = In_W_tower(u.ux, u.uy, &u.uz);
|
||||
|
||||
create_des_coder();
|
||||
makemap_prepost(TRUE, wtower);
|
||||
clear_level_structures();
|
||||
return 0; /* REVIEW: warning, int fn must return value
|
||||
so added "return 0; " */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* map({ x = 10, y = 10, map = [[...]] }); */
|
||||
@@ -5211,9 +5189,7 @@ lspo_map(L)
|
||||
lua_State *L;
|
||||
{
|
||||
mazepart tmpmazepart;
|
||||
/* xchar halign, valign; */ /* REVIEW: unreferenced */
|
||||
xchar tmpxstart, tmpystart, tmpxsize, tmpysize;
|
||||
/* unpacked_coord upc; */ /* REVIEW: unreferenced */
|
||||
|
||||
/*
|
||||
TODO: allow passing an array of strings as map data
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Makefile1.cross (this file) is for the host-side obj files and
|
||||
# utilities that will run on the host platform only.
|
||||
#
|
||||
# Makefile2.cross is for the target platform obj files
|
||||
# Makefile2.cross is the the target platform obj files
|
||||
# and utilities.
|
||||
#
|
||||
# Makefile2 utilizes the djgpp cross-compiler from Andrew Wu:
|
||||
@@ -143,8 +143,8 @@ TEXTIO = $(HOST_O)tiletext.o $(HOST_O)tiletxt.o $(HOST_O)drawing.o $(HOST_O
|
||||
TEXTIO2 = $(HOST_O)tiletex2.o $(HOST_O)tiletxt2.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \
|
||||
$(HOST_O)objects.o
|
||||
|
||||
PLANAR_TIB = $(DAT)/NETHACK1.TIB
|
||||
OVERVIEW_TIB = $(DAT)/NETHACKO.TIB
|
||||
#PLANAR_TIB = $(DAT)/NETHACK1.TIB
|
||||
#OVERVIEW_TIB = $(DAT)/NETHACKO.TIB
|
||||
TILE_BMP = $(DAT)/NHTILES.BMP
|
||||
|
||||
TILEUTIL = $(TILOBJ) $(U)tile2bin $(U)til2bin2 $(TILE_BMP) $(PLANAR_TIB) $(OVERVIEW_TIB)
|
||||
|
||||
@@ -363,7 +363,7 @@ LUAOBJFILES2 = $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \
|
||||
$(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o
|
||||
LUAOBJFILES3 = $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \
|
||||
$(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o
|
||||
LUAOBJFILES3 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
|
||||
LUAOBJFILES4 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
|
||||
$(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o
|
||||
|
||||
#LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \
|
||||
@@ -374,7 +374,7 @@ LUAOBJFILES3 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
|
||||
# $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \
|
||||
# $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
|
||||
# $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o
|
||||
|
||||
|
||||
LUALIBOBJS = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3) $(LUAOBJFILES4)
|
||||
endif
|
||||
|
||||
@@ -746,11 +746,12 @@ endif
|
||||
#==========================================
|
||||
|
||||
$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS)
|
||||
ar rcS $@ $(PDCLIBOBJS1)
|
||||
ar rcS $@ $(PDCLIBOBJS2)
|
||||
ar rcS $@ $(PDCLIBOBJS3)
|
||||
ar rcS $@ $(PDCLIBOBJS4)
|
||||
ar rcs $@ $(PDCOBJS)
|
||||
if [ -f $@ ]; then rm $@; fi;
|
||||
$(TARGET_AR) rcS $@ $(PDCLIBOBJS1)
|
||||
$(TARGET_AR) rcS $@ $(PDCLIBOBJS2)
|
||||
$(TARGET_AR) rcS $@ $(PDCLIBOBJS3)
|
||||
$(TARGET_AR) rcS $@ $(PDCLIBOBJS4)
|
||||
$(TARGET_AR) rcs $@ $(PDCOBJS)
|
||||
|
||||
#==========================================
|
||||
# Other Util Dependencies.
|
||||
@@ -794,10 +795,11 @@ $(O)luac.o: $(LUASRC)/luac.c
|
||||
#==========================================
|
||||
|
||||
$(LUALIB): $(LUALIBOBJS)
|
||||
if [ -f $@ ]; then rm $@; fi;
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES1)
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES2)
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES3)
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES4)
|
||||
$(TARGET_AR) rcs $@ $(LUAOBJFILES4)
|
||||
|
||||
#$(LUADLL): $(LUALIBOBJS)
|
||||
# $(TARGET_CC) -shared -Wl,--export-all-symbols \
|
||||
|
||||
@@ -1,34 +1,54 @@
|
||||
#!/bin/sh
|
||||
if [ -z "$TRAVIS_BUIILD_DIR" ]; then
|
||||
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
export DJGPP_TOP=$(pwd)/djgpp
|
||||
else
|
||||
export DJGPP_TOP="$TRAVIS_BUILD_DIR/djgpp"
|
||||
fi
|
||||
export
|
||||
|
||||
DJGPP_URL="https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/"
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
#Mac
|
||||
DJGPP_FILE="djgpp-osx-gcc550.tar.bz2"
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
|
||||
#Linux
|
||||
DJGPP_FILE="djgpp-linux64-gcc550.tar.bz2"
|
||||
elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW32_NT" ]; then
|
||||
#mingw
|
||||
DJGPP_FILE="djgpp-mingw-gcc550-standalone.zip"
|
||||
else
|
||||
echo "No DJGPP release for you, sorry."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DJGPP_URL="$DJGPP_URL$DJGPP_FILE"
|
||||
|
||||
# export
|
||||
|
||||
cd util
|
||||
if [ ! -d ../djgpp/i586-pc-msdosdjgpp ]; then
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
#Mac
|
||||
wget --no-hsts https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/djgpp-osx-gcc550.tar.bz2
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
|
||||
#Linux
|
||||
wget --no-hsts https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/djgpp-linux64-gcc550.tar.bz2
|
||||
elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW32_NT" ]; then
|
||||
#mingw
|
||||
wget --no-hsts https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/djgpp-mingw-gcc550-standalone.zip
|
||||
fi
|
||||
if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then
|
||||
tar xjf util/djgpp-linux64-gcc550.tar.bz2
|
||||
fi
|
||||
if [ ! -f "$DJGPP_FILE" ]; then
|
||||
wget --no-hsts "$DJGPP_URL"
|
||||
fi
|
||||
cd ../
|
||||
|
||||
|
||||
if [ ! -d ../djgpp/i586-pc-msdosdjgpp ]; then
|
||||
tar xjf "util/$DJGPP_FILE"
|
||||
fi
|
||||
|
||||
#echo after tar
|
||||
# cd ../
|
||||
|
||||
#pwd
|
||||
|
||||
# PDCurses
|
||||
if [ ! -d "../pdcurses" ]; then
|
||||
echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git"
|
||||
git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses
|
||||
fi
|
||||
cd djgpp
|
||||
|
||||
# DOS-extender for use with djgpp
|
||||
cd djgpp
|
||||
if [ ! -d cwsdpmi ]; then
|
||||
wget --no-hsts http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
|
||||
mkdir -p cwsdpmi
|
||||
@@ -37,8 +57,14 @@ if [ ! -d cwsdpmi ]; then
|
||||
cd ../
|
||||
rm csdpmi7b.zip
|
||||
fi
|
||||
cd ../src
|
||||
pwd
|
||||
cd ../
|
||||
|
||||
|
||||
#echo after dos extender
|
||||
|
||||
|
||||
cd src
|
||||
|
||||
mkdir -p ../msdos-binary
|
||||
cp ../dat/data.base ../dat/data.bas
|
||||
cp ../include/patchlevel.h ../include/patchlev.h
|
||||
@@ -47,21 +73,26 @@ cp ../sys/share/posixregex.c ../sys/share/posixreg.c
|
||||
#cp ../sys/msdos/Makefile1.cross ../src/Makefile1
|
||||
#cp ../sys/msdos/Makefile2.cross ../src/Makefile2
|
||||
make -f ../sys/msdos/Makefile1.cross
|
||||
cat ../include/date.h
|
||||
#cat ../include/date.h
|
||||
export GCC_EXEC_PREFIX=$DJGPP_TOP/lib/gcc/
|
||||
export
|
||||
pwd
|
||||
# export
|
||||
|
||||
#pwd
|
||||
|
||||
make -f ../sys/msdos/Makefile2.cross
|
||||
unset GCC_EXEC_PREFIX
|
||||
pwd
|
||||
ls ../djgpp/cwsdpmi/bin
|
||||
ls .
|
||||
#pwd
|
||||
|
||||
#ls ../djgpp/cwsdpmi/bin
|
||||
#ls .
|
||||
|
||||
if [ -f ../djgpp/cwsdpmi/bin/CWSDPMI.EXE ]; then
|
||||
cp ../djgpp/cwsdpmi/bin/CWSDPMI.EXE ../msdos-binary/CWSDPMI.EXE;
|
||||
fi
|
||||
ls -l ../msdos-binary
|
||||
|
||||
# ls -l ../msdos-binary
|
||||
cd ../msdos-binary
|
||||
zip -9 ../NH370DOS.ZIP *
|
||||
cd ../
|
||||
ls -l NH370DOS.ZIP
|
||||
# ls -l NH370DOS.ZIP
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "tile.h"
|
||||
#include "pctiles.h"
|
||||
|
||||
#include <dos.h>
|
||||
/* #include <dos.h> */
|
||||
#ifndef MONITOR_HEAP
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user