annotate rogue4/acinclude.m4 @ 296:000b1c5b8d63

UltraRogue: fix inventory collision after save and restore. Inventory letters are based on "identifiers" stored in objects' o_ident field. Identifiers are allocated by get_ident(), which keeps a list of objects that have them, to avoid giving the same identifier to multiple objects. The list is not stored in the savefile, so after restore, get_ident() was not aware of existing identifiers. This resulted in picked-up objects having the same inventory letters as objects restored from the file. The restore code now adds all objects with identifiers to the list.
author John "Elwin" Edwards
date Mon, 15 Jan 2018 20:20:35 -0500
parents a1dc75e38e73
children 029c1f5c5588
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
1 AC_DEFUN([MP_WITH_CURSES],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
2 [AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,)
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
3 mp_save_LIBS="$LIBS"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
4 CURSES_LIB=""
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
5 if test "$with_ncurses" != yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
6 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
7 AC_CACHE_CHECK([for working curses], mp_cv_curses,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
8 [LIBS="$LIBS -lcurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
9 AC_TRY_LINK(
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
10 [#include <curses.h>],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
11 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
12 mp_cv_curses=yes, mp_cv_curses=no)])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
13 if test "$mp_cv_curses" = yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
14 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
15 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
16 #AC_DEFINE(HAVE_CURSES_H)
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
17 CURSES_LIB="-lcurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
18 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
19 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
20 if test ! "$CURSES_LIB"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
21 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
22 AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
23 [LIBS="$mp_save_LIBS -lncurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
24 AC_TRY_LINK(
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
25 [#include <ncurses.h>],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
26 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
27 mp_cv_ncurses=yes, mp_cv_ncurses=no)])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
28 if test "$mp_cv_ncurses" = yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
29 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
30 AC_DEFINE(HAVE_NCURSES_H, 1, [Define to 1 if libncurses is requested])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
31 CURSES_LIB="-lncurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
32 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
33 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
34 if test ! "$CURSES_LIB"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
35 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
36 AC_CACHE_CHECK([for working pdcurses], mp_cv_pdcurses,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
37 [LIBS="$mp_save_LIBS -lpdcurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
38 AC_TRY_LINK(
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
39 [#include <curses.h>],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
40 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
41 mp_cv_pdcurses=yes, mp_cv_pdcurses=no)])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
42 if test "$mp_cv_pdcurses" = yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
43 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
44 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
45 CURSES_LIB="-lpdcurses"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
46 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
47 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
48 if test ! "$CURSES_LIB"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
49 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
50 AC_CACHE_CHECK([for working pdcur], mp_cv_pdcur,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
51 [LIBS="$mp_save_LIBS -lpdcur"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
52 AC_TRY_LINK(
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
53 [#include <curses.h>],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
54 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
55 mp_cv_pdcur=yes, mp_cv_pdcur=no)])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
56 if test "$mp_cv_pdcur" = yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
57 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
58 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
59 CURSES_LIB="-lpdcur"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
60 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
61 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
62 if test ! "$CURSES_LIB"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
63 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
64 AC_CACHE_CHECK([for working peer pdcurses], mp_cv_lpdcurses,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
65 [LIBS="$mp_save_LIBS ../pdcurses/pdcurses.a"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
66 AC_TRY_LINK(
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
67 [#include "../pdcurses/curses.h"],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
68 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
69 mp_cv_lpdcurses=yes, mp_cv_lpdcurses=no)])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
70 if test "$mp_cv_lpdcurses" = yes
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
71 then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
72 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
73 CURSES_LIB="../pdcurses/pdcurses.a"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
74 RF_ADDTO(CPPFLAGS,"-I../pdcurses")
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
75 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
76 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
77 AC_CACHE_CHECK([for ESCDELAY variable],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
78 [mc_cv_ncurses_escdelay],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
79 [AC_TRY_LINK([], [
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
80 extern int ESCDELAY;
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
81 ESCDELAY = 0;
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
82 ],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
83 [mc_cv_ncurses_escdelay=yes],
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
84 [mc_cv_ncurses_escdelay=no])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
85 ])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
86 if test "$mc_cv_ncurses_escdelay" = yes; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
87 AC_DEFINE(HAVE_ESCDELAY, 1,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
88 [Define if ncurses has ESCDELAY variable])
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
89 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
90 if test ! "$CURSES_LIB" ; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
91 LIBS="$mp_save_LIBS"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
92 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
93 ])dnl
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
94
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
95 dnl
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
96 dnl RF_ADDTO(variable, value)
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
97 dnl
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
98 dnl Add value to variable
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
99 dnl
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
100 AC_DEFUN([RF_ADDTO],[
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
101 if test "x$$1" = "x"; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
102 test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
103 $1="$2"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
104 else
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
105 apr_addto_bugger="$2"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
106 for i in $apr_addto_bugger; do
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
107 apr_addto_duplicate="0"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
108 for j in $$1; do
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
109 if test "x$i" = "x$j"; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
110 apr_addto_duplicate="1"