tCurrency can now be configured with Currency.Symbol and Currency.Prefix; Windows client windows cannot now be made unreadably small; bank/loan shark dialog now warns on entering negative prices; default configuration is restored properly at the start of each game - vaccinewars - be a doctor and try to vaccinate the world (HTM) git clone git://src.adamsgaard.dk/vaccinewars (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 61edd1ea12d1bcde6aec9bd8033db8bf527e542a (DIR) parent 1d4fe829cbae531259381286d3166e18d070d05d (HTM) Author: Ben Webb <ben@salilab.org> Date: Mon, 29 Oct 2001 22:47:12 +0000 Currency can now be configured with Currency.Symbol and Currency.Prefix; Windows client windows cannot now be made unreadably small; bank/loan shark dialog now warns on entering negative prices; default configuration is restored properly at the start of each game Diffstat: M ChangeLog | 4 ++++ M TODO | 3 --- M acconfig.h | 7 ------- M configure | 238 ++++++++++++++++--------------- M configure.in | 11 +++++++---- M doc/Makefile.in | 12 +++++++----- M doc/configfile.html | 19 ++++++++++++++++--- M doc/protocol.html | 13 +++++++++---- M po/Makefile.in.in | 182 +++++++++++-------------------- M src/Makefile.in | 12 +++++++----- M src/curses_client.c | 2 ++ M src/dopewars.c | 124 +++++++++++++++++++++++++++---- M src/dopewars.h | 17 +++++++++++++++-- M src/gtk_client.c | 90 ++++++++++++++++++------------- M src/gtkport.c | 40 +++++++++++++++++++++++++++++-- M src/gtkport.h | 5 +++++ M src/message.c | 119 +++++++++++++++++-------------- M src/winmain.c | 4 +++- 18 files changed, 524 insertions(+), 378 deletions(-) --- (DIR) diff --git a/ChangeLog b/ChangeLog t@@ -1,4 +1,8 @@ cvs + - Currency can now be configured with Currency.Symbol and Currency.Prefix + - Windows client windows cannot now be made unreadably small + - Bank/loan shark dialog now warns on entering negative prices + - Default configuration is restored properly at the start of each game - Translations should now work with the Windows client - Documentation on the client-server protocol added - Windows graphical server can be minimized to the System Tray (DIR) diff --git a/TODO b/TODO t@@ -1,9 +1,6 @@ -- Implement allow_shrink window attribute for Windows client - Make server run as an NT Service -- Restore default configuration properly at the start of each game - Configuration file editor thingy in the client? - Make minimize-to-systray code a) more robust and b) configurable -- Have bank/loan shark dialog warn on entering negative prices - GSS_API SOCKS support? - Fix problem with dialogs popping up while menus are open - Increase difficulty of escaping from another player - impose penalty on (DIR) diff --git a/acconfig.h b/acconfig.h t@@ -23,10 +23,3 @@ /* Do we have GTK+ with a non-buggy gtk_entry_set_visibility() ? (i.e. >= 1.2.10) */ #undef HAVE_FIXED_GTK - -#undef ENABLE_NLS -#undef HAVE_CATGETS -#undef HAVE_GETTEXT -#undef HAVE_LC_MESSAGES -#undef HAVE_STPCPY - (DIR) diff --git a/configure b/configure t@@ -1571,10 +1571,10 @@ EOF - CFLAGS="$CFLAGS -mwindows -fnative-struct -mno-cygwin" + CFLAGS="$CFLAGS -mwindows -fnative-struct" + CPPFLAGS="$CPPFLAGS -mno-cygwin" LIBS="$LIBS -lwsock32 -lcomctl32 -lmpr" - - LDFLAGS="$LDFLAGS -lglib-1.3" + LDFLAGS="$LDFLAGS -mno-cygwin -lglib-1.3" WNDRES="dopewars.res" t@@ -2801,7 +2801,7 @@ EOF fi -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 t@@ -2933,11 +2933,24 @@ else #include <fcntl.h> #include <sys/mman.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#if HAVE_STDLIB_H +# include <stdlib.h> +#endif + +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif + +#if HAVE_UNISTD_H +# include <unistd.h> +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H t@@ -3045,7 +3058,7 @@ main() } EOF -if { (eval echo configure:3049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else t@@ -3069,12 +3082,12 @@ fi echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 -echo "configure:3073: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo "configure:3086: checking whether we are using the GNU C Library 2.1 or newer" >&5 if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3078 "configure" +#line 3091 "configure" #include "confdefs.h" #include <features.h> t@@ -3110,17 +3123,17 @@ stdlib.h string.h unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3114: checking for $ac_hdr" >&5 +echo "configure:3127: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3119 "configure" +#line 3132 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* t@@ -3151,12 +3164,12 @@ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ strdup strtoul tsearch __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3155: checking for $ac_func" >&5 +echo "configure:3168: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3160 "configure" +#line 3173 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -3179,7 +3192,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else t@@ -3219,7 +3232,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:3223: checking for iconv" >&5 +echo "configure:3236: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3227,7 +3240,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 3231 "configure" +#line 3244 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> t@@ -3237,7 +3250,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:3241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else t@@ -3249,7 +3262,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext <<EOF -#line 3253 "configure" +#line 3266 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> t@@ -3259,7 +3272,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:3263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes t@@ -3280,13 +3293,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:3284: checking for iconv declaration" >&5 +echo "configure:3297: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3290 "configure" +#line 3303 "configure" #include "confdefs.h" #include <stdlib.h> t@@ -3305,7 +3318,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else t@@ -3334,19 +3347,19 @@ EOF echo $ac_n "checking for nl_langinfo and CODESET""... $ac_c" 1>&6 -echo "configure:3338: checking for nl_langinfo and CODESET" >&5 +echo "configure:3351: checking for nl_langinfo and CODESET" >&5 if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3343 "configure" +#line 3356 "configure" #include "confdefs.h" #include <langinfo.h> int main() { char* cs = nl_langinfo(CODESET); ; return 0; } EOF -if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_langinfo_codeset=yes else t@@ -3369,19 +3382,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3373: checking for LC_MESSAGES" >&5 +echo "configure:3386: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3378 "configure" +#line 3391 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else t@@ -3402,7 +3415,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3406: checking whether NLS is requested" >&5 +echo "configure:3419: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" t@@ -3424,7 +3437,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3428: checking whether included gettext is requested" >&5 +echo "configure:3441: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" t@@ -3444,17 +3457,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3448: checking for libintl.h" >&5 +echo "configure:3461: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3453 "configure" +#line 3466 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* t@@ -3471,12 +3484,12 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 -echo "configure:3475: checking for GNU gettext in libc" >&5 +echo "configure:3488: checking for GNU gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3480 "configure" +#line 3493 "configure" #include "confdefs.h" #include <libintl.h> extern int _nl_msg_cat_cntr; t@@ -3485,7 +3498,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:3489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libc=yes else t@@ -3501,14 +3514,14 @@ echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6 if test "$gt_cv_func_gnugettext1_libc" != "yes"; then echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 -echo "configure:3505: checking for GNU gettext in libintl" >&5 +echo "configure:3518: checking for GNU gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -lintl $LIBICONV" cat > conftest.$ac_ext <<EOF -#line 3512 "configure" +#line 3525 "configure" #include "confdefs.h" #include <libintl.h> extern int _nl_msg_cat_cntr; t@@ -3517,7 +3530,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:3521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libintl=yes else t@@ -3550,12 +3563,12 @@ EOF for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3554: checking for $ac_func" >&5 +echo "configure:3567: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3559 "configure" +#line 3572 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -3578,7 +3591,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else t@@ -3604,10 +3617,10 @@ done LIBS="$gt_save_LIBS" - # Extract the first word of "msgfmt", so it can be a program name with args. + # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3611: checking for $ac_word" >&5 +echo "configure:3624: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3620,28 +3633,28 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then +if test -n "$MSGFMT"; then echo "$ac_t""$MSGFMT" 1>&6 else echo "$ac_t""no" 1>&6 fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. + if test "$MSGFMT" != "no"; then + # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3645: checking for $ac_word" >&5 +echo "configure:3658: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3674,11 +3687,12 @@ else echo "$ac_t""no" 1>&6 fi + fi - # Extract the first word of "xgettext", so it can be a program name with args. + # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3682: checking for $ac_word" >&5 +echo "configure:3696: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3691,7 +3705,7 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi t@@ -3703,7 +3717,7 @@ else esac fi XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then +if test -n "$XGETTEXT"; then echo "$ac_t""$XGETTEXT" 1>&6 else echo "$ac_t""no" 1>&6 t@@ -3728,7 +3742,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3732: checking for $ac_word" >&5 +echo "configure:3746: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3741,19 +3755,19 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then +if test -n "$MSGFMT"; then echo "$ac_t""$MSGFMT" 1>&6 else echo "$ac_t""no" 1>&6 t@@ -3762,7 +3776,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3766: checking for $ac_word" >&5 +echo "configure:3780: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3798,7 +3812,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3802: checking for $ac_word" >&5 +echo "configure:3816: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3811,7 +3825,7 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi t@@ -3823,7 +3837,7 @@ else esac fi XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then +if test -n "$XGETTEXT"; then echo "$ac_t""$XGETTEXT" 1>&6 else echo "$ac_t""no" 1>&6 t@@ -3837,17 +3851,8 @@ fi LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - echo "$ac_t""found msgfmt program is not GNU msgfmt; ignore it" 1>&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 t@@ -3869,7 +3874,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3873: checking for $ac_word" >&5 +echo "configure:3878: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -3902,8 +3907,8 @@ done ac_verc_fail=yes else echo $ac_n "checking version of bison""... $ac_c" 1>&6 -echo "configure:3906: checking version of bison" >&5 - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` +echo "configure:3911: checking version of bison" >&5 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) t@@ -3949,7 +3954,7 @@ echo "configure:3906: checking version of bison" >&5 LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:3953: checking for catalogs to be installed" >&5 +echo "configure:3958: checking for catalogs to be installed" >&5 NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no t@@ -4038,7 +4043,7 @@ if test "$GUI_CLIENT" = "yes" -o "$GUI_SERVER" = "yes" ; then fi echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4042: checking size of long long" >&5 +echo "configure:4047: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4046,18 +4051,18 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4050 "configure" +#line 4055 "configure" #include "confdefs.h" #include <stdio.h> -main() +int main() { FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); + if (!f) return(1); fprintf(f, "%d\n", sizeof(long long)); - exit(0); + return(0); } EOF -if { (eval echo configure:4061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else t@@ -4078,7 +4083,7 @@ EOF echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:4082: checking for 8-bit clean memcmp" >&5 +echo "configure:4087: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4086,7 +4091,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 4090 "configure" +#line 4095 "configure" #include "confdefs.h" main() t@@ -4096,7 +4101,7 @@ main() } EOF -if { (eval echo configure:4100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else t@@ -4114,7 +4119,7 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:4118: checking whether setvbuf arguments are reversed" >&5 +echo "configure:4123: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4122,7 +4127,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4126 "configure" +#line 4131 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ t@@ -4136,7 +4141,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:4140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else t@@ -4160,12 +4165,12 @@ EOF fi echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:4164: checking for strftime" >&5 +echo "configure:4169: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4169 "configure" +#line 4174 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strftime(); below. */ t@@ -4188,7 +4193,7 @@ strftime(); ; return 0; } EOF -if { (eval echo configure:4192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else t@@ -4210,7 +4215,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:4214: checking for strftime in -lintl" >&5 +echo "configure:4219: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 t@@ -4218,7 +4223,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4222 "configure" +#line 4227 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 t@@ -4229,7 +4234,7 @@ int main() { strftime() ; return 0; } EOF -if { (eval echo configure:4233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else t@@ -4258,12 +4263,12 @@ fi for ac_func in strdup strstr getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4262: checking for $ac_func" >&5 +echo "configure:4267: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4267 "configure" +#line 4272 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -4286,7 +4291,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else t@@ -4317,14 +4322,14 @@ if test "$CYGWIN" = "yes" ; then else echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 -echo "configure:4321: checking for library containing socket" >&5 +echo "configure:4326: checking for library containing socket" >&5 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socket="no" cat > conftest.$ac_ext <<EOF -#line 4328 "configure" +#line 4333 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 t@@ -4335,7 +4340,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:4339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="none required" else t@@ -4346,7 +4351,7 @@ rm -f conftest* test "$ac_cv_search_socket" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4350 "configure" +#line 4355 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 t@@ -4357,7 +4362,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:4361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="-l$i" break t@@ -4379,14 +4384,14 @@ else : fi echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 -echo "configure:4383: checking for library containing gethostbyname" >&5 +echo "configure:4388: checking for library containing gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <<EOF -#line 4390 "configure" +#line 4395 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 t@@ -4397,7 +4402,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:4401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="none required" else t@@ -4408,7 +4413,7 @@ rm -f conftest* test "$ac_cv_search_gethostbyname" = "no" && for i in nsl socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4412 "configure" +#line 4417 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 t@@ -4419,7 +4424,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="-l$i" break t@@ -4442,12 +4447,12 @@ fi for ac_func in socket gethostbyname select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4446: checking for $ac_func" >&5 +echo "configure:4451: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4451 "configure" +#line 4456 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -4470,7 +4475,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else t@@ -4954,9 +4959,6 @@ for ac_file in $CONFIG_FILES; do ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; t@@ -4964,9 +4966,9 @@ for ac_file in $CONFIG_FILES; do esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + echo creating "$ac_dir/POTFILES" sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + echo creating "$ac_dir/Makefile" sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" fi ;; (DIR) diff --git a/configure.in b/configure.in t@@ -48,11 +48,14 @@ if test "$CYGWIN" = "yes" ; then dnl even when glib-1.3.dll is - so we assume GLib is in place; the worst dnl that can happen is that "make" fails later on. - CFLAGS="$CFLAGS -mwindows -fnative-struct -mno-cygwin" + dnl Libraries and flags + dnl N.B. -mno-cygwin is included in CPPFLAGS so the right headers + dnl are detected (in /usr/include/mingw/ rather than /usr/include) + dnl later on - e.g. sys/param.h isn't in mingw. + CFLAGS="$CFLAGS -mwindows -fnative-struct" + CPPFLAGS="$CPPFLAGS -mno-cygwin" LIBS="$LIBS -lwsock32 -lcomctl32 -lmpr" - - dnl Glib stuff - LDFLAGS="$LDFLAGS -lglib-1.3" + LDFLAGS="$LDFLAGS -mno-cygwin -lglib-1.3" dnl We need to compile and then link in the Windows resources WNDRES="dopewars.res" (DIR) diff --git a/doc/Makefile.in b/doc/Makefile.in t@@ -57,11 +57,15 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ DATADIRNAME = @DATADIRNAME@ GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ t@@ -72,13 +76,12 @@ GTKPORT_O = @GTKPORT_O@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ +INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIBICONV = @LIBICONV@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ t@@ -90,7 +93,6 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WNDRES = @WNDRES@ -l = @l@ localedir = @localedir@ DOCPATH = ${DESTDIR}${datadir}/doc/${PACKAGE}-${VERSION}/ (DIR) diff --git a/doc/configfile.html b/doc/configfile.html t@@ -427,12 +427,25 @@ against a player.</dd> <h2><a name="advanced">Advanced configuration</a></h2> <dl> -<dt><b>LogLevel=<i>2</i></b></dt> +<dt><b>Currrency.Symbol=<i>$</i></b></dt> +<dd>Uses the dollar (<i>$</i>) symbol to display all prices of drugs, guns, +etc.</dd> + +<dt><b>Currrency.Prefix=<i>TRUE</i></b></dt> +<dd>Prints Currency.Symbol in front of any price - e.g. "$1,000"; if +FALSE, prints it after the price - e.g. "1,000 $".</dd> + +<dt><b>Log.File=<i>dopewars.log</i></b></dt> +<dd>By default, server log messages are printed to the screen (standard +output). By setting this variable, they will instead be written to the file +<i>dopewars.log</i>.</dd> + +<dt><b>Log.Level=<i>2</i></b></dt> <dd>Most server log messages are given a priority level, from 0 (most urgent) to 5 (most verbose). This setting instructs the server only to log messages from level 0 up to <i>2</i>, inclusive.</dd> -<dt><b>LogTimestamp=<i>"[%H:%M:%S] "</i></b></dt> +<dt><b>Log.Timestamp=<i>"[%H:%M:%S] "</i></b></dt> <dd>Prefixes all log messages with a timestamp of the form (e.g.) <i>[16:34:49]</i>. This is a string which is passed as input to the <tt>strftime(3)</tt> function. If this is set to a blank string, then no t@@ -584,6 +597,6 @@ any drugs, and clients will display this information if available.</dd> <ul> <li><a href="index.html">Main index</a></li> </ul> -<p>Last update: <b>16-10-2001</b></p> +<p>Last update: <b>28-10-2001</b></p> </body> </html> (DIR) diff --git a/doc/protocol.html b/doc/protocol.html t@@ -73,7 +73,9 @@ terminated by the message terminator, \n - it may also be terminated by a ^ character. This allows the client to ignore extra fields, if later versions of the protocol should add them. (N.B. This does not apply to free-form text fields, as in the C_QUESTION, C_PRINTMESSAGE, C_MSG, C_MSGTO, and C_FIGHTPRINT -messages, which _do_ extend to the end of the message.)</p> +messages, which _do_ extend to the end of the message.) Note also that older +servers may not send all the fields, so if fewer fields than expected are +received, the client should substitute default values.</p> <p>Message codes are shown below, together with the symbolic constants used in the dopewars code for clarity (e.g. the 'A' code is represented by t@@ -287,7 +289,7 @@ e.g. "1^AbFred"<br /> <dt><b>C_INIT</b> ('<tt>k</tt>')</dt> <dd>Tells the client about various global game settings<br /> -<tt>data</tt> = <tt>"version"^<numloc>^<numgun>^<numdrug>^"bitch"^"bitches"^"gun"^"guns"^"drug"^"drugs"^"month"^"year"^<ID>^"loanshark"^"bank"^"gunshop"^"pub"</tt><br /> +<tt>data</tt> = <tt>"version"^<numloc>^<numgun>^<numdrug>^"bitch"^"bitches"^"gun"^"guns"^"drug"^"drugs"^"month"^"year"^<ID>^"loanshark"^"bank"^"gunshop"^"pub"^(prefix)"currency"</tt><br /> <tt>version</tt> = dopewars version of the server - e.g. "1.5.2"<br /> <tt>numloc</tt> = the number of locations in the game<br /> <tt>numgun</tt> = the number of guns in the game<br /> t@@ -297,7 +299,10 @@ e.g. "1^AbFred"<br /> <tt>bank</tt>, <tt>gunshop</tt>, <tt>pub</tt> = various names used in the game<br /> <tt>ID</tt> = the ID that the client should use to refer to itself<br /> -e.g. "^Ak1.5.2^8^4^12^bitch^bitches^gun^guns^drug^drugs^12-^-1984^0^the Loan Shark^the Bank^Dan's House of Guns^the pub"<br /> +<tt>prefix</tt> = '1' if the currency symbol (e.g. $) should be printed before +prices in the game, '0' otherwise<br /> +<tt>currency</tt> = the currency symbol to use<br /> +e.g. "^Ak1.5.2^8^4^12^bitch^bitches^gun^guns^drug^drugs^12-^-1984^0^the Loan Shark^the Bank^Dan's House of Guns^the pub"^1$<br /> <b>Answer required:</b> no<p /></dd> <dt><b>C_DATA</b> ('<tt>l</tt>')</dt> t@@ -553,7 +558,7 @@ e.g.<br /> </ul> </li> </ul> -<p>Last update: <b>25-10-2001</b></p> +<p>Last update: <b>29-10-2001</b></p> </body> </html> (DIR) diff --git a/po/Makefile.in.in b/po/Makefile.in.in t@@ -1,5 +1,5 @@ # Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> +# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu> # # This file file be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License t@@ -9,6 +9,10 @@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + SHELL = /bin/sh @SET_MAKE@ t@@ -18,22 +22,20 @@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ -datadir = $(prefix)/@DATADIRNAME@ +datadir = @datadir@ localedir = $(datadir)/locale -gnulocaledir = $(prefix)/share/locale -gettextsrcdir = $(prefix)/share/gettext/po -subdir = po +gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` CC = @CC@ -GENCAT = @GENCAT@ -GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ +GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ -XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ -MSGMERGE = PATH=../src:$$PATH msgmerge +XGETTEXT = @XGETTEXT@ +MSGMERGE = msgmerge DEFS = @DEFS@ CFLAGS = @CFLAGS@ t@@ -43,20 +45,17 @@ INCLUDES = -I.. -I$(top_srcdir)/intl COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) -SOURCES = cat-id-tbl.c POFILES = @POFILES@ GMOFILES = @GMOFILES@ DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ -stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) +$(POFILES) $(GMOFILES) POTFILES = \ CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -INSTOBJEXT = @INSTOBJEXT@ .SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat +.SUFFIXES: .c .o .po .pox .gmo .mo .c.o: $(COMPILE) $< t@@ -70,19 +69,19 @@ INSTOBJEXT = @INSTOBJEXT@ .po.gmo: file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) -o $$file $< - -.po.cat: - sed -f ../intl/po2msg.sed < $< > $*.msg \ - && rm -f $@ && $(GENCAT) $@ $*.msg + && rm -f $$file && $(GMSGFMT) --statistics -o $$file $< all: all-@USE_NLS@ -all-yes: cat-id-tbl.c $(CATALOGS) +all-yes: $(CATALOGS) all-no: -$(srcdir)/$(PACKAGE).pot: $(POTFILES) +# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ --add-comments --keyword=_ --keyword=N_ \ --files-from=$(srcdir)/POTFILES.in \ t@@ -90,78 +89,35 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES) || ( rm -f $(srcdir)/$(PACKAGE).pot \ && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) -$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: -$(srcdir)/stamp-cat-id: $(PACKAGE).pot - rm -f cat-id-tbl.tmp - sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ - | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp - if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ - rm cat-id-tbl.tmp; \ - else \ - echo cat-id-tbl.c changed; \ - rm -f $(srcdir)/cat-id-tbl.c; \ - mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ - fi - cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id - install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ -install-data-no: all -install-data-yes: all - if test -r "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $(datadir); \ + if test "$(PACKAGE)" = "gettext"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \ + : ; \ fi +install-data-no: all +install-data-yes: all + $(mkinstalldirs) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ - case "$$cat" in \ - *.gmo) destdir=$(gnulocaledir);; \ - *) destdir=$(localedir);; \ - esac; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - dir=$$destdir/$$lang/LC_MESSAGES; \ - if test -r "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $$dir; \ - else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ - fi; \ + lang=`echo $$cat | sed 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkinstalldirs) $(DESTDIR)$$dir; \ if test -r $$cat; then \ - $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ - echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ + echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \ else \ - $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \ echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ - fi; \ - if test -r $$cat.m; then \ - $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - if test -r $(srcdir)/$$cat.m ; then \ - $(INSTALL_DATA) $(srcdir)/$$cat.m \ - $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - true; \ - fi; \ + "$(DESTDIR)$$dir/$(PACKAGE).mo"; \ fi; \ done - if test "$(PACKAGE)" = "gettext"; then \ - if test -r "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $(gettextsrcdir); \ - else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ - fi; \ - $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(gettextsrcdir)/Makefile.in.in; \ - else \ - : ; \ - fi # Define this as empty until I found a useful application. installcheck: t@@ -170,76 +126,68 @@ uninstall: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + lang=`echo $$cat | sed 's/\.gmo$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ done - rm -f $(gettextsrcdir)/po-Makefile.in.in + if test "$(PACKAGE)" = "gettext"; then \ + rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi check: all -cat-id-tbl.o: ../intl/libgettext.h - dvi info tags TAGS ID: mostlyclean: - rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp + rm -f core core.* *.pox $(PACKAGE).po *.new.po rm -fr *.o clean: mostlyclean distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + rm -f Makefile Makefile.in POTFILES *.mo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f $(GMOFILES) -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: update-po $(DISTFILES) +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: $(DISTFILES) dists="$(DISTFILES)"; \ for file in $$dists; do \ - ln $(srcdir)/$$file $(distdir) 2> /dev/null \ - || cp -p $(srcdir)/$$file $(distdir); \ + if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ + cp -p $$dir/$$file $(distdir); \ done update-po: Makefile $(MAKE) $(PACKAGE).pot - PATH=`pwd`/../src:$$PATH; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ cd $(srcdir); \ - catalogs='$(CATALOGS)'; \ + catalogs='$(GMOFILES)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - mv $$lang.po $$lang.old.po; \ + lang=`echo $$cat | sed 's/\.gmo$$//'`; \ echo "$$lang:"; \ - if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ - rm -f $$lang.old.po; \ + if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \ + mv -f $$lang.new.po $$lang.po; \ else \ echo "msgmerge for $$cat failed!"; \ - rm -f $$lang.po; \ - mv $$lang.old.po $$lang.po; \ + rm -f $$lang.new.po; \ fi; \ done + $(MAKE) update-gmo -POTFILES: POTFILES.in - ( if test 'x$(srcdir)' != 'x.'; then \ - posrcprefix='$(top_srcdir)/'; \ - else \ - posrcprefix="../"; \ - fi; \ - rm -f $@-t $@ \ - && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ - -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ - | sed -e '$$s/\\$$//') > $@-t \ - && chmod a-w $@-t \ - && mv $@-t $@ ) - -Makefile: Makefile.in.in ../config.status POTFILES - cd .. \ +update-gmo: Makefile $(GMOFILES) + @: + +Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in + cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ $(SHELL) ./config.status (DIR) diff --git a/src/Makefile.in b/src/Makefile.in t@@ -57,11 +57,15 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ DATADIRNAME = @DATADIRNAME@ GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ t@@ -72,13 +76,12 @@ GTKPORT_O = @GTKPORT_O@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ +INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIBICONV = @LIBICONV@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ t@@ -90,7 +93,6 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WNDRES = @WNDRES@ -l = @l@ localedir = @localedir@ bin_PROGRAMS = dopewars (DIR) diff --git a/src/curses_client.c b/src/curses_client.c t@@ -1400,6 +1400,7 @@ void print_status(Player *Play,gboolean DispDrug) { text=g_string_new(NULL); attrset(TitleAttr); + clear_line(0); g_string_sprintf(text,"%s%02d%s",Names.Month,Play->Turn,Names.Year); mvaddstr(0,3,text->str); t@@ -2048,6 +2049,7 @@ void CursesLoop(void) { Curses_DoGame(Play); ShutdownNetwork(Play); CleanUpServer(); + RestoreConfig(); attrset(TextAttr); mvaddstr(23,20,_("Play again? ")); c=GetKey(_("YN"),"YN",TRUE,TRUE,FALSE); (DIR) diff --git a/src/dopewars.c b/src/dopewars.c t@@ -65,9 +65,10 @@ gboolean Network,Client,Server,NotifyMetaServer,AIPlayer; dopewars in single-player or antique mode: Network=Server=Client=FALSE */ +FILE *logfp; unsigned Port=7902; gboolean Sanitized,ConfigVerbose,DrugValue; -char *HiScoreFile=NULL,*ServerName=NULL,*Pager=NULL,*ConvertFile=NULL; +gchar *HiScoreFile=NULL,*ServerName=NULL,*Pager=NULL,*ConvertFile=NULL; gboolean WantHelp,WantVersion,WantAntique,WantColour,WantNetwork,WantConvert; ClientType WantedClient; int NumLocation=0,NumGun=0,NumCop=0,NumDrug=0,NumSubway=0, t@@ -150,6 +151,8 @@ struct NAMES DefaultNames = { N_("Dan\'s House of Guns"),N_("the pub") }; +struct CURRENCY Currency; + struct PRICES Prices = { 20000,10000 }; t@@ -175,8 +178,7 @@ int NumTurns=31; int PlayerArmour=100,BitchArmour=50; -int LogLevel=2; -gchar *LogTimestamp=NULL; +struct LOG Log; struct GLOBALS Globals[] = { /* The following strings are the helptexts for all the options that can be t@@ -263,10 +265,19 @@ struct GLOBALS Globals[] = { { &NumTurns,NULL,NULL,NULL,NULL,"NumTurns", N_("No. of game turns (if 0, game never ends)"), NULL,NULL,0,"",NULL,NULL }, - { &LogLevel,NULL,NULL,NULL,NULL,"LogLevel", + { NULL,NULL,NULL,&Currency.Symbol,NULL,"Currency.Symbol", + N_("The currency symbol (e.g. $)"), + NULL,NULL,0,"",NULL,NULL }, + { NULL,&Currency.Prefix,NULL,NULL,NULL,"Currency.Prefix", + N_("If TRUE, the currency symbol precedes prices"), + NULL,NULL,0,"",NULL,NULL }, + { NULL,NULL,NULL,&Log.File,NULL,"Log.File", + N_("File to write log messages to"), + NULL,NULL,0,"",NULL,NULL }, + { &Log.Level,NULL,NULL,NULL,NULL,"Log.Level", N_("Controls the number of log messages produced"), NULL,NULL,0,"",NULL,NULL }, - { NULL,NULL,NULL,&LogTimestamp,NULL,"LogTimestamp", + { NULL,NULL,NULL,&Log.Timestamp,NULL,"Log.Timestamp", N_("strftime() format string for log timestamps"), NULL,NULL,0,"",NULL,NULL }, { NULL,&Sanitized,NULL,NULL,NULL,"Sanitized", t@@ -863,7 +874,9 @@ gchar *FormatPrice(price_t price) { g_string_prepend(PriceStr,thou); First=FALSE; } - g_string_prepend_c(PriceStr,'$'); + if (Currency.Prefix) g_string_prepend(PriceStr,Currency.Symbol); + else g_string_append(PriceStr,Currency.Symbol); + NewBuffer=PriceStr->str; /* Free the string structure only, not the char data */ g_string_free(PriceStr,FALSE); t@@ -1336,6 +1349,63 @@ void CopyDrugs(struct DRUGS *dest,struct DRUGS *src) { dest->ExpensiveMultiply=src->ExpensiveMultiply; } +static struct PRICES BackupPrices; +static struct NAMES BackupNames; +static struct DRUG *BackupDrug=NULL; +static struct GUN *BackupGun=NULL; +static struct LOCATION *BackupLocation=NULL; +static struct CURRENCY BackupCurrency = { NULL,TRUE }; +static gint NumBackupDrug=0,NumBackupGun=0,NumBackupLocation=0; + +void BackupConfig(void) { + gint i; + BackupPrices.Spy = Prices.Spy; + BackupPrices.Tipoff = Prices.Tipoff; + AssignName(&BackupCurrency.Symbol,Currency.Symbol); + BackupCurrency.Prefix = Currency.Prefix; + CopyNames(&BackupNames,&Names); + +/* Free existing backups of guns, drugs, and locations */ + for (i=0;i<NumBackupGun;i++) g_free(BackupGun[i].Name); + g_free(BackupGun); + for (i=0;i<NumBackupDrug;i++) { + g_free(BackupDrug[i].Name); + g_free(BackupDrug[i].CheapStr); + } + g_free(BackupDrug); + for (i=0;i<NumBackupLocation;i++) g_free(BackupLocation[i].Name); + g_free(BackupLocation); + + NumBackupGun = NumGun; + BackupGun = g_new0(struct GUN,NumGun); + for (i=0;i<NumGun;i++) CopyGun(&BackupGun[i],&Gun[i]); + + NumBackupDrug = NumDrug; + BackupDrug = g_new0(struct DRUG,NumDrug); + for (i=0;i<NumDrug;i++) CopyDrug(&BackupDrug[i],&Drug[i]); + + NumBackupLocation = NumLocation; + BackupLocation = g_new0(struct LOCATION,NumLocation); + for (i=0;i<NumLocation;i++) CopyLocation(&BackupLocation[i],&Location[i]); +} + +void RestoreConfig(void) { + gint i; + + Prices.Spy = BackupPrices.Spy; + Prices.Tipoff = BackupPrices.Tipoff; + CopyNames(&Names,&BackupNames); + AssignName(&Currency.Symbol,BackupCurrency.Symbol); + Currency.Prefix = BackupCurrency.Prefix; + + ResizeGuns(NumBackupGun); + for (i=0;i<NumGun;i++) CopyGun(&Gun[i],&BackupGun[i]); + ResizeDrugs(NumBackupDrug); + for (i=0;i<NumDrug;i++) CopyDrug(&Drug[i],&BackupDrug[i]); + ResizeLocations(NumBackupLocation); + for (i=0;i<NumLocation;i++) CopyLocation(&Location[i],&BackupLocation[i]); +} + void ScannerErrorHandler(GScanner *scanner,gchar *msg,gint error) { g_print("%s\n",msg); } t@@ -1730,13 +1800,18 @@ void SetupParameters() { WantedClient=CLIENT_AUTO; Server=AIPlayer=Client=Network=FALSE; + Log.Level=2; + Log.Timestamp=g_strdup("[%H:%M:%S] "); + Log.File=NULL; + + Currency.Symbol = g_strdup("$"); + Currency.Prefix = TRUE; + /* Set hard-coded default values */ g_free(HiScoreFile); g_free(ServerName); g_free(Pager); - g_free(LogTimestamp); HiScoreFile=g_strdup_printf("%s/dopewars.sco",DATADIR); ServerName=g_strdup("localhost"); Pager=g_strdup("more"); - LogTimestamp=g_strdup("[%H:%M:%S] "); CopyNames(&Names,&DefaultNames); CopyDrugs(&Drugs,&DefaultDrugs); t@@ -1790,6 +1865,10 @@ void SetupParameters() { systems only) */ ReadConfigFile("dopewars-config.txt"); #endif + +/* Save this configuration, so we can restore those elements that get + overwritten when we connect to a dopewars server */ + BackupConfig(); } void HandleHelpTexts() { t@@ -1820,7 +1899,8 @@ Drug dealing game based on \"Drug Wars\" by John E. Dell\n\ -g, --config-file=FILE specify the pathname of a dopewars configuration file.\n\ This file is read immediately when the -g option\n\ is encountered\n\ - -r, --pidfile=FILE maintain pid file \"file\" while running the server\n\ + -r, --pidfile=FILE maintain pid file \"FILE\" while running the server\n\ + -l, --logfile=FILE write log information to \"FILE\"\n\ -c, --ai-player create and run a computer player\n\ -w, --windowed-client force the use of a graphical (windowed)\n\ client (GTK+ or Win32)\n\ t@@ -1853,6 +1933,7 @@ Drug dealing game based on \"Drug Wars\" by John E. Dell\n\ -g file specify the pathname of a dopewars configuration file. This file\n\ is read immediately when the -g option is encountered\n\ -r file maintain pid file \"file\" while running the server\n\ + -l file write log information to \"file\"\n\ -c create and run a computer player\n\ -w force the use of a graphical (windowed) client (GTK+ or Win32)\n\ -t force the use of a text-mode client (curses)\n\ t@@ -1867,7 +1948,7 @@ Report bugs to the author at ben@bellatrix.pcl.ox.ac.uk\n"),DATADIR); void HandleCmdLine(int argc,char *argv[]) { int c; - static const gchar *options = "anbchvf:o:sSp:g:r:wtC:"; + static const gchar *options = "anbchvf:o:sSp:g:r:wtC:l:"; #ifdef HAVE_GETOPT_LONG static const struct option long_options[] = { { "no-color", no_argument, NULL, 'b' }, t@@ -1885,6 +1966,7 @@ void HandleCmdLine(int argc,char *argv[]) { { "windowed-client", no_argument, NULL, 'w' }, { "text-client", no_argument, NULL, 't' }, { "convert", required_argument, NULL, 'C' }, + { "logfile", required_argument, NULL, 'l' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, { 0, 0, 0, 0 } t@@ -1913,6 +1995,7 @@ void HandleCmdLine(int argc,char *argv[]) { case 'p': Port=atoi(optarg); break; case 'g': ReadConfigFile(optarg); break; case 'r': AssignName(&PidFile,optarg); break; + case 'l': AssignName(&Log.File,optarg); break; case 'w': WantedClient=CLIENT_WINDOW; break; case 't': WantedClient=CLIENT_CURSES; break; case 'C': AssignName(&ConvertFile,optarg); WantConvert=TRUE; break; t@@ -1940,16 +2023,16 @@ GString *GetLogString(GLogLevelFlags log_level,const gchar *message) { struct tm *timep; text=g_string_new(""); - if (LogTimestamp) { + if (Log.Timestamp) { tim=time(NULL); timep=localtime(&tim); - strftime(TimeBuf,80,LogTimestamp,timep); + strftime(TimeBuf,80,Log.Timestamp,timep); TimeBuf[79]='\0'; g_string_append(text,TimeBuf); } for (i=0;i<MAXLOG;i++) if (log_level&(1<<(G_LOG_LEVEL_USER_SHIFT+i))) { - if (i>LogLevel) { g_string_free(text,TRUE); return NULL; } + if (i>Log.Level) { g_string_free(text,TRUE); return NULL; } g_string_sprintfa(text,"%d: ",i); } g_string_append(text,message); t@@ -1964,7 +2047,8 @@ static void ServerLogMessage(const gchar *log_domain,GLogLevelFlags log_level, GString *text; text=GetLogString(log_level,message); if (text) { - g_print("%s\n",text->str); g_string_free(text,TRUE); + fprintf(logfp ? logfp : stdout,"%s\n",text->str); + g_string_free(text,TRUE); } } #endif t@@ -1993,8 +2077,17 @@ int main(int argc,char *argv[]) { GuiServerLoop(); #else /* Deal with dopelog() stuff nicely */ + logfp = fopen(Log.File,"a"); + if (logfp) { +#ifdef SETVBUF_REVERSED /* 2nd and 3rd arguments are reversed on some systems */ + setvbuf(logfp,_IOLBF,(char *)NULL,0); +#else + setvbuf(logfp,(char *)NULL,_IOLBF,0); +#endif + } g_log_set_handler(NULL,LogMask(),ServerLogMessage,NULL); - ServerLoop(); + /*if (fork()<=0)*/ ServerLoop(); + fclose(logfp); #endif /* GUI_SERVER */ #else g_print(_("This binary has been compiled without networking " t@@ -2020,6 +2113,7 @@ int main(int argc,char *argv[]) { } CloseHighScoreFile(); g_free(PidFile); + g_free(Log.File); g_free(ConvertFile); return 0; } (DIR) diff --git a/src/dopewars.h b/src/dopewars.h t@@ -90,6 +90,11 @@ struct METASERVER { }; #endif +struct CURRENCY { + gchar *Symbol; + gboolean Prefix; +}; + struct PRICES { price_t Spy,Tipoff; }; t@@ -136,6 +141,13 @@ typedef enum { PEYOTE, SHROOMS, SPEED, WEED } DrugIndex; +struct LOG { + gchar *File; + gint Level; + gchar *Timestamp; +}; + + extern int ClientSock,ListenSock; extern gboolean Network,Client,Server,NotifyMetaServer,AIPlayer; extern unsigned Port; t@@ -148,6 +160,7 @@ extern ClientType WantedClient; extern int LoanSharkLoc,BankLoc,GunShopLoc,RoughPubLoc; extern int DrugSortMethod,FightTimeout,IdleTimeout,ConnectTimeout; extern int MaxClients,AITurnPause; +extern struct CURRENCY Currency; extern struct PRICES Prices; extern struct BITCH Bitch; extern price_t StartCash,StartDebt; t@@ -161,8 +174,6 @@ extern gboolean UseSocks; extern int NumTurns; extern int PlayerArmour,BitchArmour; -extern int LogLevel; -extern gchar *LogTimestamp; #define MAXLOG 6 t@@ -311,6 +322,7 @@ extern char **SubwaySaying; extern char **StoppedTo; extern GSList *ServerList; extern GScannerConfig ScannerConfig; +extern struct LOG Log; GSList *RemovePlayer(Player *Play,GSList *First); Player *GetPlayerByID(guint ID,GSList *First); t@@ -380,4 +392,5 @@ gboolean IsCop(Player *Play); void dopelog(int loglevel,const gchar *format,...); GLogLevelFlags LogMask(void); GString *GetLogString(GLogLevelFlags log_level,const gchar *message); +void RestoreConfig(void); #endif (DIR) diff --git a/src/gtk_client.c b/src/gtk_client.c t@@ -439,7 +439,7 @@ void HandleClientMessage(char *pt,Player *Play) { "<main>/Errands/Sack Bitch..."); /* Text for the Errands/Sack Bitch menu item */ - text=dpg_strdup_printf(_("%/Sack Bitch menu item/S_ack %Tde"), + text=dpg_strdup_printf(_("%/Sack Bitch menu item/S_ack %Tde..."), Names.Bitch); SetAccelerator(MenuItem,text,NULL,NULL,NULL); g_free(text); t@@ -1626,6 +1626,7 @@ void EndGame(void) { ShutdownNetwork(ClientData.Play); UpdatePlayerLists(); CleanUpServer(); + RestoreConfig(); InGame=FALSE; UpdateMenus(); } t@@ -2495,41 +2496,50 @@ static void TransferPayAll(GtkWidget *widget,GtkWidget *dialog) { } static void TransferOK(GtkWidget *widget,GtkWidget *dialog) { - gpointer Debt; - GtkWidget *deposit,*entry; - gchar *text; - price_t money; + gpointer Debt; + GtkWidget *deposit,*entry; + gchar *text,*title; + price_t money; + gboolean withdraw=FALSE; + + Debt=gtk_object_get_data(GTK_OBJECT(dialog),"debt"); + entry=GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(dialog),"entry")); + text=gtk_editable_get_chars(GTK_EDITABLE(entry),0,-1); + money=strtoprice(text); + g_free(text); - Debt=gtk_object_get_data(GTK_OBJECT(dialog),"debt"); - entry=GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(dialog),"entry")); - text=gtk_editable_get_chars(GTK_EDITABLE(entry),0,-1); - money=strtoprice(text); - g_free(text); + if (Debt) { +/* Title of loan shark dialog - (%Tde="The Loan Shark" by default) */ + title = dpg_strdup_printf(_("%/LoanShark window title/%Tde"), + Names.LoanSharkName); + if (money>ClientData.Play->Debt) money=ClientData.Play->Debt; + } else { +/* Title of bank dialog - (%Tde="The Bank" by default) */ + title = dpg_strdup_printf(_("%/BankName window title/%Tde"), + Names.BankName); + deposit=GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(dialog),"deposit")); + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deposit))) { + withdraw=TRUE; + } + } - if (money<0) money=0; - if (Debt) { - if (money>ClientData.Play->Debt) money=ClientData.Play->Debt; - } else { - deposit=GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(dialog),"deposit")); - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deposit))) { - money=-money; - } - if (-money>ClientData.Play->Bank) { - GtkMessageBox(dialog,_("There isn't that much money available..."), - Names.BankName,MB_OK); - return; - } - } - if (money>ClientData.Play->Cash) { - GtkMessageBox(dialog,_("You don't have that much money!"), - Debt ? Names.LoanSharkName : Names.BankName,MB_OK); - return; - } - text=pricetostr(money); - SendClientMessage(ClientData.Play,C_NONE, - Debt ? C_PAYLOAN : C_DEPOSIT,NULL,text); - g_free(text); - gtk_widget_destroy(dialog); + if (money<0) { + GtkMessageBox(dialog,_("You must enter a positive amount of money!"), + title,MB_OK); + } else if (!Debt && withdraw && money>ClientData.Play->Bank) { + GtkMessageBox(dialog,_("There isn't that much money available..."), + title,MB_OK); + } else if (money>ClientData.Play->Cash) { + GtkMessageBox(dialog,_("You don't have that much money!"), + title,MB_OK); + } else { + text=pricetostr(withdraw ? -money : money); + SendClientMessage(ClientData.Play,C_NONE, + Debt ? C_PAYLOAN : C_DEPOSIT,NULL,text); + g_free(text); + gtk_widget_destroy(dialog); + } + g_free(title); } void TransferDialog(gboolean Debt) { t@@ -2593,14 +2603,20 @@ void TransferDialog(gboolean Debt) { radio=gtk_radio_button_new_with_label(group,_("Withdraw")); gtk_table_attach_defaults(GTK_TABLE(table),radio,0,1,3,4); } - label=gtk_label_new("$"); - gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,2,4); + label=gtk_label_new(Currency.Symbol); entry=gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(entry),"0"); gtk_object_set_data(GTK_OBJECT(dialog),"entry",entry); gtk_signal_connect(GTK_OBJECT(entry),"activate", GTK_SIGNAL_FUNC(TransferOK),dialog); - gtk_table_attach_defaults(GTK_TABLE(table),entry,2,3,2,4); + + if (Currency.Prefix) { + gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,2,4); + gtk_table_attach_defaults(GTK_TABLE(table),entry,2,3,2,4); + } else { + gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,2,4); + gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,2,4); + } gtk_box_pack_start(GTK_BOX(vbox),table,TRUE,TRUE,0); (DIR) diff --git a/src/gtkport.c b/src/gtkport.c t@@ -213,6 +213,8 @@ static void gtk_window_update_focus(GtkWindow *window); static void gtk_window_set_focus(GtkWindow *window); static void gtk_window_handle_user_size(GtkWindow *window, GtkAllocation *allocation); +static void gtk_window_handle_minmax_size(GtkWindow *window, + LPMINMAXINFO minmax); static void gtk_window_handle_auto_size(GtkWindow *window, GtkAllocation *allocation); static void gtk_window_set_initial_position(GtkWindow *window, t@@ -850,6 +852,14 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,UINT wParam,LONG lParam) { gtk_window_handle_user_size(GTK_WINDOW(window),&alloc); gtk_widget_set_size(window,&alloc); break; + case WM_GETMINMAXINFO: + widget=GTK_WIDGET(GetWindowLong(hwnd,GWL_USERDATA)); + if (widget) klass=GTK_OBJECT(widget)->klass; else klass=NULL; + if (klass==&GtkWindowClass) { + gtk_window_handle_minmax_size(GTK_WINDOW(widget), + (LPMINMAXINFO)lParam); + } + break; case WM_ACTIVATE: case WM_ACTIVATEAPP: widget=GTK_WIDGET(GetWindowLong(hwnd,GWL_USERDATA)); t@@ -1289,6 +1299,7 @@ GtkWidget *gtk_window_new(GtkWindowType type) { win->title=g_strdup(""); win->type=type; + win->allow_grow = TRUE; return GTK_WIDGET(win); } t@@ -1317,6 +1328,13 @@ void gtk_window_set_transient_for(GtkWindow *window,GtkWindow *parent) { } } +void gtk_window_set_policy(GtkWindow *window,gint allow_shrink, + gint allow_grow,gint auto_shrink) { + window->allow_shrink = allow_shrink; + window->allow_grow = allow_grow; + window->auto_shrink = auto_shrink; +} + void gtk_window_set_menu(GtkWindow *window,GtkMenuBar *menu_bar) { HWND hWnd; HMENU hMenu; t@@ -1988,15 +2006,19 @@ void gtk_vbox_set_size(GtkWidget *widget,GtkAllocation *allocation) { void gtk_window_realize(GtkWidget *widget) { GtkWindow *win=GTK_WINDOW(widget); HWND Parent; + DWORD resize=0; + + if (win->allow_shrink || win->allow_grow) resize=WS_SIZEBOX; + Parent=gtk_get_parent_hwnd(widget->parent); if (win->type==GTK_WINDOW_TOPLEVEL) { widget->hWnd = CreateWindow("mainwin",win->title, - WS_OVERLAPPEDWINDOW|CS_HREDRAW|CS_VREDRAW|WS_SIZEBOX, + WS_OVERLAPPEDWINDOW|CS_HREDRAW|CS_VREDRAW|resize, CW_USEDEFAULT,0,0,0,Parent,NULL,hInst,NULL); if (!TopLevel) TopLevel=widget->hWnd; } else { widget->hWnd = CreateWindow(WC_GTKDIALOG,win->title, - WS_CAPTION|WS_SYSMENU|CS_HREDRAW|CS_VREDRAW|WS_SIZEBOX, + WS_CAPTION|WS_SYSMENU|CS_HREDRAW|CS_VREDRAW|resize, CW_USEDEFAULT,0,0,0,Parent,NULL,hInst,NULL); } WindowList=g_slist_append(WindowList,(gpointer)win); t@@ -4448,6 +4470,20 @@ void gtk_window_handle_user_size(GtkWindow *window, GtkAllocation *allocation) { } +void gtk_window_handle_minmax_size(GtkWindow *window,LPMINMAXINFO minmax) { + GtkRequisition *req; + + req = >K_WIDGET(window)->requisition; + if (!window->allow_shrink) { + minmax->ptMinTrackSize.x = req->width; + minmax->ptMinTrackSize.y = req->height; + } + if (!window->allow_grow) { + minmax->ptMaxTrackSize.x = req->width; + minmax->ptMaxTrackSize.y = req->height; + } +} + void gtk_window_set_initial_position(GtkWindow *window, GtkAllocation *allocation) { RECT rect; (DIR) diff --git a/src/gtkport.h b/src/gtkport.h t@@ -449,6 +449,9 @@ struct _GtkWindow { GtkWidget *focus; HACCEL hAccel; guint modal : 1; + guint allow_shrink : 1; + guint allow_grow : 1; + guint auto_shrink : 1; }; typedef struct _GtkTable GtkTable; t@@ -534,6 +537,8 @@ GtkWidget *gtk_window_new(GtkWindowType type); void gtk_window_set_title(GtkWindow *window,const gchar *title); void gtk_window_set_default_size(GtkWindow *window,gint width,gint height); void gtk_window_set_transient_for(GtkWindow *window,GtkWindow *parent); +void gtk_window_set_policy(GtkWindow *window,gint allow_shrink, + gint allow_grow,gint auto_shrink); void gtk_container_add(GtkContainer *container,GtkWidget *widget); void gtk_container_set_border_width(GtkContainer *container,guint border_width); GtkWidget *gtk_button_new_with_label(const gchar *label); (DIR) diff --git a/src/message.c b/src/message.c t@@ -512,73 +512,82 @@ void SendSpyReport(Player *To,Player *SpiedOn) { #define NUMNAMES 12 void SendInitialData(Player *To) { - gchar *LocalNames[NUMNAMES] = { Names.Bitch,Names.Bitches,Names.Gun, - Names.Guns,Names.Drug,Names.Drugs, - Names.Month,Names.Year,Names.LoanSharkName, - Names.BankName,Names.GunShopName, - Names.RoughPubName }; - gint i; - GString *text; - - if (!Network) return; - if (!HaveAbility(To,A_TSTRING)) for (i=0;i<NUMNAMES;i++) { - LocalNames[i] = GetDefaultTString(LocalNames[i]); - } - text=g_string_new(""); - g_string_sprintf(text,"%s^%d^%d^%d^",VERSION,NumLocation,NumGun,NumDrug); - for (i=0;i<8;i++) { - g_string_append(text,LocalNames[i]); - g_string_append_c(text,'^'); - } - if (HaveAbility(To,A_PLAYERID)) g_string_sprintfa(text,"%d^",To->ID); + gchar *LocalNames[NUMNAMES] = { Names.Bitch,Names.Bitches,Names.Gun, + Names.Guns,Names.Drug,Names.Drugs, + Names.Month,Names.Year,Names.LoanSharkName, + Names.BankName,Names.GunShopName, + Names.RoughPubName }; + gint i; + GString *text; + + if (!Network) return; + if (!HaveAbility(To,A_TSTRING)) for (i=0;i<NUMNAMES;i++) { + LocalNames[i] = GetDefaultTString(LocalNames[i]); + } + text=g_string_new(""); + g_string_sprintf(text,"%s^%d^%d^%d^",VERSION,NumLocation,NumGun,NumDrug); + for (i=0;i<8;i++) { + g_string_append(text,LocalNames[i]); + g_string_append_c(text,'^'); + } + if (HaveAbility(To,A_PLAYERID)) g_string_sprintfa(text,"%d^",To->ID); /* Player ID is expected after the first 8 names, so send the rest now */ - for (i=8;i<NUMNAMES;i++) { - g_string_append(text,LocalNames[i]); - g_string_append_c(text,'^'); - } + for (i=8;i<NUMNAMES;i++) { + g_string_append(text,LocalNames[i]); + g_string_append_c(text,'^'); + } - if (!HaveAbility(To,A_TSTRING)) for (i=0;i<NUMNAMES;i++) { - g_free(LocalNames[i]); - } - SendServerMessage(NULL,C_NONE,C_INIT,To,text->str); - g_string_free(text,TRUE); + if (!HaveAbility(To,A_TSTRING)) for (i=0;i<NUMNAMES;i++) { + g_free(LocalNames[i]); + } + + g_string_sprintfa(text,"%c%s^",Currency.Prefix ? '1' : '0',Currency.Symbol); + SendServerMessage(NULL,C_NONE,C_INIT,To,text->str); + g_string_free(text,TRUE); } void ReceiveInitialData(Player *Play,char *Data) { - char *pt,*ServerVersion; - GSList *list; - pt=Data; - ServerVersion=GetNextWord(&pt,"(unknown)"); - ResizeLocations(GetNextInt(&pt,NumLocation)); - ResizeGuns(GetNextInt(&pt,NumGun)); - ResizeDrugs(GetNextInt(&pt,NumDrug)); - for (list=FirstClient;list;list=g_slist_next(list)) { - UpdatePlayer((Player*)list->data); - } - AssignName(&Names.Bitch,GetNextWord(&pt,"")); - AssignName(&Names.Bitches,GetNextWord(&pt,"")); - AssignName(&Names.Gun,GetNextWord(&pt,"")); - AssignName(&Names.Guns,GetNextWord(&pt,"")); - AssignName(&Names.Drug,GetNextWord(&pt,"")); - AssignName(&Names.Drugs,GetNextWord(&pt,"")); - AssignName(&Names.Month,GetNextWord(&pt,"")); - AssignName(&Names.Year,GetNextWord(&pt,"")); - if (HaveAbility(Play,A_PLAYERID)) Play->ID=GetNextInt(&pt,0); + char *pt,*ServerVersion,*curr; + GSList *list; + pt=Data; + ServerVersion=GetNextWord(&pt,"(unknown)"); + ResizeLocations(GetNextInt(&pt,NumLocation)); + ResizeGuns(GetNextInt(&pt,NumGun)); + ResizeDrugs(GetNextInt(&pt,NumDrug)); + for (list=FirstClient;list;list=g_slist_next(list)) { + UpdatePlayer((Player*)list->data); + } + AssignName(&Names.Bitch,GetNextWord(&pt,"")); + AssignName(&Names.Bitches,GetNextWord(&pt,"")); + AssignName(&Names.Gun,GetNextWord(&pt,"")); + AssignName(&Names.Guns,GetNextWord(&pt,"")); + AssignName(&Names.Drug,GetNextWord(&pt,"")); + AssignName(&Names.Drugs,GetNextWord(&pt,"")); + AssignName(&Names.Month,GetNextWord(&pt,"")); + AssignName(&Names.Year,GetNextWord(&pt,"")); + if (HaveAbility(Play,A_PLAYERID)) Play->ID=GetNextInt(&pt,0); /* Servers up to version 1.4.8 don't send the following names, so default to the existing values if they haven't been sent */ - AssignName(&Names.LoanSharkName,GetNextWord(&pt,Names.LoanSharkName)); - AssignName(&Names.BankName,GetNextWord(&pt,Names.BankName)); - AssignName(&Names.GunShopName,GetNextWord(&pt,Names.GunShopName)); - AssignName(&Names.RoughPubName,GetNextWord(&pt,Names.RoughPubName)); + AssignName(&Names.LoanSharkName,GetNextWord(&pt,Names.LoanSharkName)); + AssignName(&Names.BankName,GetNextWord(&pt,Names.BankName)); + AssignName(&Names.GunShopName,GetNextWord(&pt,Names.GunShopName)); + AssignName(&Names.RoughPubName,GetNextWord(&pt,Names.RoughPubName)); + +/* Currency data are only sent by versions >= 1.5.3 */ + curr = GetNextWord(&pt,NULL); + if (curr && strlen(curr)>=1) { + Currency.Prefix = (curr[0]=='1'); + AssignName(&Currency.Symbol,&curr[1]); + } - if (strcmp(VERSION,ServerVersion)!=0) { - g_message(_("This server is version %s, while your client is " + if (strcmp(VERSION,ServerVersion)!=0) { + g_message(_("This server is version %s, while your client is " "version %s.\nBe warned that different versions may not be fully compatible!\n" -"Refer to the website at http://bellatrix.pcl.ox.ac.uk/~ben/dopewars/\n" +"Refer to the website at http://dopewars.sourceforge.net/\n" "for the latest version."),ServerVersion,VERSION); - } + } } void SendMiscData(Player *To) { (DIR) diff --git a/src/winmain.c b/src/winmain.c t@@ -247,7 +247,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LogFileEnd(); g_strfreev(split); CloseHighScoreFile(); - if (PidFile) g_free(PidFile); + g_free(PidFile); + g_free(Log.File); + g_free(ConvertFile); return 0; }