├── doc ├── help │ ├── .cvsignore │ ├── Makefile.am │ ├── sounds.html │ ├── guns.html │ ├── locations.html │ ├── server.html │ ├── cops.html │ ├── drugs.html │ └── general.html ├── .cvsignore ├── Makefile.am ├── example-cfg ├── developer.html ├── windows.html ├── dopewars.6.in ├── index.html ├── credits.html ├── servercommands.html ├── aiplayer.html └── contribute.html ├── sounds ├── .cvsignore ├── 19.5degs │ ├── .cvsignore │ ├── bye.wav │ ├── colt.wav │ ├── die.wav │ ├── gun.wav │ ├── jet.wav │ ├── punch.wav │ ├── run.wav │ ├── train.wav │ ├── message.wav │ ├── murmur.wav │ ├── losebitch.wav │ ├── shotdown.wav │ ├── README │ └── Makefile.am └── Makefile.am ├── src ├── gtkport │ ├── .cvsignore │ ├── Makefile.am │ ├── unicodewrap.h │ ├── gtkenums.h │ ├── itemfactory.h │ └── gtktypes.h ├── curses_client │ ├── .cvsignore │ ├── Makefile.am │ └── curses_client.h ├── cursesport │ ├── .cvsignore │ ├── Makefile.am │ └── cursesport.h ├── gui_client │ ├── .cvsignore │ ├── Makefile.am │ ├── dopewars-pill.xpm │ ├── optdialog.h │ ├── newgamedia.h │ └── gtk_client.h ├── pill.ico ├── plugins │ ├── .cvsignore │ ├── sound_esd.h │ ├── sound_sdl.h │ ├── sound_winmm.h │ ├── Makefile.am │ ├── sound_winmm.c │ ├── sound_cocoa.m │ ├── sound_esd.c │ └── sound_sdl.c ├── dopewars-pill.png ├── dopewars-shot.png ├── dopewars-weed.png ├── .cvsignore ├── dopewars.rc ├── magic ├── dopewars.manifest ├── winmain.h ├── AIPlayer.h ├── configfile.h ├── mac_helpers.h ├── admin.h ├── mac_helpers.m ├── tstring.h ├── log.h ├── sound.h ├── nls.h ├── convert.h ├── Makefile.am ├── error.h ├── util.h ├── serverside.h ├── convert.c ├── log.c └── admin.c ├── ChangeLog.md ├── ABOUT-NLS ├── po ├── .cvsignore ├── quot.sed ├── boldquot.sed ├── POTFILES.in ├── check-cformat.sh ├── remove-potcdate.sin ├── insert-header.sin ├── en@quot.header ├── en@boldquot.header ├── ChangeLog ├── Rules-quot └── Makevars ├── win32 ├── mingw │ └── Dockerfile └── README.md ├── dopewars.desktop ├── .gitignore ├── auxbuild └── README-release ├── m4 ├── ltversion.m4 ├── codeset.m4 ├── glibc21.m4 ├── dp_expand_dir.m4 ├── nls.m4 ├── ax_require_defined.m4 ├── lcmessage.m4 ├── progtest.m4 ├── intlmacosx.m4 └── ltsugar.m4 ├── Makefile.am ├── .github └── workflows │ ├── build.yml │ └── codeql-analysis.yml ├── AUTHORS ├── runindent.sh ├── TODO ├── CONTRIBUTING.md ├── rpm └── dopewars.spec.in ├── mkinstalldirs ├── autogen.sh └── README.md /doc/help/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /sounds/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /doc/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | dopewars.6 4 | -------------------------------------------------------------------------------- /sounds/19.5degs/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /src/gtkport/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | -------------------------------------------------------------------------------- /src/curses_client/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | -------------------------------------------------------------------------------- /src/cursesport/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | -------------------------------------------------------------------------------- /src/gui_client/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/ChangeLog.md -------------------------------------------------------------------------------- /src/pill.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/src/pill.ico -------------------------------------------------------------------------------- /ABOUT-NLS: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/plugins/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | *.la 6 | *.lo 7 | -------------------------------------------------------------------------------- /src/dopewars-pill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/src/dopewars-pill.png -------------------------------------------------------------------------------- /src/dopewars-shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/src/dopewars-shot.png -------------------------------------------------------------------------------- /src/dopewars-weed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/src/dopewars-weed.png -------------------------------------------------------------------------------- /sounds/19.5degs/bye.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/bye.wav -------------------------------------------------------------------------------- /sounds/19.5degs/colt.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/colt.wav -------------------------------------------------------------------------------- /sounds/19.5degs/die.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/die.wav -------------------------------------------------------------------------------- /sounds/19.5degs/gun.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/gun.wav -------------------------------------------------------------------------------- /sounds/19.5degs/jet.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/jet.wav -------------------------------------------------------------------------------- /sounds/19.5degs/punch.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/punch.wav -------------------------------------------------------------------------------- /sounds/19.5degs/run.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/run.wav -------------------------------------------------------------------------------- /sounds/19.5degs/train.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/train.wav -------------------------------------------------------------------------------- /sounds/19.5degs/message.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/message.wav -------------------------------------------------------------------------------- /sounds/19.5degs/murmur.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/murmur.wav -------------------------------------------------------------------------------- /sounds/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = 19.5degs 4 | -------------------------------------------------------------------------------- /sounds/19.5degs/losebitch.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/losebitch.wav -------------------------------------------------------------------------------- /sounds/19.5degs/shotdown.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmwebb/dopewars/HEAD/sounds/19.5degs/shotdown.wav -------------------------------------------------------------------------------- /src/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | dopewars 6 | dopewars.res 7 | dopewars.exe 8 | -------------------------------------------------------------------------------- /po/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | POTFILES 4 | dopewars.pot 5 | *.gmo 6 | stamp-cat-id 7 | cat-id-tbl.c 8 | -------------------------------------------------------------------------------- /sounds/19.5degs/README: -------------------------------------------------------------------------------- 1 | The sounds in this directory are provided by Robin Kohli of 19.5degs.com, 2 | 3 | -------------------------------------------------------------------------------- /po/quot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | -------------------------------------------------------------------------------- /src/cursesport/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libcursesport.a 2 | libcursesport_a_SOURCES = cursesport.c cursesport.h 3 | AM_CPPFLAGS= -I${srcdir} -I$(top_srcdir)/src @GLIB_CFLAGS@ 4 | DEFS = @DEFS@ 5 | -------------------------------------------------------------------------------- /src/curses_client/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libcursesclient.a 2 | libcursesclient_a_SOURCES = curses_client.c curses_client.h 3 | AM_CPPFLAGS= -I${srcdir} -I$(top_srcdir)/src @GLIB_CFLAGS@ 4 | DEFS = @DEFS@ 5 | -------------------------------------------------------------------------------- /po/boldquot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | s/“/“/g 8 | s/”/”/g 9 | s/‘/‘/g 10 | s/’/’/g 11 | -------------------------------------------------------------------------------- /sounds/19.5degs/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | pkgdata_DATA = \ 4 | colt.wav gun.wav losebitch.wav \ 5 | murmur.wav run.wav train.wav bye.wav \ 6 | die.wav jet.wav message.wav punch.wav shotdown.wav 7 | 8 | EXTRA_DIST = README $(pkgdata_DATA) 9 | -------------------------------------------------------------------------------- /win32/mingw/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:33 2 | MAINTAINER Ben Webb 3 | RUN echo "zchunk=0" >> /etc/dnf/dnf.conf && dnf -y install mingw64-curl mingw64-glib2 mingw64-pkg-config mingw32-curl mingw32-glib2 mingw32-pkg-config automake autoconf which git make gettext diffutils mingw32-nsis 4 | -------------------------------------------------------------------------------- /src/gui_client/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libguiclient.a 2 | libguiclient_a_SOURCES = gtk_client.c gtk_client.h \ 3 | optdialog.c optdialog.h \ 4 | newgamedia.c newgamedia.h dopewars-pill.xpm 5 | AM_CPPFLAGS= -I${srcdir} -I$(top_srcdir)/src @GTK_CFLAGS@ @GLIB_CFLAGS@ 6 | DEFS = @DEFS@ 7 | -------------------------------------------------------------------------------- /src/gtkport/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libgtkport.a 2 | libgtkport_a_SOURCES = gtkport.c gtkport.h gtkenums.h \ 3 | unicodewrap.c unicodewrap.h treeview.h treeview.c \ 4 | itemfactory.c itemfactory.h gtktypes.h 5 | AM_CPPFLAGS= -I${srcdir} -I$(top_srcdir)/src @GTK_CFLAGS@ @GLIB_CFLAGS@ 6 | DEFS = @DEFS@ 7 | -------------------------------------------------------------------------------- /src/dopewars.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 1 24 "dopewars.manifest" 4 | 5 | mainicon ICON pill.ico 6 | 7 | gtkdialog DIALOG 40, 40, 40, 40 8 | STYLE WS_POPUP | WS_CAPTION | WS_THICKFRAME | DS_MODALFRAME | WS_SYSMENU 9 | CAPTION "" 10 | BEGIN 11 | END 12 | 13 | tabpage DIALOG 40, 40, 40, 40 14 | STYLE DS_CONTROL | WS_CHILD | DS_3DLOOK | WS_VISIBLE 15 | BEGIN 16 | END 17 | -------------------------------------------------------------------------------- /dopewars.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=dopewars 3 | Name[de]=Drogenkrieg 4 | Name[pl]=Wojny narkotykowe 5 | Comment=dopewars drug dealing game 6 | Comment[pl]=Gra polegająca na handlowaniu narkotykami 7 | Comment[fr]=Jeu de vente de drogue 8 | Exec=dopewars 9 | Icon=dopewars-weed.png 10 | Terminal=false 11 | Type=Application 12 | Categories=Application;Game;ArcadeGame; 13 | Encoding=UTF-8 14 | # vi: encoding=utf-8 15 | -------------------------------------------------------------------------------- /src/magic: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # dopewars: file(1) magic for dopewars high score files 3 | # 4 | # From 5 | # dopewars is a drug dealing game found at http://dopewars.sf.net/. 6 | # The version reported is that of the high score file, not of the 7 | # program itself. 8 | 9 | 0 string DOPEWARS\ SCORES\ V. dopewars high score file 10 | >&0 string >\0 (version %s) 11 | 12 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings 2 | 3 | src/dopewars.c 4 | src/util.c 5 | src/curses_client/curses_client.c 6 | src/gui_client/gtk_client.c 7 | src/gui_client/optdialog.c 8 | src/gui_client/newgamedia.c 9 | src/gtkport/gtkport.c 10 | src/cursesport/cursesport.c 11 | src/winmain.c 12 | src/serverside.c 13 | src/error.c 14 | src/message.c 15 | src/network.c 16 | src/admin.c 17 | src/configfile.c 18 | src/AIPlayer.c 19 | src/sound.c 20 | -------------------------------------------------------------------------------- /doc/help/Makefile.am: -------------------------------------------------------------------------------- 1 | DOCPATH = ${DESTDIR}${docdir}/help 2 | DOCS = cops.html general.html locations.html sounds.html \ 3 | drugs.html guns.html server.html 4 | EXTRA_DIST = ${DOCS} 5 | 6 | install-data-local: 7 | ${INSTALL} -d -m 0755 ${DOCPATH} 8 | for doc in ${DOCS}; do \ 9 | ${INSTALL} -m 0644 ${srcdir}/$${doc} ${DOCPATH}; \ 10 | done 11 | 12 | uninstall-local: 13 | for doc in ${DOCS}; do \ 14 | /bin/rm -f ${DOCPATH}/$${doc}; \ 15 | done 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | po/*.gmo 2 | po/stamp-po 3 | po/remove-potcdate.sed 4 | win32/install.nsi 5 | *.o 6 | *.a 7 | *.la 8 | *.lo 9 | *~ 10 | src/dopewars.exe 11 | src/dopewars.res 12 | src/plugins/.libs/ 13 | src/dopewars 14 | config.cache 15 | configure 16 | acinclude.m4 17 | aclocal.m4 18 | Makefile 19 | Makefile.in 20 | config.h 21 | config.h.in 22 | config.log 23 | config.status 24 | stamp-h 25 | stamp-h.in 26 | stamp-h1 27 | dopewars.sco 28 | dopewars.spec 29 | libtool 30 | autom4te.cache 31 | .deps 32 | compile 33 | doc/dopewars.6 34 | po/POTFILES 35 | -------------------------------------------------------------------------------- /po/check-cformat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check all translations for broken printf format strings 4 | 5 | # Usually this is done by msgfmt, but it chokes on our %Tde and %P notations, 6 | # so we disable it in the Makefile. 7 | 8 | # This simple script temporarily replaces each %Tde with %s and each %P 9 | # with %d, so that msgfmt can be run. 10 | 11 | POFILES=$(grep '^POFILES =' Makefile|cut -d= -f2) 12 | 13 | for po in ${POFILES}; do 14 | perl -p -e 's/%(([0-9]+$)?-?[0-9]*)[tT]../((t)%\1s/g; s/%(([0-9]+$)?-?[0-9]*)P/(P)%\1d/g' < ${po} > ${po}.tmp; msgfmt -c --statistics --verbose ${po}.tmp > /dev/null && rm -f ${po}.tmp 15 | done 16 | rm -f messages.mo 17 | -------------------------------------------------------------------------------- /src/dopewars.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | dopewars drug dealing game 9 | 10 | 11 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /auxbuild/README-release: -------------------------------------------------------------------------------- 1 | New version checklist: 2 | 3 | - cd po; rm dopewars.pot; make dopewars.pot; make update-po; ./check-cformat.sh 4 | - Add version number, date to ChangeLog.md 5 | - Change stable version number in NEWS README.md doc/installation.html doc/index.html doc/windows.html 6 | - git checkout -b release/x.y.z 7 | - Change SVN to x.y.z in configure.ac and commit and push 8 | - Merge into main, tag, and push: 9 | git checkout main; git merge --no-ff -m 'Merge for x.y.z release' origin/release/x.y.z; git diff origin/develop; git push origin main; git tag -s -u 22A3BF2B vx.y.z; git push origin vx.y.z 10 | - Delete temporary branch: 11 | git branch -d release/x.y.z; git push origin :release/x.y.z 12 | - make dist, upload tar.gz plus RPMs and .exes to GitHub and SourceForge 13 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /po/remove-potcdate.sin: -------------------------------------------------------------------------------- 1 | # Sed script that removes the POT-Creation-Date line in the header entry 2 | # from a POT file. 3 | # 4 | # Copyright (C) 2002 Free Software Foundation, Inc. 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. This file is offered as-is, 8 | # without any warranty. 9 | # 10 | # The distinction between the first and the following occurrences of the 11 | # pattern is achieved by looking at the hold space. 12 | /^"POT-Creation-Date: .*"$/{ 13 | x 14 | # Test if the hold space is empty. 15 | s/P/P/ 16 | ta 17 | # Yes it was empty. First occurrence. Remove the line. 18 | g 19 | d 20 | bb 21 | :a 22 | # The hold space was nonempty. Following occurrences. Do nothing. 23 | x 24 | :b 25 | } 26 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | DOCPATH = ${DESTDIR}${docdir} 2 | DOCS = aiplayer.html configfile.html index.html i18n.html \ 3 | server.html clientplay.html credits.html example-cfg \ 4 | installation.html servercommands.html commandline.html \ 5 | contribute.html developer.html metaserver.html \ 6 | protocol.html windows.html ../LICENCE example-igneous 7 | man_MANS = dopewars.6 8 | SUBDIRS = help 9 | EXTRA_DIST = dopewars.6.in ${DOCS} 10 | DISTCLEANFILES = dopewars.6 11 | 12 | install-data-local: 13 | ${INSTALL} -d -m 0755 ${DOCPATH} 14 | for doc in ${DOCS}; do \ 15 | ${INSTALL} -m 0644 ${srcdir}/$${doc} ${DOCPATH}; \ 16 | done 17 | 18 | uninstall-local: 19 | for doc in ${DOCS}; do \ 20 | /bin/rm -f ${DOCPATH}/$${doc}; \ 21 | done 22 | /bin/rm -f ${DOCPATH}/LICENCE 23 | -------------------------------------------------------------------------------- /m4/codeset.m4: -------------------------------------------------------------------------------- 1 | # codeset.m4 serial 4 (gettext-0.18) 2 | dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | 9 | AC_DEFUN([AM_LANGINFO_CODESET], 10 | [ 11 | AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], 12 | [AC_TRY_LINK([#include ], 13 | [char* cs = nl_langinfo(CODESET); return !cs;], 14 | [am_cv_langinfo_codeset=yes], 15 | [am_cv_langinfo_codeset=no]) 16 | ]) 17 | if test $am_cv_langinfo_codeset = yes; then 18 | AC_DEFINE([HAVE_LANGINFO_CODESET], [1], 19 | [Define if you have and nl_langinfo(CODESET).]) 20 | fi 21 | ]) 22 | -------------------------------------------------------------------------------- /doc/help/sounds.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Sounds Options 10 | 11 | 12 | 13 |

dopewars: Sounds Options

14 | 15 |

This tab allows you to configure the sounds played by dopewars during the 16 | game. To change a sound, first select it from the list. Then type the full 17 | path and name of a .WAV file into the "Sound file" box, or use the Browse 18 | button to find it on your computer. You can use the Play button to hear the 19 | sound that you have selected.

20 | 21 |

Bear in mind that all sounds can be turned on or off using the "Enable 22 | Sound" option on the Game menu.

23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src doc po sounds 2 | DESKTOPDIR = ${DESTDIR}${datadir}/gnome/apps/Games 3 | DESKTOP = dopewars.desktop 4 | SCOREDIR = ${DESTDIR}${localstatedir} 5 | SCORE = ${SCOREDIR}/dopewars.sco 6 | EXTRA_DIST = ABOUT-NLS LICENCE dopewars.desktop rpm/dopewars.spec.in \ 7 | runindent.sh win32/README.md win32/install.nsi.in README.md \ 8 | win32/mingw/Dockerfile ChangeLog.md 9 | CLEANFILES = dopewars.sco dopewars-log.txt dopewars-config.txt 10 | DISTCLEANFILES = rpm/dopewars.spec 11 | ACLOCAL_AMFLAGS= -I m4 12 | 13 | install-data-local: 14 | ${mkinstalldirs} ${SCOREDIR} 15 | touch ${SCORE} 16 | @chgrp games ${SCORE} || chgrp wheel ${SCORE} || \ 17 | echo "Unable to change group ownership of the high score file" 18 | chmod 0660 ${SCORE} 19 | ${mkinstalldirs} ${DESKTOPDIR} 20 | ${INSTALL} -m 0644 ${srcdir}/${DESKTOP} ${DESKTOPDIR} 21 | 22 | uninstall-local: 23 | /bin/rm -f ${SCORE} ${DESKTOPDIR}/${DESKTOP} 24 | -------------------------------------------------------------------------------- /m4/glibc21.m4: -------------------------------------------------------------------------------- 1 | # glibc21.m4 serial 4 2 | dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Test for the GNU C Library, version 2.1 or newer. 8 | # From Bruno Haible. 9 | 10 | AC_DEFUN([gl_GLIBC21], 11 | [ 12 | AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], 13 | [ac_cv_gnu_library_2_1], 14 | [AC_EGREP_CPP([Lucky GNU user], 15 | [ 16 | #include 17 | #ifdef __GNU_LIBRARY__ 18 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 19 | Lucky GNU user 20 | #endif 21 | #endif 22 | ], 23 | [ac_cv_gnu_library_2_1=yes], 24 | [ac_cv_gnu_library_2_1=no]) 25 | ] 26 | ) 27 | AC_SUBST([GLIBC21]) 28 | GLIBC21="$ac_cv_gnu_library_2_1" 29 | ] 30 | ) 31 | -------------------------------------------------------------------------------- /win32/README.md: -------------------------------------------------------------------------------- 1 | ## Building dopewars on Windows 2 | 3 | dopewars is built for Windows via cross-compilation on Linux using the 4 | MinGW tools. See the `mingw` subdirectory for a suitable `Dockerfile` to set up 5 | a [Docker](https://www.docker.com/) or [Podman](https://podman.io/) 6 | compilation environment. 7 | 8 | Once in the environment, build dopewars for 64-bit Windows with 9 | 10 | ./configure --host=x86_64-w64-mingw32 --enable-nativewin32 && make 11 | 12 | For 32-bit Windows, use 13 | 14 | ./configure --host=i686-w64-mingw32 --enable-nativewin32 && make 15 | 16 | In order for curl connections to the metaserver to work, copy 17 | `/etc/pki/tls/certs/ca-bundle.crt` from the Docker/Podman environment to 18 | the same directory as `dopewars.exe`. 19 | 20 | 21 | ## Windows installer 22 | 23 | The top-level `configure` script will also generate `install.nsi` in this 24 | directory. This can be used as input to 25 | [NSIS](https://nsis.sourceforge.io/) to build a Windows installer. 26 | -------------------------------------------------------------------------------- /po/insert-header.sin: -------------------------------------------------------------------------------- 1 | # Sed script that inserts the file called HEADER before the header entry. 2 | # 3 | # Copyright (C) 2001 Free Software Foundation, Inc. 4 | # Written by Bruno Haible , 2001. 5 | # This file is free software; the Free Software Foundation gives 6 | # unlimited permission to use, copy, distribute, and modify it. 7 | # 8 | # At each occurrence of a line starting with "msgid ", we execute the following 9 | # commands. At the first occurrence, insert the file. At the following 10 | # occurrences, do nothing. The distinction between the first and the following 11 | # occurrences is achieved by looking at the hold space. 12 | /^msgid /{ 13 | x 14 | # Test if the hold space is empty. 15 | s/m/m/ 16 | ta 17 | # Yes it was empty. First occurrence. Read the file. 18 | r HEADER 19 | # Output the file's contents by reading the next line. But don't lose the 20 | # current line while doing this. 21 | g 22 | N 23 | bb 24 | :a 25 | # The hold space was nonempty. Following occurrences. Do nothing. 26 | x 27 | :b 28 | } 29 | -------------------------------------------------------------------------------- /m4/dp_expand_dir.m4: -------------------------------------------------------------------------------- 1 | dnl DP_EXPAND_DIR(VARNAME, DIR) 2 | dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR, 3 | dnl and assigns the resulting string to VARNAME 4 | dnl example: DP_EXPAND_DIR(LOCALEDIR, "$datadir/locale") 5 | dnl eg, then: AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") 6 | dnl by Alexandre Oliva 7 | dnl from http://www.cygnus.com/ml/automake/1998-Aug/0040.html 8 | dnl Modified by Ben Webb, 2013, to perform three expansions; this 9 | dnl handles the case where DIR is something like ${datadir} 10 | dnl (first expansion -> ${prefix}/share, 11 | dnl second expansion -> /usr/local/share) 12 | AC_DEFUN([DP_EXPAND_DIR], [ 13 | $1=$2 14 | $1=`( 15 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" 16 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" 17 | eval echo \""[$]$1"\" 18 | )` 19 | $1=`( 20 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" 21 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" 22 | eval echo \""[$]$1"\" 23 | )` 24 | $1=`( 25 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" 26 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" 27 | eval echo \""[$]$1"\" 28 | )` 29 | ]) 30 | -------------------------------------------------------------------------------- /po/en@quot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | -------------------------------------------------------------------------------- /m4/nls.m4: -------------------------------------------------------------------------------- 1 | # nls.m4 serial 6 (gettext-0.20.2) 2 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2020 Free 3 | dnl Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file can be used in projects which are not available under 9 | dnl the GNU General Public License or the GNU Lesser General Public 10 | dnl License but which still want to provide support for the GNU gettext 11 | dnl functionality. 12 | dnl Please note that the actual code of the GNU gettext library is covered 13 | dnl by the GNU Lesser General Public License, and the rest of the GNU 14 | dnl gettext package is covered by the GNU General Public License. 15 | dnl They are *not* in the public domain. 16 | 17 | dnl Authors: 18 | dnl Ulrich Drepper , 1995-2000. 19 | dnl Bruno Haible , 2000-2003. 20 | 21 | AC_PREREQ([2.50]) 22 | 23 | AC_DEFUN([AM_NLS], 24 | [ 25 | AC_MSG_CHECKING([whether NLS is requested]) 26 | dnl Default is enabled NLS 27 | AC_ARG_ENABLE([nls], 28 | [ --disable-nls do not use Native Language Support], 29 | USE_NLS=$enableval, USE_NLS=yes) 30 | AC_MSG_RESULT([$USE_NLS]) 31 | AC_SUBST([USE_NLS]) 32 | ]) 33 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | os: [ubuntu-latest] 12 | flags: ["--enable-networking --disable-gtk3", 13 | "--enable-networking --enable-gtk3", 14 | "--disable-networking"] 15 | include: 16 | - os: macos-latest 17 | flags: "--enable-networking" 18 | - os: ubuntu-latest 19 | container: benmwebb/mingw 20 | flags: "--host=x86_64-w64-mingw32 --enable-nativewin32" 21 | runs-on: ${{ matrix.os }} 22 | container: ${{ matrix.container }} 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Install dependencies (Linux) 27 | if: matrix.os == 'ubuntu-latest' && matrix.container == null 28 | run: | 29 | sudo apt-get update -qq && sudo apt-get install -qq automake autoconf gcc libglib2.0-dev libcurl4-openssl-dev libgtk2.0-dev libgtk-3-dev 30 | - name: Install dependencies (Mac) 31 | if: matrix.os == 'macos-latest' 32 | run: | 33 | brew install automake 34 | - name: Build 35 | run: | 36 | ./autogen.sh ${{ matrix.flags }} && make -j2 37 | - name: Test 38 | if: matrix.container == null 39 | run: | 40 | src/dopewars -v 41 | src/dopewars -h 42 | -------------------------------------------------------------------------------- /m4/ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 1 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /m4/lcmessage.m4: -------------------------------------------------------------------------------- 1 | # lcmessage.m4 serial 6 (gettext-0.18) 2 | dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file can can be used in projects which are not available under 9 | dnl the GNU General Public License or the GNU Library General Public 10 | dnl License but which still want to provide support for the GNU gettext 11 | dnl functionality. 12 | dnl Please note that the actual code of the GNU gettext library is covered 13 | dnl by the GNU Library General Public License, and the rest of the GNU 14 | dnl gettext package package is covered by the GNU General Public License. 15 | dnl They are *not* in the public domain. 16 | 17 | dnl Authors: 18 | dnl Ulrich Drepper , 1995. 19 | 20 | # Check whether LC_MESSAGES is available in . 21 | 22 | AC_DEFUN([gt_LC_MESSAGES], 23 | [ 24 | AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], 25 | [AC_TRY_LINK([#include ], [return LC_MESSAGES], 26 | [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])]) 27 | if test $gt_cv_val_LC_MESSAGES = yes; then 28 | AC_DEFINE([HAVE_LC_MESSAGES], [1], 29 | [Define if your file defines LC_MESSAGES.]) 30 | fi 31 | ]) 32 | -------------------------------------------------------------------------------- /po/en@boldquot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | # This catalog furthermore displays the text between the quotation marks in 24 | # bold face, assuming the VT100/XTerm escape sequences. 25 | # 26 | -------------------------------------------------------------------------------- /doc/help/guns.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Guns Options 10 | 11 | 12 | 13 |

dopewars: Guns Options

14 | 15 |
    16 |
  • Gun: A list of all guns in the game. Use the "New" 17 | button to create a new gun, or the "Delete", "Up" and "Down" buttons 18 | to delete the currently selected gun or to change its position in the 19 | list. (If you delete all of the guns, then the cops will never attack 20 | you, and you cannot attack other players or buy guns in the Gun Shop.) 21 | Selecting a gun from this list allows the other 22 | sections in this window to be filled in.

  • 23 | 24 |
  • Name: The name of the gun. 25 |

  • 26 | 27 |
  • Price: The cost of the gun, if you buy it from the Gun Shop. (If 28 | you are offered it during the course of the game on the street, then it is 29 | offered at 10% of this price). 30 |

  • 31 | 32 |
  • Inventory space: The amount of space that this gun takes up in 33 | your inventory. 34 |

  • 35 | 36 |
  • Damage: The maximum damage done by this gun, if you hit an enemy. 37 | (The actual amount of health that they lose is also dependent on their armor 38 | rating.) 39 |

  • 40 | 41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /doc/example-cfg: -------------------------------------------------------------------------------- 1 | # Anything after a '#' symbol on the same line is treated as a comment 2 | # and is ignored 3 | 4 | /* Multi-line comments are also possible, if this C-style syntax is used to 5 | denote their starting and finishing points 6 | N.B. Whitespace (tabs, space characters) is ignored, as are line breaks 7 | (except for the purpose of terminating '#'-style comments) */ 8 | 9 | # An example of setting a numerical value 10 | MaxClients= 6 11 | 12 | /* An example of setting a string (text) value (all strings should be quoted - 13 | double-quotes can also be used, but these interpret C-style escape 14 | sequences (like \t for a tab character) and so should be avoided, e.g, for 15 | Windows path names) */ 16 | HiScoreFile= '/var/lib/games/dopewars.sco' 17 | 18 | # An example of setting a string list value 19 | StoppedTo = { 'drink a beer', 'visit a friend', 20 | 'smoke a cigar' } 21 | 22 | StartCash=2000000 # Start each player with $2million 23 | StartDebt=0 24 | Port=7904 25 | NumLocation=6 26 | Location[1].Name='Oxford' 27 | Location[2].Name='London' 28 | Location[3].Name='Birmingham' 29 | Location[4].Name='Manchester' 30 | Location[5].Name='Edinburgh' 31 | Location[6].Name='Milton Keynes' 32 | 33 | Drug[1].Name='Smarties' 34 | Drug[1].Cheap=0 35 | Drug[1].Expensive=1 36 | Drug[1].MinPrice=5000 37 | Drug[1].MaxPrice=50000 38 | 39 | Gun[2].Name='Uzi 9mm' 40 | Gun[2].Price=500000 41 | Gun[2].Space=20 42 | Gun[2].Damage=50 43 | 44 | DrugSortMethod=3 45 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2020-11-06 gettextize 2 | 3 | * Makefile.in.in: Upgrade to gettext-0.21. 4 | * Rules-quot: Upgrade to gettext-0.21. 5 | * en@boldquot.header: Upgrade to gettext-0.21. 6 | * en@quot.header: Upgrade to gettext-0.21. 7 | * insert-header.sin: Upgrade to gettext-0.21. 8 | * remove-potcdate.sin: Upgrade to gettext-0.21. 9 | 10 | 2013-07-08 gettextize 11 | 12 | * Makefile.in.in: Upgrade to gettext-0.18.2. 13 | * boldquot.sed: New file, from gettext-0.18.2. 14 | * en@boldquot.header: New file, from gettext-0.18.2. 15 | * en@quot.header: New file, from gettext-0.18.2. 16 | * insert-header.sin: New file, from gettext-0.18.2. 17 | * quot.sed: New file, from gettext-0.18.2. 18 | * remove-potcdate.sin: New file, from gettext-0.18.2. 19 | * Rules-quot: New file, from gettext-0.18.2. 20 | 21 | 2013-06-25 gettextize 22 | 23 | * Makefile.in.in: Upgrade to gettext-0.18.1. 24 | * boldquot.sed: New file, from gettext-0.18.1. 25 | * en@boldquot.header: New file, from gettext-0.18.1. 26 | * en@quot.header: New file, from gettext-0.18.1. 27 | * insert-header.sin: New file, from gettext-0.18.1. 28 | * quot.sed: New file, from gettext-0.18.1. 29 | * remove-potcdate.sin: New file, from gettext-0.18.1. 30 | * Rules-quot: New file, from gettext-0.18.1. 31 | 32 | 2001-10-26 gettextize 33 | 34 | * Makefile.in.in: Upgrade to gettext-0.10.38. 35 | * cat-id-tbl.c: Remove file. 36 | * stamp-cat-id: Remove file. 37 | 38 | -------------------------------------------------------------------------------- /doc/help/locations.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Location Options 10 | 11 | 12 | 13 |

dopewars: Location Options

14 | 15 |
    16 |
  • Location: A list of all locations in the game. Use the "New" 17 | button to create a new location, or the "Delete", "Up" and "Down" buttons 18 | to delete the currently selected location or to change its position in the 19 | list. (You cannot delete all of the locations, as this would make the 20 | game unplayable.) Selecting a location from this list allows the other 21 | sections in this window to be filled in.

  • 22 | 23 |
  • Name: The name of the region or city that the location represents. 24 |

  • 25 | 26 |
  • Police presence: The percentage chance that the police in this 27 | location will catch you fighting with other drug dealers or dropping drugs. 28 |

  • 29 | 30 |
  • Minimum no. of drugs: Every time you visit this location, a random 31 | number of drugs will be available for buying or selling. This allows you to 32 | set the minimum number of different types of drug that will be available in 33 | this location.

  • 34 | 35 |
  • Maximum no. of drugs: This allows you to set the maximum number of 36 | different types of drug that will be available in this location.

  • 37 | 38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | dopewars is derived from the MS-DOS game of the same name (author unknown). 2 | 3 | This is turn was based upon the MS-DOS game "Drug Wars", by John E. Dell. 4 | 5 | dopewars is written by and is copyright of Ben Webb (benwebb@users.sf.net) 6 | 7 | Pivotal to the development of dopewars were and are the following:- 8 | 9 | Dan Wolf for uncountable numbers of useful suggestions for the structure of the 10 | multiplayer game, drawing upon a disturbing knowledge of the drugs world. He 11 | also undertook scary amounts of research (i.e. playing the game) to assist with 12 | the re-engineering of the MS-DOS version, and plays the game to an unhealthy 13 | extent (as is witnessed by his high scores on many dopewars servers). 14 | 15 | Phil Davis, Caroline Moore, Katherine Holt and Andrea Elliot-Smith for extensive 16 | play testing of early versions of dopewars, despite the large amounts of "real" 17 | work which they were supposed to be doing, and despite the many dodgy bugs, as 18 | well as for providing suggestions, even if they were often rude. You know who 19 | you are. 20 | 21 | Owen Walsh and Pete Winn for yet more play testing, and for consequently doing 22 | very little research in vastly more important fields... 23 | 24 | James Matthews for providing absolutely no useful suggestions, but providing 25 | vital assistance with the Officer Bob code. 26 | 27 | Mike Meyer for providing several modifications to version 1.4.3, as well as 28 | spotting many of his own and my bugs... 29 | 30 | Matt Higgins for a couple of patches to version 1.4.4. 31 | 32 | Tony Brown for assistance with using dopewars via. enforced web proxies. 33 | 34 | -------------------------------------------------------------------------------- /src/gui_client/dopewars-pill.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * dopewars_pill_xpm[] = { 3 | "32 32 19 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #A00000", 7 | "@ c #0080FF", 8 | "# c #FF0000", 9 | "$ c #40A0FF", 10 | "% c #FF2D2D", 11 | "& c #FFFFFF", 12 | "* c #FE1111", 13 | "= c #FF0D0D", 14 | "- c #3FA0FF", 15 | "; c #FC0000", 16 | "> c #3E9FFF", 17 | ", c #FA0000", 18 | "' c #0C1E30", 19 | ") c #3D9EFF", 20 | "! c #081521", 21 | "~ c #FD0000", 22 | "{ c #210000", 23 | " ", 24 | " ", 25 | " ", 26 | " ", 27 | " ", 28 | " ", 29 | " ", 30 | " ", 31 | " ", 32 | " ...................... ", 33 | " ..+++++++++.@@@@@@@@@@.. ", 34 | " .+++#######+.@$$$$$$$$@@@. ", 35 | " .++%&&######+.@$$$$$$$$$$@@. ", 36 | " .+*&&=######+.@$$$$$$$$$$-@. ", 37 | " .++#&########+.@$$$$$$$$$$$@@. ", 38 | " .+##&########+.@$$$$$$$$$$$$@. ", 39 | " .+###########+.@$$$$$$$$$$$$@. ", 40 | " .+###########+.@$$$$$$$$$$$$@. ", 41 | " .+;##########+.@$$$$$$$$$$$>@. ", 42 | " .++##########+.@$.$$..$..$$@@. ", 43 | " .+,#########+.@$$.$.&$'$$)@. ", 44 | " .++#########+.@$$$...$!$$@@. ", 45 | " .+++~~~~~~~+.@$$$$$$$$@@@. ", 46 | " .{+++++++++.@@@@@@@@@@.. ", 47 | " ...................... ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " ", 53 | " ", 54 | " "}; 55 | -------------------------------------------------------------------------------- /doc/help/server.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Server Options 10 | 11 | 12 | 13 |

dopewars: Server Options

14 | 15 |
    16 |
  • Server reports to metaserver: If checked, then when running the 17 | dopewars server, it will report to the metaserver so that players can find 18 | your server from the dopewars website or from the New Game dialog's Metaserver 19 | tab. (If not checked, its existence will not be advertised, but people can 20 | still connect to your server if they know the hostname and port number.) 21 |

  • 22 | 23 |
  • Minimize to System Tray: (Windows only) When running the 24 | graphical server, and it is minimized, do not show the window in the normal 25 | window list, but in the System Tray (the collection of small icons in the 26 | bottom right of the screen). Clicking on the dopewars icon in the Tray will 27 | restore the window to its normal state.

  • 28 | 29 |
  • Metaserver URL: The full URL for the metaserver script, used by 30 | both the server and client. You should not normally need to alter this.

  • 31 | 32 |
  • Comment: A description of your dopewars server, which is sent to 33 | the metaserver and can be used to tell potential clients the rough rules of 34 | your game.

  • 35 | 36 |
  • MOTD (welcome message): The message of the day, sent to clients 37 | when they connect to the server (can be used to tell them more about the setup 38 | of the game).

  • 39 | 40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/winmain.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * winmain.h Startup code and support for the Win32 platform * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_WINMAIN_H__ 24 | #define __DP_WINMAIN_H__ 25 | 26 | #ifdef CYGWIN 27 | 28 | #include 29 | 30 | gchar *GetBinaryDir(void); 31 | 32 | #endif /* CYGWIN */ 33 | 34 | #endif /* __DP_WINMAIN_H__ */ 35 | -------------------------------------------------------------------------------- /src/AIPlayer.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * AIPlayer.h Header file for dopewars computer player code * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_AIPLAYER_H__ 24 | #define __DP_AIPLAYER_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | struct CMDLINE; 31 | void AIPlayerLoop(struct CMDLINE *cmdline); 32 | 33 | #endif /* __DP_AIPLAYER_H__ */ 34 | -------------------------------------------------------------------------------- /src/curses_client/curses_client.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * curses_client.h dopewars client using the (n)curses console library * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __CURSES_CLIENT_H__ 24 | #define __CURSES_CLIENT_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | struct CMDLINE; 31 | 32 | void CursesLoop(struct CMDLINE *cmdline); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/gui_client/optdialog.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * optdialog.c Configuration file editing dialog * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __OPT_DIALOG_H__ 24 | #define __OPT_DIALOG_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "gtkport/gtkport.h" 31 | 32 | void OptDialog(GtkWidget *widget, gpointer data); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/configfile.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * configfile.h Functions for dealing with dopewars config files * 3 | * Copyright (C) 2002-2004 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_CONFIGFILE_H__ 24 | #define __DP_CONFIGFILE_H__ 25 | 26 | #include 27 | 28 | extern gchar *LocalCfgEncoding; 29 | gboolean UpdateConfigFile(const gchar *cfgfile, gboolean ForceUTF8); 30 | gboolean IsConfigFileUTF8(void); 31 | 32 | #endif /* __DP_CONFIGFILE_H__ */ 33 | -------------------------------------------------------------------------------- /src/mac_helpers.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * mac_helpers.h Helper functions for Mac builds * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_MAC_HELPERS_H__ 24 | #define __DP_MAC_HELPERS_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | /* Open the given URL using the system-configured web browser */ 31 | void mac_open_url(const char *url); 32 | 33 | #endif /* __DP_MAC_HELPERS_H__ */ 34 | -------------------------------------------------------------------------------- /src/plugins/sound_esd.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_esd.h Header file for dopewars sound system (ESD driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_SOUND_ESD_H__ 24 | #define __DP_SOUND_ESD_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "sound.h" 31 | 32 | #ifdef HAVE_ESD 33 | SoundDriver *sound_esd_init(void); 34 | #endif /* HAVE_ESD */ 35 | 36 | #endif /* __DP_SOUND_ESD_H__ */ 37 | -------------------------------------------------------------------------------- /src/admin.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * admin.h Header file for dopewars server administration * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_ADMIN_H__ 24 | #define __DP_ADMIN_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #if !defined(CYGWIN) && defined(NETWORKING) 31 | 32 | struct CMDLINE; 33 | void AdminServer(struct CMDLINE *cmdline); 34 | 35 | #endif /* CYGWIN */ 36 | 37 | #endif /* __DP_ADMIN_H__ */ 38 | -------------------------------------------------------------------------------- /src/plugins/sound_sdl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_sdl.h Header file for dopewars sound system (SDL driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_SOUND_SDL_H__ 24 | #define __DP_SOUND_SDL_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "sound.h" 31 | 32 | #ifdef HAVE_SDL_MIXER 33 | SoundDriver *sound_sdl_init(void); 34 | #endif /* HAVE_SDL_MIXER */ 35 | 36 | #endif /* __DP_SOUND_SDL_H__ */ 37 | -------------------------------------------------------------------------------- /src/plugins/sound_winmm.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_winmm.h Header file for dopewars sound system (WinMM driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_SOUND_WINMM_H__ 24 | #define __DP_SOUND_WINMM_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "sound.h" 31 | 32 | #ifdef HAVE_WINMM 33 | SoundDriver *sound_winmm_init(void); 34 | #endif /* HAVE_WINMM */ 35 | 36 | #endif /* __DP_SOUND_WINMM_H__ */ 37 | -------------------------------------------------------------------------------- /doc/help/cops.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Cops Options 10 | 11 | 12 | 13 |

dopewars: Cops Options

14 | 15 |
    16 |
  • Cop: A list of all cops in the game. Use the "New" 17 | button to create a new cop, or the "Delete", "Up" and "Down" buttons 18 | to delete the currently selected cop or to change its position in the 19 | list. (If you delete all of the cops, then the cops will never attack 20 | you.) Selecting a cop from this list allows the other 21 | sections in this window to be filled in.

  • 22 | 23 |
  • Name: The name of the cop. 24 |

  • 25 | 26 |
  • Name of one deputy: The name of one of the deputies or other 27 | assistants that can accompany this cop.

  • 28 | 29 |
  • Name of several deputies: The name of two or more of the deputies 30 | or other assistants that can accompany this cop.

  • 31 | 32 |
  • Minimum no. of deputies: The lowest number of deputies that can 33 | accompany this cop. The more deputies, the harder it is to run away from or 34 | to shoot the cop, and the more damage they do to you when they shoot.

  • 35 | 36 |
  • Maximum no. of deputies: The highest number of deputies that can 37 | accompany this cop.

  • 38 | 39 |
  • Cop armor: A percentage value to determine how much damage the cop 40 | takes when he is shot. A value of 100 means that if you do 10 damage, the cop 41 | loses 10 health. A value of 200 means that he only loses 5 health, and a value 42 | of 50 results in a loss of 20.

  • 43 | 44 |
  • Deputy armor: A percentage value to determine how much damage each 45 | deputy takes when he is shot.

  • 46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/mac_helpers.m: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * mac_helpers.m Helper functions for Mac builds * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #import 28 | 29 | #include "mac_helpers.h" 30 | 31 | void mac_open_url(const char *url) 32 | { 33 | NSString *urlstr = [[NSString alloc] initWithUTF8String:url]; 34 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlstr]]; 35 | } 36 | -------------------------------------------------------------------------------- /src/tstring.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * tstring.h "Translated string" wrappers for dopewars * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_TSTRING_H__ 24 | #define __DP_TSTRING_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | void dpg_print(gchar *format, ...); 33 | gchar *dpg_strdup_printf(gchar *format, ...); 34 | void dpg_string_printf(GString *string, gchar *format, ...); 35 | void dpg_string_append_printf(GString *string, gchar *format, ...); 36 | 37 | gchar *GetDefaultTString(gchar *tstring); 38 | 39 | #endif /* __DP_TSTRING_H__ */ 40 | -------------------------------------------------------------------------------- /runindent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -f 2 | 3 | indent -kr -i2 -cp1 -ncs -bad -nut \ 4 | -fc1 -fca -sc \ 5 | \ 6 | -T SCREEN \ 7 | \ 8 | -T ssize_t -T fd_set -T FILE \ 9 | \ 10 | -T price_t -T AbilType -T Abilities -T ClientType -T DispMode \ 11 | -T EventCode -T PlayerFlags -T DrugIndex -T Inventory -T Player \ 12 | -T DopeEntry -T DopeList -T ServerData -T ErrorType -T LastError \ 13 | -T CustomErrorCode -T ErrTable -T MetaErrorCode -T MsgCode -T AICode \ 14 | -T FightPoint -T SocksMethods -T SocksErrorCode -T HttpErrorCode \ 15 | -T ConnBuf -T NetworkBuffer -T NBCallBack -T NBUserPasswd \ 16 | -T SocksServer -T NBStatus -T NBSocksStatus -T HttpStatus \ 17 | -T HttpConnection -T HCAuthFunc -T OfferForce -T FmtData \ 18 | \ 19 | -T TCHAR -T DWORD -T HANDLE -T ACCEL -T RECT -T COLORREF \ 20 | -T LPARAM -T WPARAM -T LPMINMAXINFO -T HWND -T LPMEASUREITEMSTRUCT \ 21 | -T HD_NOTIFY -T NMHDR -T UINT -T SOCKET -T HBRUSH -T LONG -T LPTSTR \ 22 | -T HFONT -T BOOL \ 23 | \ 24 | -T GString -T gpointer -T gconstpointer -T gchar -T guchar -T gint \ 25 | -T guint -T GList -T GSList -T gboolean -T GScannerConfig -T GScanner \ 26 | -T GPtrArray -T GArray -T gfloat -T gint16 \ 27 | \ 28 | -T GtkObject -T GtkCList -T GtkWidget -T GtkRequisition \ 29 | -T GtkAllocation -T GtkWindow -T GtkContainer -T GtkRadioButton \ 30 | -T GtkAdjustment -T GtkEntry -T GtkAccelGroup -T GtkTable \ 31 | -T GtkItemFactory -T GtkItemFactoryEntry -T GtkEditable -T GtkText \ 32 | -T GtkBox -T GtkToggleButton -T GtkMenuShell -T GtkMenuBar -T GtkMenu \ 33 | -T GtkNotebook -T GtkMenuItem -T GtkPaned -T GtkOptionMenu -T GtkLabel \ 34 | -T GtkSpinButton -T GtkMisc -T GtkProgressBar -T GdkEvent -T GtkButton \ 35 | -T GtkClass -T GdkInput -T GtkBoxChild -T GtkTableChild -T GtkSignal \ 36 | -T GtkGIntSignalFunc -T GtkItemFactoryChild -T GtkNotebookChild \ 37 | -T GtkCListRow -T GdkEventButton -T GtkCheckButton -T GtkTimeout \ 38 | \ 39 | -T NTService -T InstFiles -T InstLink -T InstData -T bstr -T InstFlags 40 | -------------------------------------------------------------------------------- /src/log.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * log.h Logging functions for dopewars * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_LOG_H__ 24 | #define __DP_LOG_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | typedef enum { 33 | LF_SERVER = (1 << 0) 34 | } LogFlags; 35 | 36 | void dopelog(const int loglevel, const LogFlags flags, 37 | const gchar *format, ...); 38 | GLogLevelFlags LogMask(void); 39 | GString *GetLogString(GLogLevelFlags log_level, const gchar *message); 40 | void OpenLog(void); 41 | void CloseLog(void); 42 | 43 | #endif /* __DP_LOG_H__ */ 44 | -------------------------------------------------------------------------------- /doc/developer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | Notes for developers 10 | 11 | 12 | 13 | 14 |

Notes for developers

15 | 16 |

You are free to make whatever changes to the code you wish, as long as you 17 | abide by the terms set out in the GNU General 18 | Public License. Obviously, I only have a limited amount of time to devote 19 | to dopewars development, and so encourage discussion of the dopewars code, 20 | documentation and concept, and particularly welcome suggested improvements.

21 | 22 |

You are free to distribute modified versions of the code, 23 | again subject to the license, but I also welcome additions to the code 24 | via pull requests. 25 | If I choose to include this code in a new dopewars version, you will of 26 | course be credited in the changelog (unless, of course, you don't want to 27 | be).

28 | 29 |

If you wish to write your own client to connect to a dopewars server, then 30 | you need to understand the protocol that dopewars uses, which is 31 | documented here.

32 | 33 |

The definitive source on the internal workings of the dopewars game code 34 | is the source code itself. It is not exactly "self-documenting", but I have 35 | endeavoured to add sufficient documentation to the source where necessary; 36 | any discussion here of the internal workings, however, may be incomplete, out 37 | of date, and possibly misleading. Feel free to 38 | open an issue 39 | with questions on this; I might possibly even know the answers!

40 | 41 |
42 | 45 |

46 | Last update: 05-12-2020
47 | Valid XHTML 1.1 48 |

49 | 50 | 51 | -------------------------------------------------------------------------------- /src/gui_client/newgamedia.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * newgamedia.h New game dialog * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __NEWGAME_DIA_H__ 24 | #define __NEWGAME_DIA_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include 31 | #include "dopewars.h" 32 | #include "network.h" 33 | 34 | #ifdef NETWORKING 35 | void NewGameDialog(Player *play, NBCallBack sockstat, CurlConnection *MetaConn); 36 | void DisplayConnectStatus(NBStatus oldstatus, NBSocksStatus oldsocks); 37 | void FinishServerConnect(gboolean ConnectOK); 38 | #else 39 | void NewGameDialog(Player *play); 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /doc/help/drugs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: Drugs Options 10 | 11 | 12 | 13 |

dopewars: Drugs Options

14 | 15 |
    16 |
  • Drug: A list of all drugs in the game. Use the "New" 17 | button to create a new drug, or the "Delete", "Up" and "Down" buttons 18 | to delete the currently selected drug or to change its position in the 19 | list. (You cannot delete all of the drugs, as this would make the 20 | game unplayable.) Selecting a drug from this list allows the other 21 | sections in this window to be filled in.

  • 22 | 23 |
  • Name: The name of the drug. 24 |

  • 25 | 26 |
  • Minimum normal price: Sets the lowest price that this drug can 27 | be offered at, under normal circumstances (i.e. there have been no drug busts 28 | or other special events on this day).

  • 29 | 30 |
  • Maximum normal price: Sets the highest price that this drug can 31 | be offered at, under normal circumstances.

  • 32 | 33 |
  • Can be specially cheap: If checked, then occasionally this drug 34 | can be offered at a quarter of its usual price, due to some special event. 35 |

  • 36 | 37 |
  • Cheap string: If the previous checkbox is selected, then this is 38 | the message that is displayed when this drug is offered cheaply - e.g. 39 | "The market is flooded with cheap home-made acid!".

  • 40 | 41 |
  • Can be specially expensive: If checked, then occasionally this drug 42 | can be offered at four times its usual price, due to some special event. 43 |

  • 44 | 45 |
  • Expensive string 1/2: These two strings are used whenever any 46 | drug is offered at the expensive price (one of the two messages is picked at 47 | random). The name of the drug is substituted into the string for "%tde" - e.g. 48 | "Addicts are buying %tde at ridiculous prices!" could be displayed as 49 | "Addicts are buying Cocaine at ridiculous prices!".

  • 50 | 51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libsound_winmm.la 2 | if ESD 3 | noinst_LTLIBRARIES += libsound_esd.la 4 | endif 5 | if SDL 6 | noinst_LTLIBRARIES += libsound_sdl.la 7 | endif 8 | if COCOA 9 | noinst_LTLIBRARIES += libsound_cocoa.la 10 | endif 11 | libsound_esd_la_SOURCES = sound_esd.c sound_esd.h 12 | libsound_esd_la_LDFLAGS = @ESD_LIBS@ 13 | libsound_sdl_la_SOURCES = sound_sdl.c sound_sdl.h 14 | libsound_sdl_la_LDFLAGS = @SDL_LIBS@ 15 | libsound_winmm_la_SOURCES = sound_winmm.c sound_winmm.h 16 | libsound_cocoa_la_LDFLAGS = -module -avoid-version -no-undefined -Wl,-framework,Foundation,-framework,AppKit 17 | libsound_cocoa_la_SOURCES = sound_cocoa.m 18 | LIBS = @GLIB_LIBS@ 19 | AM_CPPFLAGS = @SOUND_CFLAGS@ @GLIB_CFLAGS@ 20 | LINKNOO = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) 21 | 22 | if PLUGINS 23 | PLUGINDIR = ${DESTDIR}${plugindir} 24 | if ESD 25 | ESD_SO = .libs/libsound_esd.so 26 | endif 27 | if SDL 28 | SDL_SO = .libs/libsound_sdl.so 29 | endif 30 | if COCOA 31 | COCOA_SO = .libs/libsound_cocoa.so 32 | endif 33 | PLUGINS = $(ESD_SO) $(SDL_SO) $(COCOA_SO) 34 | 35 | all-local: ${PLUGINS} 36 | 37 | .libs/libsound_esd.so: $(libsound_esd_la_OBJECTS) 38 | $(LINKNOO) -o libsound_esd.la -rpath $(libdir) $(libsound_esd_la_LDFLAGS) $(libsound_esd_la_OBJECTS) $(libsound_esd_la_LIBADD) $(LIBS) 39 | 40 | .libs/libsound_sdl.so: $(libsound_sdl_la_OBJECTS) 41 | $(LINKNOO) -o libsound_sdl.la -rpath $(libdir) $(libsound_sdl_la_LDFLAGS) $(libsound_sdl_la_OBJECTS) $(libsound_sdl_la_LIBADD) $(LIBS) 42 | 43 | .libs/libsound_winmm.so: $(libsound_winmm_la_OBJECTS) 44 | $(LINKNOO) -o libsound_winmm.la -rpath $(libdir) $(libsound_winmm_la_LDFLAGS) $(libsound_winmm_la_OBJECTS) $(libsound_winmm_la_LIBADD) $(LIBS) 45 | 46 | .libs/libsound_cocoa.so: $(libsound_cocoa_la_OBJECTS) 47 | $(LINKNOO) -o libsound_cocoa.la -rpath $(libdir) $(libsound_cocoa_la_LDFLAGS) $(libsound_cocoa_la_OBJECTS) $(libsound_cocoa_la_LIBADD) $(LIBS) 48 | 49 | install-exec-am: 50 | ${mkinstalldirs} ${PLUGINDIR} 51 | for plug in ${PLUGINS}; do \ 52 | ${INSTALL} $${plug} ${PLUGINDIR}; \ 53 | done 54 | 55 | uninstall-local: 56 | for plug in ${PLUGINS}; do \ 57 | /bin/rm -f ${PLUGINDIR}/`basename $${plug}`; \ 58 | done 59 | endif 60 | -------------------------------------------------------------------------------- /src/sound.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound.h Header file for dopewars sound system * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_SOUND_H__ 24 | #define __DP_SOUND_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | #include 30 | 31 | struct _SoundDriver { 32 | void *module; 33 | gchar *name; 34 | gboolean (*open) (void); 35 | void (*close) (void); 36 | void (*play) (const gchar *snd); 37 | }; 38 | typedef struct _SoundDriver SoundDriver; 39 | 40 | gchar *GetPluginList(void); 41 | void SoundInit(void); 42 | void SoundOpen(gchar *drivername); 43 | void SoundClose(void); 44 | void SoundPlay(const gchar *snd); 45 | void SoundEnable(gboolean enable); 46 | gboolean IsSoundEnabled(void); 47 | 48 | #endif /* __DP_SOUND_H__ */ 49 | -------------------------------------------------------------------------------- /src/nls.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * nls.h Header file for NLS (internationalization) defines * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_NLS_H__ 24 | #define __DP_NLS_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | # include 28 | #endif 29 | 30 | #ifdef ENABLE_NLS 31 | # include 32 | # include 33 | # define _(String) gettext (String) 34 | # ifdef gettext_noop 35 | # define N_(String) gettext_noop (String) 36 | # else 37 | # define N_(String) (String) 38 | # endif 39 | #else 40 | # define gettext(String) (String) 41 | # define dgettext(Domain,Message) (Message) 42 | # define dcgettext(Domain,Message,Type) (Message) 43 | # define bind_textdomain_codeset(Domain,Codeset) 44 | # define _(String) (String) 45 | # define N_(String) (String) 46 | #endif 47 | 48 | #endif /* __DP_NLS_H__ */ 49 | -------------------------------------------------------------------------------- /src/convert.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * convert.h Header file for codeset conversion functions * 3 | * Copyright (C) 2002-2004 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_CONVERT_H__ 24 | #define __DP_CONVERT_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | # include 28 | #endif 29 | 30 | #include 31 | 32 | typedef struct _Converter Converter; 33 | struct _Converter { 34 | gchar *ext_codeset; 35 | }; 36 | 37 | void Conv_SetInternalCodeset(const gchar *codeset); 38 | Converter *Conv_New(void); 39 | void Conv_SetCodeset(Converter *conv, const gchar *codeset); 40 | gboolean Conv_Needed(Converter *conv); 41 | gchar *Conv_ToExternal(Converter *conv, const gchar *int_str, int len); 42 | gchar *Conv_ToInternal(Converter *conv, const gchar *ext_str, int len); 43 | void Conv_Free(Converter *conv); 44 | 45 | #endif /* __DP_CONVERT_H__ */ 46 | -------------------------------------------------------------------------------- /src/gui_client/gtk_client.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * gtk_client.h dopewars client using the GTK+ toolkit * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __GTK_CLIENT_H__ 24 | #define __GTK_CLIENT_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "gtkport/gtkport.h" 31 | 32 | extern GtkWidget *MainWindow; 33 | 34 | struct CMDLINE; 35 | 36 | #ifdef CYGWIN 37 | gboolean GtkLoop(HINSTANCE hInstance, HINSTANCE hPrevInstance, 38 | struct CMDLINE *cmdline, gboolean ReturnOnFail); 39 | #else 40 | gboolean GtkLoop(int *argc, char **argv[], 41 | struct CMDLINE *cmdline, gboolean ReturnOnFail); 42 | #endif 43 | 44 | void GuiStartGame(void); 45 | GtkWidget *my_hbbox_new(void); 46 | void my_gtk_box_pack_start_defaults(GtkBox *box, GtkWidget *child); 47 | void my_set_dialog_position(GtkWindow *dialog); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | - User accounts (i.e. players connect with a username and password, so can 2 | build up their status over several games, or save and continue games) 3 | - Popup to let you know you only have x days left before the end of the game 4 | - Better use of screen space in curses client for large xterms etc. 5 | - Preserve chat messages at end of game (so they aren't lost when looking at 6 | the high score list) ? 7 | - Price history graph and/or more sensible price fluctuations 8 | - Network installer for Win32 version, so that we don't have to distribute 9 | megabytes of DLLs, sounds and translations if the user doesn't want them 10 | (or already has them) 11 | - Option to let the cops search/fine you rather than shooting at them 12 | - Limit rate of server connections to combat DOS attacks / players trying 13 | to get a good starting day? 14 | - Add support for reading/writing multiple configuration files to GUI client's 15 | Options dialog 16 | - Startscreen 17 | - Track down server memory corruption bug! 18 | - Implement server option to buy more than one bitch at a time in the Pub. 19 | - Allow customisation of GtkTextView tag colours 20 | - Admin of running NT Service servers 21 | - GSS_API SOCKS support? 22 | - Fix problem with dialogs popping up while menus are open 23 | - Increase difficulty of escaping from another player - impose penalty on 24 | running (lose drugs, free shot, destination revealed) 25 | - Alliances/cartels - several players share cash 26 | - Introduce minimum/maximum players options - AI players automatically 27 | spawned/killed to "fill the gaps" when humans leave/enter 28 | - "Deal" option when meeting players? 29 | - Bribe/steal bitches when meeting players (difficulty inv. prop. to number of 30 | bitches?) 31 | - Problems reported with display of large prices and health - "seems" to be 32 | OK now... (i.e. I can't see anything wrong with it!) 33 | - Fix GTK+ modal dialog behaviour (mouse grabbing during fighting) - _seems_ 34 | to be OK... 35 | - Fix bug with players leaving the game during fights (first, must find it) 36 | - Metaserver keeps list of game types of each server 37 | Cannot reproduce... can you? (- Investigate deadlock during fighting if both 38 | players move to "deal") 39 | Cannot reproduce... can you? (- Investigate prompt for bitch on every turn 40 | after a spy is dispatched) 41 | -------------------------------------------------------------------------------- /src/plugins/sound_winmm.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_winmm.c dopewars sound system (Windows MM driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #ifdef HAVE_WINMM 28 | #include 29 | #include 30 | #include 31 | #include "../sound.h" 32 | 33 | static gboolean SoundOpen_WinMM(void) 34 | { 35 | return TRUE; 36 | } 37 | 38 | static void SoundClose_WinMM(void) 39 | { 40 | sndPlaySound(NULL, 0); 41 | } 42 | 43 | static void SoundPlay_WinMM(const gchar *snd) 44 | { 45 | sndPlaySound(snd, SND_ASYNC); 46 | } 47 | 48 | SoundDriver *sound_winmm_init(void) 49 | { 50 | static SoundDriver driver; 51 | 52 | driver.name = "winmm"; 53 | driver.open = SoundOpen_WinMM; 54 | driver.close = SoundClose_WinMM; 55 | driver.play = SoundPlay_WinMM; 56 | return &driver; 57 | } 58 | 59 | #endif /* HAVE_WINMM */ 60 | -------------------------------------------------------------------------------- /doc/help/general.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars: General Options 10 | 11 | 12 | 13 |

dopewars: General Options

14 | 15 |
    16 |
  • Remove drug references: Do not popup random events during the game 17 | that might mention drugs. This also disables the cops and the gun shop. 18 | Obviously, if you really want to remove drug references completely, you 19 | also need to change all the drug names in the 20 | Drugs tab.

  • 21 | 22 |
  • Unicode config file: Write out the configuration file in UTF-8 23 | (Unicode) encoding, rather than the default locale encoding. You should turn 24 | this option on if you are using unusual characters (e.g. Hebrew or Cyrillic 25 | in the English version) as these will be otherwise lost when you save the file. 26 | Note that this is the default under Unix when running in UTF-8 locales. Note 27 | also that versions of dopewars prior to 1.5.8, or Unix versions linked against 28 | GTK+1.x, will not be able to read UTF-8 configuration files.

  • 29 | 30 |
  • Game length (turns): The number of days over which the game runs. 31 | If this is set to 0 (zero) then the game will only end if you are killed. 32 |

  • 33 | 34 |
  • Starting cash: The amount of money that each player in the game 35 | gets at the start.

  • 36 | 37 |
  • Starting debt: The amount of money that each player in the game 38 | starts out in debt to the Loan Shark.

  • 39 | 40 |
  • Currency symbol: The symbol (e.g. $, £, €, GBP) used 41 | to denote all prices in the game.

  • 42 | 43 |
  • Symbol prefixes prices: If checked, then the currency symbol is 44 | always printed before prices (e.g. $100). If unchecked, it follows 45 | the prices (e.g. 100 EUR).

  • 46 | 47 |
  • Name of one bitch: The word used to refer to a single one of your 48 | companions. For example, you may prefer "henchman" to "bitch".

  • 49 | 50 |
  • Name of several bitches: The word used to refer to several of your 51 | companions. For example, you may prefer "henchmen" to "bitches".

  • 52 | 53 |
  • Web browser: (Unix only) The full pathname of the program that you 54 | use for displaying webpages. For example, /usr/bin/mozilla.

  • 55 |
56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /po/Rules-quot: -------------------------------------------------------------------------------- 1 | # Special Makefile rules for English message catalogs with quotation marks. 2 | # 3 | # Copyright (C) 2001-2017 Free Software Foundation, Inc. 4 | # This file, Rules-quot, and its auxiliary files (listed under 5 | # DISTFILES.common.extra1) are free software; the Free Software Foundation 6 | # gives unlimited permission to use, copy, distribute, and modify them. 7 | 8 | DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot 9 | 10 | .SUFFIXES: .insert-header .po-update-en 11 | 12 | en@quot.po-create: 13 | $(MAKE) en@quot.po-update 14 | en@boldquot.po-create: 15 | $(MAKE) en@boldquot.po-update 16 | 17 | en@quot.po-update: en@quot.po-update-en 18 | en@boldquot.po-update: en@boldquot.po-update-en 19 | 20 | .insert-header.po-update-en: 21 | @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ 22 | if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ 23 | tmpdir=`pwd`; \ 24 | echo "$$lang:"; \ 25 | ll=`echo $$lang | sed -e 's/@.*//'`; \ 26 | LC_ALL=C; export LC_ALL; \ 27 | cd $(srcdir); \ 28 | if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ 29 | | $(SED) -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | \ 30 | { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ 31 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ 32 | $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ 33 | ;; \ 34 | *) \ 35 | $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ 36 | ;; \ 37 | esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ 38 | ; then \ 39 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 40 | rm -f $$tmpdir/$$lang.new.po; \ 41 | else \ 42 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 43 | :; \ 44 | else \ 45 | echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 46 | exit 1; \ 47 | fi; \ 48 | fi; \ 49 | else \ 50 | echo "creation of $$lang.po failed!" 1>&2; \ 51 | rm -f $$tmpdir/$$lang.new.po; \ 52 | fi 53 | 54 | en@quot.insert-header: insert-header.sin 55 | sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header 56 | 57 | en@boldquot.insert-header: insert-header.sin 58 | sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header 59 | 60 | mostlyclean: mostlyclean-quot 61 | mostlyclean-quot: 62 | rm -f *.insert-header 63 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Nasty hack; there seems to be no other way of disabling libtool for the 2 | # link of the main executable... 3 | if PLUGINS 4 | MYLINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) 5 | else 6 | MYLINK = $(CCLD) 7 | endif 8 | 9 | if GUI_CLIENT 10 | GUISUBDIR = gui_client 11 | endif 12 | if CURSES_CLIENT 13 | CURSESSUBDIR = curses_client 14 | endif 15 | if GTKPORT 16 | GTKPORTSUBDIR = gtkport 17 | endif 18 | if CURSESPORT 19 | CURSESPORTSUBDIR = cursesport 20 | endif 21 | 22 | SUBDIRS = $(GUISUBDIR) $(CURSESSUBDIR) $(GTKPORTSUBDIR) $(CURSESPORTSUBDIR) plugins 23 | dopewars_LDADD = @GUILIB@ @CURSESLIB@ @GTKPORTLIB@ @CURSESPORTLIB@ @GTK_LIBS@ @LTLIBINTL@ @WNDRES@ @PLUGOBJS@ @PLUGLIBS@ @GLIB_LIBS@ @LIBCURL@ 24 | dopewars_DEPENDENCIES = @GUILIB@ @CURSESLIB@ @GTKPORTLIB@ @CURSESPORTLIB@ @WNDRES@ @PLUGOBJS@ 25 | 26 | bin_PROGRAMS = dopewars 27 | dopewars_SOURCES = admin.c admin.h AIPlayer.c AIPlayer.h util.c util.h \ 28 | configfile.c configfile.h convert.c convert.h \ 29 | dopewars.c dopewars.h error.c error.h log.c log.h \ 30 | message.c message.h network.c network.h nls.h \ 31 | serverside.c serverside.h sound.c sound.h \ 32 | tstring.c tstring.h winmain.c winmain.h mac_helpers.h 33 | AM_CPPFLAGS= -I${srcdir} @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBCURL_CPPFLAGS@ 34 | if APPLE 35 | dopewars_SOURCES += mac_helpers.m 36 | MACLDFLAGS = -framework AppKit 37 | else 38 | MACLDFLAGS = 39 | endif 40 | # Since we included (even optionally) an Objective C file, automake will 41 | # use OBJC rather than CC to link 42 | LINK = $(MYLINK) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) $(MACLDFLAGS) -o $@ 43 | OBJCLINK = $(MYLINK) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) $(MACLDFLAGS) -o $@ 44 | DEFS = @DEFS@ 45 | PIXDIR = ${DESTDIR}${datadir}/pixmaps 46 | DOPEDIR = ${DESTDIR}${bindir} 47 | DOPEBIN = ${DOPEDIR}/dopewars 48 | PIXMAPS = dopewars-pill.png dopewars-shot.png dopewars-weed.png 49 | EXTRA_DIST = ${PIXMAPS} pill.ico magic dopewars.rc dopewars.manifest 50 | CLEANFILES = dopewars.res dopewars.exe 51 | WINDRES = @WINDRES@ 52 | 53 | install-exec-hook: 54 | @chgrp games ${DOPEBIN} || chgrp wheel ${DOPEBIN} || \ 55 | ( echo "WARNING: Cannot change group of dopewars binary - the high"; \ 56 | echo "score file may be unreadable or unwriteable by some users" ) 57 | chmod 2755 ${DOPEBIN} 58 | 59 | install-data-local: 60 | ${mkinstalldirs} ${PIXDIR} 61 | for pix in ${PIXMAPS}; do \ 62 | ${INSTALL} -m 0644 ${srcdir}/$${pix} ${PIXDIR}; \ 63 | done 64 | 65 | uninstall-local: 66 | for pix in ${PIXMAPS}; do \ 67 | /bin/rm -f ${PIXDIR}/$${pix}; \ 68 | done 69 | 70 | %.res: %.rc 71 | ${WINDRES} -O coff -o $@ $< 72 | -------------------------------------------------------------------------------- /doc/windows.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | dopewars and Microsoft Windows 10 | 11 | 12 | 13 | 14 |

dopewars and Microsoft Windows

15 | 16 |

dopewars runs natively on Win32 systems (Windows 7 or later). It runs by 17 | default as a dopewars client, using the familiar Windows interface, but 18 | the traditional text-mode client is also available on Windows, as well as 19 | the dopewars server and AI players. 20 |

21 | 22 |

Binaries can be obtained from the main 23 | download site, or 24 | dopewars can be 25 | built 26 | from source code.

27 | 28 |

In virtually all respects, the Unix and Win32 versions of dopewars should be 29 | identical. Both will accept the same command line parameters and configuration 30 | options. However, since the standard Unix paths for the high score file and 31 | configuration files do not translate well to Windows, by default the program 32 | will look for the high score file dopewars.sco in the current 33 | user's application data directory (e.g. 34 | C:\Users\foo\AppData\Local\dopewars\), and will read a global 35 | configuration file dopewars-config.txt from the directory in which the 36 | dopewars binary was installed, followed by a per-user configuration file of 37 | the same name in the AppData directory.

38 | 39 |

The dopewars server can function as a 40 | Windows service when run with 41 | the -N flag. One way to set this up is to use the 42 | sc create utility from a command prompt, e.g.

43 | 44 |

sc create dopewars binpath= "C:\Program Files\dopewars-1.6.2\dopewars.exe -N"

45 | 46 |

Note that this will run dopewars as the Local System user, so will look for 47 | high score/config files (and create a log file) in the corresponding AppData 48 | directory, e.g. C:\Windows\System32\config\systemprofile\AppData\Local.

49 | 50 |
51 | 54 |

55 | Last update: 05-12-2020
56 | Valid XHTML 1.1 57 |

58 | 59 | 60 | -------------------------------------------------------------------------------- /doc/dopewars.6.in: -------------------------------------------------------------------------------- 1 | .TH DOPEWARS 6 2 | .SH NAME 3 | dopewars \- drug dealing game 4 | .SH SYNOPSIS 5 | .B dopewars 6 | .I "[OPTIONS] ..." 7 | .SH "DESCRIPTION" 8 | .B dopewars 9 | is a ncurses- and GTK- based drug dealing game based in New York, with you as 10 | the drug dealer striving to become filthy rich. It supports network 11 | play and single-player games. 12 | .SH OPTIONS 13 | Valid commandline options: 14 | .TP 15 | \fB\-b\fR, \fB\-\-no\-color\fR, \fB\-\-no\-colour\fR 16 | "black and white", i.e. do not use pretty colours 17 | .TP 18 | \fB\-n\fR, \fB\-\-single\-player\fR 19 | Do not connect to any available dopewars servers 20 | .TP 21 | \fB\-a\fR, \fB\-\-antique\fR 22 | Antique dopewars; stick as close as possible to the functionality of the 23 | original version. 24 | .TP 25 | \fB\-f\fR, \fB\-\-scorefile\fR=\fIFILE\fR 26 | Specify a file to use as high score table (defaults to @DPDATADIR@/dopewars.sco) 27 | .TP 28 | \fB\-o\fR, \fB\-\-hostname\fR=\fIADDR\fR 29 | Specify a multiplayer hostname 30 | .TP 31 | \fB\-s\fR, \fB\-\-public\-server\fR 32 | Run in server mode. (Note: see the \fB\-A\fR option for configuring a server 33 | once it's running.) 34 | .TP 35 | \fB\-S\fR, \fB\-\-private\-server\fR 36 | Run as a "private" server (do not report to the metaserver) 37 | .TP 38 | \fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR 39 | Specify the network port to use 40 | .TP 41 | \fB\-g\fR, \fB\-\-config\-file\fR=\fIFILE\fR 42 | Specify the pathname of a dopewars configuration file 43 | .TP 44 | \fB\-r\fR, \fB\-\-pidfile\fR=\fIFILE\fR 45 | Specify the pathname of a PID file to maintain while running as a server 46 | .TP 47 | \fB\-l\fR, \fB\-\-logfile\fR=\fIFILE\fR 48 | Write log messages to the given file (rather than standard output) 49 | .TP 50 | \fB\-A\fR, \fB\-\-admin\fR 51 | Connect to a server running on localhost, for administration 52 | .TP 53 | \fB\-c\fR, \fB\-\-ai\-player\fR 54 | Create and run a computer player 55 | .TP 56 | \fB\-w\fR, \fB\-\-windowed\-client\fR 57 | Force the use of a graphical client (GTK+ or Win32) 58 | .TP 59 | \fB\-t\fR, \fB\-\-text\-client\fR 60 | Force the use of a text-mode (curses) client (by default, a windowed client 61 | is used when possible) 62 | .TP 63 | \fB\-P\fR, \fB\-\-player\fR=\fINAME\fR 64 | Sets the default player name 65 | .TP 66 | \fB\-C\fR, \fB\-\-convert\fR=\fIFILE\fR 67 | Convert a high score file used by dopewars-1.5.1 or earlier to the format 68 | used by more recent versions 69 | .TP 70 | \fB\-h\fR, \fB\-\-help\fR 71 | Display a help screen 72 | .TP 73 | \fB\-v\fR, \fB\-\-version\fR 74 | Output version information and exit. 75 | .SH AUTHOR 76 | This manual page was written by Leon Breedt , 77 | for the Debian GNU/Linux system (but may be used by others). Additional 78 | updates by Ben Webb . 79 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | dopewars is open-source software, meaning that it is free for anybody to 4 | use. However, this also means that the quality of the software is dependent 5 | in part on **you** the user. You **don't** have to be a programmer to 6 | help out - in fact, dopewars currently needs people to produce sounds and 7 | graphics rather than to write code. 8 | 9 | - **Sounds** are needed. dopewars-1.5.7 and later support sounds, but 10 | don't contain sounds for every game event. If **you** can provide 11 | copyright-free sounds, then short files are needed for various effects 12 | in the game. For example, gunshots, bullet hits, ricochets and subway 13 | trains are obvious candidates for sound effects, although pretty much 14 | any event in the game that you can think of can conceivably have a sound 15 | (e.g. when players join or leave the game). These sounds should be in WAV 16 | format, and should probably be no more than a second or two in length. 17 | Later versions of dopewars may also be able to play longer repeating 18 | sounds (i.e. music) if you're interested in contributing this. Please 19 | open a [pull request](https://github.com/benmwebb/dopewars/pulls) 20 | to add sound files to dopewars. 21 | 22 | - **Suggestions** for future improvements are always welcomed at the 23 | [issue tracker](https://github.com/benmwebb/dopewars/issues). 24 | These can be anything from "the game interface is confusing" through 25 | "more game locations are needed" to "what about a hospital". (I can't 26 | guarantee that such suggestions will ever make it into dopewars, but 27 | it's a lot easier if I know they exist! Also, it's far more likely 28 | to happen if you write the code - see the 29 | [tips for developers](https://dopewars.sourceforge.io/docs/developer.html) 30 | page.) 31 | 32 | - **Bug reports** are always useful. Register them with the 33 | [issue tracker](https://github.com/benmwebb/dopewars/issues). 34 | If I don't know the problem exists, I can't fix it... 35 | The more information you can give here, the better. In particular, I need 36 | to know your operating system - e.g. Linux or Windows. For Linux, gdb stack 37 | traces of the core file are most useful. 38 | 39 | - **Configuration files** can be included in future distributions. If 40 | you run a customised game, and think others might want to play with your 41 | configuration, or at least use it as an example, then post it in the 42 | [issue tracker](https://github.com/benmwebb/dopewars/issues). 43 | 44 | - **Translation** of dopewars into your language will enable you to 45 | play the game in your native tongue, and will also help others that speak 46 | the same language. It's pretty easy, too - all you have to do is edit a 47 | simple text file! See the 48 | [i18n pages](https://dopewars.sourceforge.io/docs/developer.html). 49 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 15 | dopewars 1.6.2: Main Index 16 | 17 | 18 | 19 | 20 |

dopewars 1.6.2: Main Index

21 | 22 | 23 | 24 | 25 | 26 | 27 | 41 | 42 | 62 | 63 | 64 |
43 |

dopewars is a game simulating the life of a drug dealer in 1984 New York, 44 | based upon the MS-DOS game of the same name, in turn derived from "Drug 45 | Wars" by John E. Dell. The aim of the game is to make lots and lots of 46 | money, but unfortunately you start the game with a hefty debt to the loan 47 | shark (who charges equally hefty interest) and the cops take a rather dim 48 | view of drug dealing...

49 | 50 |

dopewars expands upon the MS-DOS version by introducing multiplayer 51 | functions. With the aid of dopewars servers, several players (computer or 52 | human) can roam New York (or some other city, chosen by the operator of the 53 | server) and attempt to shoot other players and steal their lucrative drugs.

54 | 55 |

dopewars is written on the RedHat Linux platform, and should run on most 56 | varieties of Unix, as well as under Microsoft Windows. The source code is 57 | freely available under the GNU General Public License.

58 | 59 |

For more information on the current state of dopewars, check out the 60 | webpage.

61 |
65 | 66 |
67 |

68 | Last update: 02-06-2003
69 | Valid XHTML 1.1 70 | and CSS 71 |

72 | 73 | 74 | -------------------------------------------------------------------------------- /doc/credits.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | Credits and acknowledgements 10 | 11 | 12 | 13 | 14 |

Credits and acknowledgements

15 | 16 |

dopewars is derived from the MS-DOS game of the same name (author 17 | unknown).

18 | 19 |

This is turn was based upon the MS-DOS game "Drug Wars", by John E. Dell.

20 | 21 |

dopewars is written by and is copyright of 22 | Ben Webb.

23 | 24 |

Pivotal to the development of dopewars were and are the following:-

25 | 26 |

Dan Wolf for uncountable numbers of useful suggestions for the 27 | structure of the multiplayer game, drawing upon a disturbing knowledge of the 28 | drugs world. He also undertook scary amounts of research (i.e. playing the 29 | game) to assist with the re-engineering of the MS-DOS version, and plays the 30 | game to an unhealthy extent (as is witnessed by his high scores on many 31 | dopewars servers).

32 | 33 |

Phil Davis, Caroline Moore, Katherine Holt and Andrea 34 | Elliot-Smith for extensive play testing of early versions of dopewars, 35 | despite the large amounts of "real" work which they were supposed to be 36 | doing, and despite the many dodgy bugs, as well as for providing 37 | suggestions, even if they were often rude. You know who you are.

38 | 39 |

Owen Walsh and Pete Winn for yet more play testing, and for 40 | consequently doing very little research in vastly more important fields...

41 | 42 |

James Matthews for providing absolutely no useful suggestions, but 43 | providing vital assistance with the Officer Bob code.

44 | 45 |

Mike Meyer for providing several modifications to version 1.4.3, 46 | as well as spotting many of his own and my bugs...

47 | 48 |

Matt Higgins for a couple of patches to version 1.4.4.

49 | 50 |

Tony Brown for assistance with using dopewars via enforced web 51 | proxies.

52 | 53 |

Leon Breedt for writing a manpage, and creating a Debian package.

54 | 55 |

Ocelot Mantis for graphics and ideas for improvements.

56 | 57 |

Tobias Mathes, Slawomir Molenda, Leonard, 58 | Quique, Åsmund Skjæveland, Hugo Cisneiros, 59 | Eric Steiner, François Marier, Benjamin Karaca, 60 | and Bruno Lopes for translating dopewars into 61 | other languages.

62 | 63 |
64 | 67 |

68 | Last update: 05-12-2020
69 | Valid XHTML 1.1 70 |

71 | 72 | 73 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ develop ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ develop ] 20 | schedule: 21 | - cron: '38 13 * * 3' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'cpp' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | - name: Install dependencies (Linux) 45 | run: | 46 | sudo apt-get update -qq && sudo apt-get install -qq automake autoconf gcc libglib2.0-dev libcurl4-openssl-dev libgtk-3-dev gettext 47 | 48 | # Initializes the CodeQL tools for scanning. 49 | - name: Initialize CodeQL 50 | uses: github/codeql-action/init@v2 51 | with: 52 | languages: ${{ matrix.language }} 53 | # If you wish to specify custom queries, you can do so here or in a config file. 54 | # By default, queries listed here will override any specified in a config file. 55 | # Prefix the list here with "+" to use these queries and those in the config file. 56 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 57 | 58 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 59 | # If this step fails, then you should remove it and run the build manually (see below) 60 | - name: Autobuild 61 | uses: github/codeql-action/autobuild@v2 62 | 63 | # ℹ️ Command-line programs to run using the OS shell. 64 | # 📚 https://git.io/JvXDl 65 | 66 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 67 | # and modify them (or add more) to build your code if your project 68 | # uses a compiled language 69 | 70 | #- run: | 71 | # make bootstrap 72 | # make release 73 | 74 | - name: Perform CodeQL Analysis 75 | uses: github/codeql-action/analyze@v2 76 | -------------------------------------------------------------------------------- /src/plugins/sound_cocoa.m: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_cocoa.m Implementation of dopewars sound system (Cocoa driver)* 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #ifdef HAVE_COCOA 28 | #include 29 | #include "../sound.h" 30 | 31 | #import 32 | #import 33 | 34 | /* Cache player by name of sound file */ 35 | NSMutableDictionary *play_by_name; 36 | 37 | static gboolean SoundOpen_Cocoa(void) 38 | { 39 | play_by_name = [[NSMutableDictionary alloc] init]; 40 | return TRUE; 41 | } 42 | 43 | static void SoundClose_Cocoa(void) 44 | { 45 | [play_by_name release]; 46 | } 47 | 48 | static void SoundPlay_Cocoa(const gchar *snd) 49 | { 50 | NSString *sound = [[NSString alloc] initWithUTF8String:snd]; 51 | NSSound *p; 52 | p = [play_by_name objectForKey:sound]; 53 | if (!p) { 54 | p = [[NSSound alloc] initWithContentsOfFile:sound byReference:YES]; 55 | /* If the sound file doesn't exist, do nothing */ 56 | if (!p) return; 57 | [play_by_name setObject:p forKey:sound]; 58 | } 59 | /* First, stop any currently playing sound */ 60 | [p stop]; 61 | [p play]; 62 | } 63 | 64 | SoundDriver *sound_cocoa_init(void) 65 | { 66 | static SoundDriver driver; 67 | 68 | driver.name = "cocoa"; 69 | driver.open = SoundOpen_Cocoa; 70 | driver.close = SoundClose_Cocoa; 71 | driver.play = SoundPlay_Cocoa; 72 | return &driver; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /src/error.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * error.h Header file for dopewars error-handling routines * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_ERROR_H__ 24 | #define __DP_ERROR_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | struct _LastError; 33 | typedef struct _ErrorType { 34 | void (*AppendErrorString) (GString *str, struct _LastError *error); 35 | void (*FreeErrorData) (struct _LastError *error); 36 | } ErrorType; 37 | 38 | typedef struct _LastError { 39 | gint code; 40 | ErrorType *type; 41 | gpointer data; 42 | } LastError; 43 | 44 | extern ErrorType *ET_CUSTOM, *ET_ERRNO; 45 | 46 | #ifdef CYGWIN 47 | extern ErrorType *ET_WIN32, *ET_WINSOCK; 48 | #else 49 | extern ErrorType *ET_HERRNO; 50 | #endif 51 | 52 | typedef enum { 53 | E_FULLBUF 54 | } CustomErrorCode; 55 | 56 | typedef struct _ErrTable { 57 | gint code; 58 | gchar *string; 59 | } ErrTable; 60 | 61 | void WantUTF8Errors(gboolean want); 62 | gchar *ErrStrFromErrno(int errcode); 63 | void FreeError(LastError *error); 64 | LastError *NewError(ErrorType *type, gint code, gpointer data); 65 | void SetError(LastError **error, ErrorType *type, gint code, 66 | gpointer data); 67 | void LookupErrorCode(GString *str, gint code, ErrTable *table, 68 | gchar *fallbackstr); 69 | void g_string_assign_error(GString *str, LastError *error); 70 | void g_string_append_error(GString *str, LastError *error); 71 | 72 | #endif /* __DP_ERROR_H__ */ 73 | -------------------------------------------------------------------------------- /doc/servercommands.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | Interactive server commands 10 | 11 | 12 | 13 | 14 |

Interactive server commands

15 | 16 |

Available commands are listed below. Please note also that any valid 17 | line from a configuration file can 18 | be entered at the interactive server's prompt. Note, however, that game 19 | options cannot be changed while players are connected. In addition, the 20 | current value of any option from the configuration files can be displayed 21 | by typing the name of the variable by itself. For example, entering 22 | MetaServer.Comment at the prompt will display the comment that the 23 | server sends to the metaserver.

24 | 25 |
26 |
help
27 |
Displays a help screen, listing valid server commands and the variables 28 | which can be set in configuration files.
29 | 30 |
list
31 |
Lists the given names of all the players currently logged on to the 32 | server.
33 | 34 |
push Bert
35 |
Politely asks the player with the given name Bert to leave the 36 | server - i.e. sends a message to the client, which should then finish off 37 | and break the connection at the far end.
38 | 39 |
kill Bert
40 |
Abruptly breaks the connection to the player with given name Bert. 41 | This is necessary if, for example, the client refuses to acknowledge a 42 | "push" message.
43 | 44 |
msg:Hi all!
45 |
Broadcasts the message Hi all! to all players currently connected 46 | to this server.
47 | 48 |
save my-conf
49 |
Saves the current configuration (names of drugs, locations, etc.) to 50 | the file my-conf. If no file name is given, the configuration is 51 | written to the local configuration file - usually ~/.dopewars on 52 | Unix systems and dopewars-config.txt on Windows.
53 | 54 |
quit
55 |
Politely quit, by asking all clients to leave, and then terminating once 56 | they have done so. An "impolite" quit, which is necessary if the clients fail 57 | to respond to this message, is performed on receipt of a SIGINT or SIGTERM 58 | signal (i.e. pressing Ctrl-C or killing the process with the "kill" 59 | command).
60 |
61 | 62 |
63 | 70 |

71 | Last update: 15-07-2002
72 | Valid XHTML 1.1 73 |

74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/aiplayer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | Adding computer-controlled players 10 | 11 | 12 | 13 | 14 |

Adding computer-controlled players

15 | 16 |

Multiplayer games of dopewars can be made a little more interesting by 17 | introducing computer-controlled, or AI, players. These players will join 18 | a dopewars server, and to all intents and purposes will behave like normal 19 | human players - they will deal in drugs in an attempt to make a fortune, 20 | they will encounter the cops, you can spy on them, and they will shoot at 21 | you if you give them the chance!

22 | 23 |

To start a computer-controlled player, all you need is the standard dopewars 24 | binary. Run it as
25 | dopewars -c
26 | and it will attempt to connect to the server and port specified in the 27 | configuration files (or the local host, if none 28 | is specified). Alternatively, you can specify server and port with suitable 29 | command line options. Since an AI player 30 | takes its game settings from the server it connects to, no other options in 31 | the configuration files will take effect, with the exception of the 32 | AITurnPause option, which sets the 33 | pause in seconds between turns.

34 | 35 |

Once started and connected to the server, the AI player will choose a 36 | suitable name for itself and start playing. It will continue to play until 37 | its game finishes - i.e. it is killed or runs out of time - at which point 38 | the program will finish and drop you back to the command prompt. The program 39 | will display information to let you know what the AI player is doing within 40 | the game as it goes. Note that the program will pause for five seconds (or 41 | whatever you have set AITurnPause to be) before jetting to a new location - 42 | this is to simulate the time it takes a human player to choose which drugs 43 | to buy and to press all the requisite keys; it also gives other players a 44 | fighting chance of spotting the computer sitting still in any one location 45 | for a few seconds!

46 | 47 |

If a computer player is attacked by the cops or another player, it will 48 | defend itself if it can, and attempt to run if necessary. During normal 49 | play it will also attempt to "blend in" with the other players by hurling 50 | rather pathetic insults at them... you are free to 51 | edit 52 | the code of the AI player to give these insults a little more "punch".

53 | 54 |
55 | 58 |

59 | Last update: 05-12-2020
60 | Valid XHTML 1.1 61 |

62 | 63 | 64 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * util.h Miscellaneous utility and portability functions * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_UTIL_H__ 24 | #define __DP_UTIL_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | #ifdef CYGWIN /* Definitions for native Win32 build */ 33 | #include 34 | #include 35 | #include 36 | 37 | #define SIGWINCH 0 38 | #define SIGPIPE 0 39 | #define SIG_BLOCK 0 40 | #define SIG_UNBLOCK 0 41 | 42 | struct sigaction { 43 | void *sa_handler; 44 | int sa_flags; 45 | int sa_mask; 46 | }; 47 | 48 | void sigemptyset(int *mask); 49 | void sigaddset(int *mask, int sig); 50 | int sigaction(int sig, struct sigaction *sact, char *pt); 51 | void sigprocmask(int flag, int *mask, char *pt); 52 | int bselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfs, 53 | struct timeval *tm); 54 | #else /* Definitions for Unix build */ 55 | #define bselect select 56 | #endif /* CYGWIN */ 57 | 58 | #ifndef HAVE_GETOPT 59 | int getopt(int argc, char *const argv[], const char *str); 60 | extern char *optarg; 61 | #endif 62 | 63 | void MicroSleep(int microsec); 64 | 65 | int ReadLock(FILE *fp); 66 | int WriteLock(FILE *fp); 67 | void ReleaseLock(FILE *fp); 68 | 69 | /* Now make definitions if they haven't been done properly */ 70 | #ifndef WEXITSTATUS 71 | #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) 72 | #endif 73 | 74 | #ifndef WIFEXITED 75 | #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) 76 | #endif 77 | 78 | #endif /* __DP_UTIL_H__ */ 79 | -------------------------------------------------------------------------------- /m4/progtest.m4: -------------------------------------------------------------------------------- 1 | # progtest.m4 serial 8 (gettext-0.20.2) 2 | dnl Copyright (C) 1996-2003, 2005, 2008-2020 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This file can be used in projects which are not available under 8 | dnl the GNU General Public License or the GNU Lesser General Public 9 | dnl License but which still want to provide support for the GNU gettext 10 | dnl functionality. 11 | dnl Please note that the actual code of the GNU gettext library is covered 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU 13 | dnl gettext package is covered by the GNU General Public License. 14 | dnl They are *not* in the public domain. 15 | 16 | dnl Authors: 17 | dnl Ulrich Drepper , 1996. 18 | 19 | AC_PREREQ([2.50]) 20 | 21 | # Search path for a program which passes the given test. 22 | 23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], 26 | [ 27 | # Prepare PATH_SEPARATOR. 28 | # The user is always right. 29 | if test "${PATH_SEPARATOR+set}" != set; then 30 | # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which 31 | # contains only /bin. Note that ksh looks also at the FPATH variable, 32 | # so we have to set that as well for the test. 33 | PATH_SEPARATOR=: 34 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 35 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 36 | || PATH_SEPARATOR=';' 37 | } 38 | fi 39 | 40 | # Find out how to test for executable files. Don't use a zero-byte file, 41 | # as systems may use methods other than mode bits to determine executability. 42 | cat >conf$$.file <<_ASEOF 43 | #! /bin/sh 44 | exit 0 45 | _ASEOF 46 | chmod +x conf$$.file 47 | if test -x conf$$.file >/dev/null 2>&1; then 48 | ac_executable_p="test -x" 49 | else 50 | ac_executable_p="test -f" 51 | fi 52 | rm -f conf$$.file 53 | 54 | # Extract the first word of "$2", so it can be a program name with args. 55 | set dummy $2; ac_word=[$]2 56 | AC_MSG_CHECKING([for $ac_word]) 57 | AC_CACHE_VAL([ac_cv_path_$1], 58 | [case "[$]$1" in 59 | [[\\/]]* | ?:[[\\/]]*) 60 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 61 | ;; 62 | *) 63 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR 64 | for ac_dir in ifelse([$5], , $PATH, [$5]); do 65 | IFS="$ac_save_IFS" 66 | test -z "$ac_dir" && ac_dir=. 67 | for ac_exec_ext in '' $ac_executable_extensions; do 68 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then 69 | echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD 70 | if [$3]; then 71 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" 72 | break 2 73 | fi 74 | fi 75 | done 76 | done 77 | IFS="$ac_save_IFS" 78 | dnl If no 4th arg is given, leave the cache variable unset, 79 | dnl so AC_PATH_PROGS will keep looking. 80 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 81 | ])dnl 82 | ;; 83 | esac])dnl 84 | $1="$ac_cv_path_$1" 85 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 86 | AC_MSG_RESULT([$][$1]) 87 | else 88 | AC_MSG_RESULT([no]) 89 | fi 90 | AC_SUBST([$1])dnl 91 | ]) 92 | -------------------------------------------------------------------------------- /m4/intlmacosx.m4: -------------------------------------------------------------------------------- 1 | # intlmacosx.m4 serial 8 (gettext-0.20.2) 2 | dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This file can be used in projects which are not available under 8 | dnl the GNU General Public License or the GNU Lesser General Public 9 | dnl License but which still want to provide support for the GNU gettext 10 | dnl functionality. 11 | dnl Please note that the actual code of the GNU gettext library is covered 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU 13 | dnl gettext package is covered by the GNU General Public License. 14 | dnl They are *not* in the public domain. 15 | 16 | dnl Checks for special options needed on Mac OS X. 17 | dnl Defines INTL_MACOSX_LIBS. 18 | AC_DEFUN([gt_INTL_MACOSX], 19 | [ 20 | dnl Check for API introduced in Mac OS X 10.4. 21 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], 22 | [gt_cv_func_CFPreferencesCopyAppValue], 23 | [gt_save_LIBS="$LIBS" 24 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 25 | AC_LINK_IFELSE( 26 | [AC_LANG_PROGRAM( 27 | [[#include ]], 28 | [[CFPreferencesCopyAppValue(NULL, NULL)]])], 29 | [gt_cv_func_CFPreferencesCopyAppValue=yes], 30 | [gt_cv_func_CFPreferencesCopyAppValue=no]) 31 | LIBS="$gt_save_LIBS"]) 32 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then 33 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], 34 | [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) 35 | fi 36 | dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, 37 | dnl because in macOS 10.13.4 it has the following behaviour: 38 | dnl When two or more languages are specified in the 39 | dnl "System Preferences > Language & Region > Preferred Languages" panel, 40 | dnl it returns en_CC where CC is the territory (even when English is not among 41 | dnl the preferred languages!). What we want instead is what 42 | dnl CFLocaleCopyCurrent returned in earlier macOS releases and what 43 | dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the 44 | dnl first among the preferred languages and CC is the territory. 45 | AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], 46 | [gt_save_LIBS="$LIBS" 47 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 48 | AC_LINK_IFELSE( 49 | [AC_LANG_PROGRAM( 50 | [[#include ]], 51 | [[CFLocaleCopyPreferredLanguages();]])], 52 | [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], 53 | [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) 54 | LIBS="$gt_save_LIBS"]) 55 | if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then 56 | AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], 57 | [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) 58 | fi 59 | INTL_MACOSX_LIBS= 60 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ 61 | || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then 62 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" 63 | fi 64 | AC_SUBST([INTL_MACOSX_LIBS]) 65 | ]) 66 | -------------------------------------------------------------------------------- /doc/contribute.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | How to contribute 10 | 11 | 12 | 13 | 14 |

How to contribute

15 | 16 |

dopewars is open-source software, meaning that it is free for anybody to 17 | use. However, this also means that the quality of the software is dependent 18 | in part on you the user. You don't have to be a programmer to 19 | help out - in fact, dopewars currently needs people to produce sounds and 20 | graphics rather than to write code.

21 | 22 |
    23 |
  • Sounds are needed. dopewars-1.5.7 and later support sounds, but 24 | don't contain sounds for every game event. If you can provide 25 | copyright-free sounds, then short files are needed for various effects 26 | in the game. For example, 27 | gunshots, bullet hits, ricochets and subway trains are obvious candidates 28 | for sound effects, although pretty much any event in the game that you can 29 | think of can conceivably have a sound (e.g. when players join or leave the 30 | game). These sounds should be in WAV format, and should probably be no more 31 | than a second or two in length. Later versions of dopewars may also be able 32 | to play longer repeating sounds (i.e. music) if you're interested in 33 | contributing this. Please open a 34 | pull request 35 | to add sound files to dopewars. 36 |

  • 37 | 38 |
  • Suggestions for future improvements are always welcomed at the 39 | issue tracker. 40 | These can be anything from "the game interface 41 | is confusing" through "more game locations are needed" to "what about a 42 | hospital". (I can't guarantee that such suggestions will ever make it 43 | into dopewars, but it's a lot easier if I know they exist! Also, it's 44 | far more likely to happen if you write the code - see the 45 | tips for developers page.)

  • 46 | 47 |
  • Bug reports are always useful. Register them with the 48 | issue tracker. 49 | If I don't know the problem exists, I can't fix it... 50 | The more information you can give here, the better. In particular, I need 51 | to know your operating system - e.g. Linux or Windows. For Linux, gdb stack 52 | traces of the core file are most useful.

  • 53 | 54 |
  • Configuration files can be included in future distributions. If 55 | you run a customised game, and think others might want to play with your 56 | configuration, or at least use it as an example, then post it in the 57 | issue tracker. 58 |

  • 59 | 60 |
  • Translation of dopewars into your language will enable you to 61 | play the game in your native tongue, and will also help others that speak 62 | the same language. It's pretty easy, too - all you have to do is edit a 63 | simple text file! See the i18n pages.

  • 64 |
65 | 66 |
67 | 70 |

71 | Last update: 05-12-2020
72 | Valid XHTML 1.1 73 |

74 | 75 | 76 | -------------------------------------------------------------------------------- /src/plugins/sound_esd.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_esd.c dopewars sound system (ESD/esound driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #ifdef HAVE_ESD 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "../sound.h" 33 | 34 | #define MAXCACHE 6 35 | 36 | struct SoundCache { 37 | int esdid; 38 | gchar *name; 39 | } cache[MAXCACHE]; 40 | 41 | 42 | static int sock, nextcache; 43 | 44 | static gboolean SoundOpen_ESD(void) 45 | { 46 | int i; 47 | 48 | sock = esd_open_sound(NULL); 49 | for (i = 0; i < MAXCACHE; i++) { 50 | cache[i].esdid = -1; 51 | cache[i].name = NULL; 52 | } 53 | nextcache = 0; 54 | return TRUE; 55 | } 56 | 57 | static void SoundClose_ESD(void) 58 | { 59 | int i; 60 | 61 | for (i = 0; i < MAXCACHE; i++) { 62 | g_free(cache[i].name); 63 | if (cache[i].esdid != -1) { 64 | esd_sample_free(sock, cache[i].esdid); 65 | } 66 | } 67 | esd_close(sock); 68 | } 69 | 70 | static void SoundPlay_ESD(const gchar *snd) 71 | { 72 | int i; 73 | 74 | for (i = 0; i < MAXCACHE; i++) { 75 | if (cache[i].name && strcmp(cache[i].name, snd) == 0) { 76 | esd_sample_play(sock, cache[i].esdid); 77 | return; 78 | } 79 | } 80 | 81 | if (cache[nextcache].esdid != -1) { 82 | esd_sample_free(sock, cache[nextcache].esdid); 83 | g_free(cache[nextcache].name); 84 | } 85 | cache[nextcache].esdid = esd_file_cache(sock, PACKAGE, snd); 86 | cache[nextcache].name = g_strdup(snd); 87 | esd_sample_play(sock, cache[nextcache].esdid); 88 | nextcache = (nextcache + 1) % MAXCACHE; 89 | } 90 | 91 | SoundDriver *sound_esd_init(void) 92 | { 93 | static SoundDriver driver; 94 | 95 | driver.name = "esd"; 96 | driver.open = SoundOpen_ESD; 97 | driver.close = SoundClose_ESD; 98 | driver.play = SoundPlay_ESD; 99 | return &driver; 100 | } 101 | 102 | #endif /* HAVE_ESD */ 103 | -------------------------------------------------------------------------------- /src/gtkport/unicodewrap.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * unicodewrap.h Unicode wrapper functions for Win32 * 3 | * Copyright (C) 2002-2004 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __UNICODEWRAP_H__ 24 | #define __UNICODEWRAP_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #ifdef CYGWIN 31 | #include 32 | #include 33 | #include 34 | 35 | BOOL mySetWindowText(HWND hWnd, LPCTSTR lpString); 36 | HWND myCreateWindow(LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, 37 | int x, int y, int nWidth, int nHeight, HWND hwndParent, 38 | HMENU hMenu, HANDLE hInstance, LPVOID lpParam); 39 | HWND myCreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, 40 | LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, 41 | int nWidth, int nHeight, HWND hwndParent, HMENU hMenu, 42 | HANDLE hInstance, LPVOID lpParam); 43 | gchar *myGetWindowText(HWND hWnd); 44 | int myDrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, 45 | UINT uFormat); 46 | BOOL WINAPI mySetMenuItemInfo(HMENU hMenu, UINT uItem, BOOL fByPosition, 47 | LPMENUITEMINFO lpmii); 48 | BOOL WINAPI myInsertMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, 49 | LPMENUITEMINFO lpmii); 50 | int myHeader_InsertItem(HWND hWnd, int index, const HD_ITEM *phdi); 51 | int myTabCtrl_InsertItem(HWND hWnd, int index, const TC_ITEM *pitem); 52 | ATOM myRegisterClass(CONST WNDCLASS *lpWndClass); 53 | HWND myCreateDialog(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndParent, 54 | DLGPROC lpDialogFunc); 55 | void myEditReplaceSel(HWND hWnd, BOOL fCanUndo, LPCSTR lParam); 56 | int myMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType); 57 | size_t myw32strlen(const char *str); 58 | LRESULT myComboBox_AddString(HWND hWnd, LPCTSTR text); 59 | gchar *w32tostr(const gunichar2 *instr, int len); 60 | gunichar2 *strtow32(const char *instr, int len); 61 | 62 | #endif /* CYGWIN */ 63 | 64 | #endif /* __UNICODEWRAP_H__ */ 65 | -------------------------------------------------------------------------------- /src/serverside.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * serverside.h Server-side parts of dopewars * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __DP_SERVERSIDE_H__ 24 | #define __DP_SERVERSIDE_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "dopewars.h" 31 | 32 | extern GSList *FirstServer; 33 | extern char *PidFile; 34 | 35 | void CleanUpServer(void); 36 | void BreakHandle(int sig); 37 | void ClientLeftServer(Player *Play); 38 | void StopServer(void); 39 | Player *HandleNewConnection(void); 40 | void ServerLoop(struct CMDLINE *cmdline); 41 | void HandleServerPlayer(Player *Play); 42 | void HandleServerMessage(gchar *buf, Player *ReallyFrom); 43 | void FinishGame(Player *Play, char *Message); 44 | void SendHighScores(Player *Play, gboolean EndGame, char *Message); 45 | void SendEvent(Player *To); 46 | void SendDrugsHere(Player *To, gboolean DisplayBusts); 47 | void BuyObject(Player *From, char *data); 48 | int RandomOffer(Player *To); 49 | void HandleAnswer(Player *From, Player *To, char *answer); 50 | void ClearPrices(Player *Play); 51 | int LoseBitch(Player *Play, Inventory *Guns, Inventory *Drugs); 52 | void GainBitch(Player *Play); 53 | void SetFightTimeout(Player *Play); 54 | void ClearFightTimeout(Player *Play); 55 | long GetMinimumTimeout(GSList *First); 56 | GSList *HandleTimeouts(GSList *First); 57 | void ConvertHighScoreFile(const gchar *convertfile); 58 | void OpenHighScoreFile(void); 59 | gboolean CheckHighScoreFileConfig(void); 60 | void CloseHighScoreFile(void); 61 | gboolean HighScoreRead(FILE *fp, struct HISCORE *MultiScore, 62 | struct HISCORE *AntiqueScore, gboolean ReadHeader); 63 | void CopsAttackPlayer(Player *Play); 64 | void AttackPlayer(Player *Play, Player *Attacked); 65 | gboolean IsOpponent(Player *Play, Player *Other); 66 | void Fire(Player *Play); 67 | void WithdrawFromCombat(Player *Play); 68 | void RunFromCombat(Player *Play, int ToLocation); 69 | gboolean CanPlayerFire(Player *Play); 70 | gboolean CanRunHere(Player *Play); 71 | Player *GetNextShooter(Player *Play); 72 | void DropPrivileges(void); 73 | 74 | #ifdef GUI_SERVER 75 | void GuiServerLoop(struct CMDLINE *cmdline, gboolean is_service); 76 | #ifdef CYGWIN 77 | void ServiceMain(struct CMDLINE *cmdline); 78 | #endif 79 | #endif 80 | #ifndef CYGWIN 81 | gchar *GetLocalSocket(void); 82 | #endif 83 | 84 | #endif /* __DP_SERVERSIDE_H__ */ 85 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | # 3 | # Copyright (C) 2003-2019 Free Software Foundation, Inc. 4 | # This file is free software; the Free Software Foundation gives 5 | # unlimited permission to use, copy, distribute, and modify it. 6 | 7 | # Usually the message domain is the same as the package name. 8 | DOMAIN = $(PACKAGE) 9 | 10 | # These two variables depend on the location of this directory. 11 | subdir = po 12 | top_builddir = .. 13 | 14 | # These options get passed to xgettext. 15 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --add-comments 16 | 17 | # This is the copyright holder that gets inserted into the header of the 18 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 19 | # package. (Note that the msgstr strings, extracted from the package's 20 | # sources, belong to the copyright holder of the package.) Translators are 21 | # expected to transfer the copyright for their translations to this person 22 | # or entity, or to disclaim their copyright. The empty string stands for 23 | # the public domain; in this case the translators are expected to disclaim 24 | # their copyright. 25 | COPYRIGHT_HOLDER = Ben Webb 26 | 27 | # This tells whether or not to prepend "GNU " prefix to the package 28 | # name that gets inserted into the header of the $(DOMAIN).pot file. 29 | # Possible values are "yes", "no", or empty. If it is empty, try to 30 | # detect it automatically by scanning the files in $(top_srcdir) for 31 | # "GNU packagename" string. 32 | PACKAGE_GNU = 33 | 34 | # This is the email address or URL to which the translators shall report 35 | # bugs in the untranslated strings: 36 | # - Strings which are not entire sentences, see the maintainer guidelines 37 | # in the GNU gettext documentation, section 'Preparing Strings'. 38 | # - Strings which use unclear terms or require additional context to be 39 | # understood. 40 | # - Strings which make invalid assumptions about notation of date, time or 41 | # money. 42 | # - Pluralisation problems. 43 | # - Incorrect English spelling. 44 | # - Incorrect formatting. 45 | # It can be your email address, or a mailing list address where translators 46 | # can write to without being subscribed, or the URL of a web page through 47 | # which the translators can contact you. 48 | MSGID_BUGS_ADDRESS = benwebb@users.sf.net 49 | 50 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 51 | # message catalogs shall be used. It is usually empty. 52 | EXTRA_LOCALE_CATEGORIES = 53 | 54 | # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' 55 | # context. Possible values are "yes" and "no". Set this to yes if the 56 | # package uses functions taking also a message context, like pgettext(), or 57 | # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. 58 | USE_MSGCTXT = no 59 | 60 | # These options get passed to msgmerge. 61 | # Useful options are in particular: 62 | # --previous to keep previous msgids of translated messages, 63 | # --quiet to reduce the verbosity. 64 | MSGMERGE_OPTIONS = 65 | 66 | # These options get passed to msginit. 67 | # If you want to disable line wrapping when writing PO files, add 68 | # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and 69 | # MSGINIT_OPTIONS. 70 | MSGINIT_OPTIONS = 71 | 72 | # This tells whether or not to regenerate a PO file when $(DOMAIN).pot 73 | # has changed. Possible values are "yes" and "no". Set this to no if 74 | # the POT file is checked in the repository and the version control 75 | # program ignores timestamps. 76 | PO_DEPENDS_ON_POT = no 77 | 78 | # This tells whether or not to forcibly update $(DOMAIN).pot and 79 | # regenerate PO files on "make dist". Possible values are "yes" and 80 | # "no". Set this to no if the POT file and PO files are maintained 81 | # externally. 82 | DIST_DEPENDS_ON_UPDATE_PO = no 83 | -------------------------------------------------------------------------------- /src/plugins/sound_sdl.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * sound_sdl.c dopewars sound system (SDL driver) * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #ifdef HAVE_SDL_MIXER 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include "../sound.h" 34 | 35 | struct ChannelStruct { 36 | Mix_Chunk *chunk; 37 | gchar *name; 38 | } channel[MIX_CHANNELS]; 39 | 40 | static gboolean SoundOpen_SDL(void) 41 | { 42 | const int audio_rate = MIX_DEFAULT_FREQUENCY; 43 | const int audio_format = MIX_DEFAULT_FORMAT; 44 | const int audio_channels = 2; 45 | int i; 46 | 47 | if (SDL_Init(SDL_INIT_AUDIO) < 0) { 48 | return FALSE; 49 | } 50 | 51 | if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) < 0) { 52 | SDL_Quit(); 53 | return FALSE; 54 | } 55 | Mix_AllocateChannels(MIX_CHANNELS); 56 | 57 | for (i = 0; i < MIX_CHANNELS; i++) { 58 | channel[i].chunk = NULL; 59 | channel[i].name = NULL; 60 | } 61 | return TRUE; 62 | } 63 | 64 | static void SoundClose_SDL(void) 65 | { 66 | int i; 67 | 68 | for (i = 0; i < MIX_CHANNELS; i++) { 69 | g_free(channel[i].name); 70 | if (channel[i].chunk) { 71 | Mix_FreeChunk(channel[i].chunk); 72 | } 73 | } 74 | Mix_CloseAudio(); 75 | SDL_Quit(); 76 | } 77 | 78 | static void SoundPlay_SDL(const gchar *snd) 79 | { 80 | int i, chan_num; 81 | Mix_Chunk *chunk; 82 | 83 | for (i = 0; i < MIX_CHANNELS; i++) { 84 | if (channel[i].name && strcmp(channel[i].name, snd) == 0) { 85 | Mix_PlayChannel(-1, channel[i].chunk, 0); 86 | return; 87 | } 88 | } 89 | 90 | chunk = Mix_LoadWAV(snd); 91 | if (!chunk) { 92 | return; 93 | } 94 | 95 | chan_num = Mix_PlayChannel(-1, chunk, 0); 96 | if (chan_num < 0) { 97 | Mix_FreeChunk(chunk); 98 | return; 99 | } 100 | 101 | if (channel[chan_num].chunk) { 102 | Mix_FreeChunk(channel[chan_num].chunk); 103 | g_free(channel[chan_num].name); 104 | } 105 | 106 | channel[chan_num].chunk = chunk; 107 | channel[chan_num].name = g_strdup(snd); 108 | } 109 | 110 | SoundDriver *sound_sdl_init(void) 111 | { 112 | static SoundDriver driver; 113 | 114 | driver.name = "sdl"; 115 | driver.open = SoundOpen_SDL; 116 | driver.close = SoundClose_SDL; 117 | driver.play = SoundPlay_SDL; 118 | return &driver; 119 | } 120 | 121 | #endif /* HAVE_SDL_MIXER */ 122 | -------------------------------------------------------------------------------- /rpm/dopewars.spec.in: -------------------------------------------------------------------------------- 1 | Summary: Drug dealing game 2 | Name: @PACKAGE@ 3 | Version: @VERSION@ 4 | Release: 1%{?dist} 5 | Vendor: Ben Webb 6 | URL: https://dopewars.sourceforge.io/ 7 | License: GPL 8 | Group: Amusements/Games 9 | Source0: %{name}-%{version}.tar.gz 10 | BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n) 11 | BuildRequires: SDL2_mixer-devel SDL2-devel glib2-devel gcc libcurl-devel 12 | BuildRequires: gtk3-devel ncurses-devel gettext-devel 13 | 14 | %description 15 | Based on John E. Dell's old Drug Wars game, dopewars is a simulation of an 16 | imaginary drug market. dopewars is an All-American game which features 17 | buying, selling, and trying to get past the cops! 18 | 19 | The first thing you need to do is pay off your debt to the Loan Shark. After 20 | that, your goal is to make as much money as possible (and stay alive)! You 21 | have one month of game time to make your fortune. 22 | 23 | dopewars supports multiple players via. TCP/IP. Chatting to and fighting 24 | with other players (computer or human) is supported; check the command line 25 | switches (via dopewars -h) for further information. 26 | 27 | %package sdl 28 | Summary: dopewars SDL_mixer sound plugin 29 | Group: Amusements/Games 30 | Requires: %{name} 31 | %description sdl 32 | This package adds a plugin to dopewars to allow sound to be output via. 33 | the Simple DirectMedia Layer mixer (SDL2 and SDL_mixer). 34 | 35 | %prep 36 | %setup 37 | 38 | %build 39 | %define _localstatedir /var/lib/games 40 | %configure --with-sdl 41 | make 42 | 43 | %install 44 | make install DESTDIR=${RPM_BUILD_ROOT} 45 | %find_lang %{name} 46 | 47 | %clean 48 | test "$RPM_BUILD_ROOT" != "/" && rm -rf ${RPM_BUILD_ROOT} 49 | 50 | %post 51 | %{_bindir}/dopewars -C %{_localstatedir}/dopewars.sco 52 | 53 | %files -f %{name}.lang 54 | %defattr(-,root,root) 55 | %doc ChangeLog.md LICENCE README.md 56 | %doc %{_docdir}/%{name} 57 | %attr(2755,root,games) %{_bindir}/dopewars 58 | %attr(0660,root,games) %config %{_localstatedir}/dopewars.sco 59 | %{_mandir}/man6/dopewars.6.gz 60 | %{_datadir}/gnome/apps/Games/dopewars.desktop 61 | %{_datadir}/pixmaps/dopewars-pill.png 62 | %{_datadir}/pixmaps/dopewars-weed.png 63 | %{_datadir}/pixmaps/dopewars-shot.png 64 | %dir %{_datadir}/dopewars/ 65 | %{_datadir}/dopewars/bye.wav 66 | %{_datadir}/dopewars/colt.wav 67 | %{_datadir}/dopewars/die.wav 68 | %{_datadir}/dopewars/gun.wav 69 | %{_datadir}/dopewars/jet.wav 70 | %{_datadir}/dopewars/losebitch.wav 71 | %{_datadir}/dopewars/message.wav 72 | %{_datadir}/dopewars/murmur.wav 73 | %{_datadir}/dopewars/punch.wav 74 | %{_datadir}/dopewars/run.wav 75 | %{_datadir}/dopewars/shotdown.wav 76 | %{_datadir}/dopewars/train.wav 77 | 78 | %files sdl 79 | %defattr(-,root,root) 80 | %{_libdir}/dopewars/libsound_sdl.so 81 | 82 | %changelog 83 | * Wed Dec 02 2020 Ben Webb 84 | - Build with SDL2 rather than SDL 1. 85 | 86 | * Mon Jul 28 2003 Ben Webb 87 | - High score file moved to /var/lib/games for consistency with 88 | other packages 89 | 90 | * Mon Oct 21 2002 Ben Webb 91 | - Dependency on SDL-devel added to properly build SDL plugin 92 | 93 | * Fri Oct 18 2002 Ben Webb 94 | - ESD plugin incorporated into main package 95 | - Sound files added to distribution 96 | 97 | * Fri Jun 21 2002 Ben Webb 98 | - Description typos corrected 99 | - A lot of hardcoded texts replaced with %{name} etc. 100 | - Redundant make arguments removed 101 | 102 | * Mon May 13 2002 Ben Webb 103 | - SDL and ESD plugin subpackages added 104 | 105 | * Sun Feb 03 2002 Ben Webb 106 | - Use of %attr tidied up 107 | - Rebuild with new version 108 | 109 | * Wed Oct 17 2001 Ben Webb 110 | - Added in %attrs to allow building by non-root users 111 | 112 | * Wed Sep 26 2001 Ben Webb 113 | - Added support for a buildroot 114 | -------------------------------------------------------------------------------- /src/cursesport/cursesport.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * cursesport.h Portability functions to enable curses applications * 3 | * to be built on Win32 systems * 4 | * Copyright (C) 1998-2022 Ben Webb * 5 | * Email: benwebb@users.sf.net * 6 | * WWW: https://dopewars.sourceforge.io/ * 7 | * * 8 | * This program is free software; you can redistribute it and/or * 9 | * modify it under the terms of the GNU General Public License * 10 | * as published by the Free Software Foundation; either version 2 * 11 | * of the License, or (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, write to the Free Software * 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 21 | * MA 02111-1307, USA. * 22 | ************************************************************************/ 23 | 24 | #ifndef __CURSESPORT_H__ 25 | #define __CURSESPORT_H__ 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include 29 | #endif 30 | 31 | #include 32 | 33 | #ifdef CYGWIN /* Definitions for native Win32 build */ 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | extern int COLS, LINES; 42 | 43 | #define COLOR_MAGENTA 1 44 | #define COLOR_BLACK 2 45 | #define COLOR_WHITE 3 46 | #define COLOR_BLUE 4 47 | #define COLOR_RED 5 48 | 49 | #define COLOR_PAIR(i) ((i) << 16) 50 | 51 | #define ACS_VLINE 0x2502 52 | #define ACS_ULCORNER 0x250c 53 | #define ACS_HLINE 0x2500 54 | #define ACS_URCORNER 0x2510 55 | #define ACS_TTEE 0x252c 56 | #define ACS_LLCORNER 0x2514 57 | #define ACS_LRCORNER 0x2518 58 | #define ACS_BTEE 0x2534 59 | #define ACS_LTEE 0x251c 60 | #define ACS_RTEE 0x2524 61 | 62 | typedef int SCREEN; 63 | 64 | #define stdscr 0 65 | #define curscr 0 66 | #define KEY_ENTER 13 67 | #define KEY_BACKSPACE 8 68 | #define A_BOLD 0 69 | 70 | SCREEN *newterm(void *, void *, void *); 71 | void refresh(void); 72 | #define wrefresh(win) refresh() 73 | void start_color(void); 74 | void init_pair(int index, WORD fg, WORD bg); 75 | void cbreak(void); 76 | void noecho(void); 77 | void nodelay(void *, char); 78 | void keypad(void *, char); 79 | void curs_set(BOOL visible); 80 | void endwin(void); 81 | void move(int y, int x); 82 | void attrset(int newAttr); 83 | void addstr(const char *str); 84 | void addch(unsigned ch); 85 | void mvaddstr(int x, int y, const char *str); 86 | void mvaddch(int x, int y, int ch); 87 | 88 | #define erase() clear_screen() 89 | 90 | void standout(void); 91 | void standend(void); 92 | void endwin(void); 93 | 94 | #else /* Definitions for Unix build */ 95 | #include 96 | 97 | /* Include a suitable curses-type library */ 98 | #if defined HAVE_NCURSESW_CURSES_H 99 | # include 100 | #elif defined HAVE_NCURSESW_H 101 | # include 102 | #elif defined HAVE_NCURSES_CURSES_H 103 | # include 104 | #elif defined HAVE_NCURSES_H 105 | # include 106 | #elif defined HAVE_CURSES_H 107 | # include 108 | #elif HAVE_LIBCUR_COLR 109 | # include 110 | #endif 111 | 112 | #endif /* CYGWIN */ 113 | 114 | gunichar bgetch(void); 115 | 116 | #endif /* __CURSESPORT_H__ */ 117 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the 'mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because '.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-time-zone: "UTC" 161 | # time-stamp-end: "; # UTC" 162 | # End: 163 | -------------------------------------------------------------------------------- /src/gtkport/gtkenums.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * gtkenums.h Enumerated types for gtkport code * 3 | * Copyright (C) 2002-2004 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __GTKENUMS_H__ 24 | #define __GTKENUMS_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #ifdef CYGWIN 31 | 32 | typedef enum { 33 | GTK_WINDOW_TOPLEVEL, GTK_WINDOW_DIALOG, GTK_WINDOW_POPUP 34 | } GtkWindowType; 35 | 36 | typedef enum { 37 | GTK_ACCEL_VISIBLE = 1 << 0, 38 | GTK_ACCEL_SIGNAL_VISIBLE = 1 << 1 39 | } GtkAccelFlags; 40 | 41 | typedef enum { 42 | GTK_BUTTONBOX_SPREAD, 43 | GTK_BUTTONBOX_EDGE, 44 | GTK_BUTTONBOX_START, 45 | GTK_BUTTONBOX_END 46 | } GtkButtonBoxStyle; 47 | 48 | typedef enum { 49 | GTK_STATE_NORMAL, 50 | GTK_STATE_ACTIVE, 51 | GTK_STATE_PRELIGHT, 52 | GTK_STATE_SELECTED, 53 | GTK_STATE_INSENSITIVE 54 | } GtkStateType; 55 | 56 | typedef enum { 57 | GTK_VISIBILITY_NONE, 58 | GTK_VISIBILITY_PARTIAL, 59 | GTK_VISIBILITY_FULL 60 | } GtkVisibility; 61 | 62 | typedef enum { 63 | GTK_PROGRESS_LEFT_TO_RIGHT, 64 | GTK_PROGRESS_RIGHT_TO_LEFT, 65 | GTK_PROGRESS_BOTTOM_TO_TOP, 66 | GTK_PROGRESS_TOP_TO_BOTTOM 67 | } GtkProgressBarOrientation; 68 | 69 | typedef enum { 70 | GTK_EXPAND = 1 << 0, 71 | GTK_SHRINK = 1 << 1, 72 | GTK_FILL = 1 << 2 73 | } GtkAttachOptions; 74 | 75 | typedef enum { 76 | GTK_SELECTION_SINGLE, 77 | GTK_SELECTION_BROWSE, 78 | GTK_SELECTION_MULTIPLE, 79 | GTK_SELECTION_EXTENDED 80 | } GtkSelectionMode; 81 | 82 | typedef enum { 83 | GTK_SHADOW_NONE, 84 | GTK_SHADOW_IN, 85 | GTK_SHADOW_OUT, 86 | GTK_SHADOW_ETCHED_IN, 87 | GTK_SHADOW_ETCHED_OUT 88 | } GtkShadowType; 89 | 90 | typedef enum { 91 | GTK_JUSTIFY_LEFT, 92 | GTK_JUSTIFY_RIGHT, 93 | GTK_JUSTIFY_CENTER, 94 | GTK_JUSTIFY_FILL 95 | } GtkJustification; 96 | 97 | typedef enum { 98 | GTK_REALIZED = 1 << 6, 99 | GTK_VISIBLE = 1 << 8, 100 | GTK_SENSITIVE = 1 << 10, 101 | GTK_CAN_FOCUS = 1 << 11, 102 | GTK_HAS_FOCUS = 1 << 12, 103 | GTK_CAN_DEFAULT = 1 << 13, 104 | GTK_IS_DEFAULT = 1 << 14 105 | } GtkWidgetFlags; 106 | 107 | typedef enum 108 | { 109 | GDK_WINDOW_TYPE_HINT_NORMAL, 110 | GDK_WINDOW_TYPE_HINT_DIALOG, 111 | GDK_WINDOW_TYPE_HINT_MENU, 112 | GDK_WINDOW_TYPE_HINT_TOOLBAR 113 | } GdkWindowTypeHint; 114 | 115 | typedef enum 116 | { 117 | GTK_WIN_POS_NONE, 118 | GTK_WIN_POS_CENTER, 119 | GTK_WIN_POS_MOUSE, 120 | GTK_WIN_POS_CENTER_ALWAYS, 121 | GTK_WIN_POS_CENTER_ON_PARENT 122 | } GtkWindowPosition; 123 | 124 | typedef enum 125 | { 126 | GTK_ORIENTATION_HORIZONTAL, 127 | GTK_ORIENTATION_VERTICAL 128 | } GtkOrientation; 129 | 130 | typedef enum 131 | { 132 | GTK_SORT_ASCENDING, 133 | GTK_SORT_DESCENDING 134 | } GtkSortType; 135 | 136 | enum 137 | { 138 | G_TYPE_STRING, 139 | G_TYPE_UINT, 140 | G_TYPE_INT, 141 | G_TYPE_POINTER 142 | }; 143 | 144 | #endif /* CYGWIN */ 145 | 146 | #endif /* __GTKENUMS_H__ */ 147 | -------------------------------------------------------------------------------- /src/convert.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * convert.c Codeset conversion functions * 3 | * Copyright (C) 2002-2004 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | # include 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | #include "convert.h" 31 | 32 | static gchar *int_codeset = NULL; 33 | 34 | static const gchar *FixedCodeset(const gchar *codeset) 35 | { 36 | if (strcmp(codeset, "ANSI_X3.4-1968") == 0 37 | || strcmp(codeset, "ASCII") == 0) { 38 | return "ISO-8859-1"; 39 | } else { 40 | return codeset; 41 | } 42 | } 43 | 44 | void Conv_SetInternalCodeset(const gchar *codeset) 45 | { 46 | g_free(int_codeset); 47 | int_codeset = g_strdup(FixedCodeset(codeset)); 48 | } 49 | 50 | static const gchar *GetLocaleCodeset(void) 51 | { 52 | const gchar *codeset; 53 | 54 | g_get_charset(&codeset); 55 | return FixedCodeset(codeset); 56 | } 57 | 58 | Converter *Conv_New(void) 59 | { 60 | Converter *conv; 61 | 62 | conv = g_new(Converter, 1); 63 | conv->ext_codeset = g_strdup(GetLocaleCodeset()); 64 | if (!int_codeset) { 65 | int_codeset = g_strdup(GetLocaleCodeset()); 66 | } 67 | return conv; 68 | } 69 | 70 | void Conv_Free(Converter *conv) 71 | { 72 | g_free(conv->ext_codeset); 73 | g_free(conv); 74 | } 75 | 76 | void Conv_SetCodeset(Converter *conv, const gchar *codeset) 77 | { 78 | g_free(conv->ext_codeset); 79 | conv->ext_codeset = g_strdup(FixedCodeset(codeset)); 80 | } 81 | 82 | gboolean Conv_Needed(Converter *conv) 83 | { 84 | return (strcmp(conv->ext_codeset, int_codeset) != 0 85 | || strcmp(int_codeset, "UTF-8") == 0); 86 | } 87 | 88 | static gchar *do_convert(const gchar *from_codeset, const gchar *to_codeset, 89 | const gchar *from_str, int from_len) 90 | { 91 | gchar *to_str; 92 | 93 | if (strcmp(to_codeset, "UTF-8") == 0 && strcmp(from_codeset, "UTF-8") == 0) { 94 | const gchar *start, *end; 95 | 96 | if (from_len == -1) { 97 | to_str = g_strdup(from_str); 98 | } else { 99 | to_str = g_strndup(from_str, from_len); 100 | } 101 | start = to_str; 102 | while (start && *start && !g_utf8_validate(start, -1, &end) 103 | && end && *end) { 104 | *((gchar *)end) = '?'; 105 | start = ++end; 106 | } 107 | return to_str; 108 | } else { 109 | to_str = g_convert_with_fallback(from_str, from_len, to_codeset, 110 | from_codeset, "?", NULL, NULL, NULL); 111 | if (to_str) { 112 | return to_str; 113 | } else { 114 | return g_strdup("[?]"); 115 | } 116 | } 117 | } 118 | 119 | gchar *Conv_ToExternal(Converter *conv, const gchar *int_str, int len) 120 | { 121 | return do_convert(int_codeset, conv->ext_codeset, int_str, len); 122 | } 123 | 124 | gchar *Conv_ToInternal(Converter *conv, const gchar *ext_str, int len) 125 | { 126 | return do_convert(conv->ext_codeset, int_codeset, ext_str, len); 127 | } 128 | -------------------------------------------------------------------------------- /src/log.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * log.c dopewars - logging functions * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #ifdef HAVE_SYSLOG_H 32 | #include 33 | #endif 34 | 35 | #include "dopewars.h" 36 | #include "log.h" 37 | 38 | /* 39 | * General logging function. All messages should be given a loglevel, 40 | * from 0 to 5 (0=vital, 2=normal, 5=maximum debugging output). This 41 | * is essentially just a wrapper around the GLib g_log function. 42 | */ 43 | void dopelog(const int loglevel, const LogFlags flags, 44 | const gchar *format, ...) 45 | { 46 | va_list args; 47 | 48 | /* Don't print server log messages when running standalone */ 49 | if (flags & LF_SERVER && !Network) 50 | return; 51 | 52 | va_start(args, format); 53 | g_logv(G_LOG_DOMAIN, 1 << (loglevel + G_LOG_LEVEL_USER_SHIFT), format, args); 54 | va_end(args); 55 | 56 | #ifdef HAVE_SYSLOG_H 57 | if (loglevel <= Log.Level) { 58 | va_start(args, format); 59 | vsyslog(LOG_INFO, format, args); 60 | va_end(args); 61 | } 62 | #endif 63 | } 64 | 65 | /* 66 | * Returns the bitmask necessary to catch all custom log messages. 67 | */ 68 | GLogLevelFlags LogMask() 69 | { 70 | return ((1 << (MAXLOG)) - 1) << G_LOG_LEVEL_USER_SHIFT; 71 | } 72 | 73 | /* 74 | * Returns the text to be displayed in a log message, if any. 75 | */ 76 | GString *GetLogString(GLogLevelFlags log_level, const gchar *message) 77 | { 78 | GString *text; 79 | gchar TimeBuf[80]; 80 | gint i; 81 | time_t tim; 82 | struct tm *timep; 83 | #ifdef HAVE_LOCALTIME_R 84 | struct tm tmbuf; 85 | #endif 86 | 87 | text = g_string_new(""); 88 | if (Log.Timestamp) { 89 | tim = time(NULL); 90 | #ifdef HAVE_LOCALTIME_R 91 | timep = localtime_r(&tim, &tmbuf); 92 | #else 93 | timep = localtime(&tim); 94 | #endif 95 | strftime(TimeBuf, 80, Log.Timestamp, timep); 96 | TimeBuf[79] = '\0'; 97 | g_string_append(text, TimeBuf); 98 | } 99 | 100 | for (i = 0; i < MAXLOG; i++) 101 | if (log_level & (1 << (G_LOG_LEVEL_USER_SHIFT + i))) { 102 | if (i > Log.Level) { 103 | g_string_free(text, TRUE); 104 | return NULL; 105 | } 106 | g_string_append_printf(text, "%d: ", i); 107 | } 108 | g_string_append(text, message); 109 | return text; 110 | } 111 | 112 | void OpenLog(void) 113 | { 114 | CloseLog(); 115 | #ifdef HAVE_SYSLOG_H 116 | openlog(PACKAGE, LOG_PID, LOG_USER); 117 | #endif 118 | if (Log.File[0] == '\0') 119 | return; 120 | Log.fp = fopen(Log.File, "a"); 121 | if (Log.fp) { 122 | #ifdef SETVBUF_REVERSED /* 2nd and 3rd arguments are reversed on 123 | * some systems */ 124 | setvbuf(Log.fp, _IOLBF, (char *)NULL, 0); 125 | #else 126 | setvbuf(Log.fp, (char *)NULL, _IOLBF, 0); 127 | #endif 128 | } 129 | } 130 | 131 | void CloseLog(void) 132 | { 133 | if (Log.fp) 134 | fclose(Log.fp); 135 | Log.fp = NULL; 136 | } 137 | -------------------------------------------------------------------------------- /src/admin.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * admin.c dopewars server administration * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #if !defined(CYGWIN) && defined(NETWORKING) 28 | #include 29 | #include 30 | #include 31 | #ifdef HAVE_STDLIB_H 32 | #include 33 | #endif 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include "dopewars.h" 40 | #include "network.h" 41 | #include "nls.h" 42 | #include "serverside.h" 43 | 44 | static int OpenSocket(void) 45 | { 46 | struct sockaddr_un addr; 47 | int sock; 48 | gchar *sockname; 49 | 50 | sockname = GetLocalSocket(); 51 | 52 | g_print(_("Attempting to connect to local dopewars server via " 53 | "Unix domain\n socket %s...\n"), sockname); 54 | sock = socket(PF_UNIX, SOCK_STREAM, 0); 55 | if (sock == -1) { 56 | perror("socket"); 57 | exit(EXIT_FAILURE); 58 | } 59 | 60 | addr.sun_family = AF_UNIX; 61 | strncpy(addr.sun_path, sockname, sizeof(addr.sun_path)); 62 | addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; 63 | 64 | if (connect(sock, (struct sockaddr *)&addr, 65 | sizeof(struct sockaddr_un)) == -1) { 66 | perror("connect"); 67 | exit(EXIT_FAILURE); 68 | } 69 | 70 | g_print(_("Connection established; use Ctrl-D to " 71 | "close your session.\n\n")); 72 | g_free(sockname); 73 | 74 | return sock; 75 | } 76 | 77 | void AdminServer(struct CMDLINE *cmdline) 78 | { 79 | int sock, topsock; 80 | NetworkBuffer *netbuf; 81 | fd_set readfds, writefds, errorfds; 82 | gchar *msg, inbuf[200]; 83 | gboolean doneOK; 84 | 85 | InitConfiguration(cmdline); 86 | 87 | sock = OpenSocket(); 88 | netbuf = g_new(NetworkBuffer, 1); 89 | 90 | InitNetworkBuffer(netbuf, '\n', '\r', NULL); 91 | BindNetworkBufferToSocket(netbuf, sock); 92 | 93 | while (1) { 94 | FD_ZERO(&readfds); 95 | FD_ZERO(&writefds); 96 | FD_ZERO(&errorfds); 97 | 98 | FD_SET(0, &readfds); 99 | topsock = 1; 100 | SetSelectForNetworkBuffer(netbuf, &readfds, &writefds, &errorfds, 101 | &topsock); 102 | 103 | if (select(topsock, &readfds, &writefds, &errorfds, NULL) == -1) { 104 | if (errno == EINTR) 105 | continue; 106 | else 107 | perror("select"); 108 | break; 109 | } 110 | 111 | if (FD_ISSET(0, &readfds)) { 112 | if (fgets(inbuf, sizeof(inbuf), stdin)) { 113 | inbuf[sizeof(inbuf) - 1] = '\0'; 114 | if (strlen(inbuf) > 0) { 115 | if (inbuf[strlen(inbuf) - 1] == '\n') 116 | inbuf[strlen(inbuf) - 1] = '\0'; 117 | QueueMessageForSend(netbuf, inbuf); 118 | } 119 | } else 120 | break; 121 | } 122 | 123 | if (RespondToSelect(netbuf, &readfds, &writefds, &errorfds, &doneOK)) { 124 | while ((msg = GetWaitingMessage(netbuf)) != NULL) { 125 | g_print("%s\n", msg); 126 | g_free(msg); 127 | } 128 | } 129 | if (!doneOK) 130 | break; 131 | } 132 | ShutdownNetworkBuffer(netbuf); 133 | g_free(netbuf); 134 | g_print("Connection closed\n"); 135 | } 136 | #endif 137 | -------------------------------------------------------------------------------- /src/gtkport/itemfactory.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * itemfactory.h GtkItemFactory and friends for Unix/Win32 * 3 | * Copyright (C) 1998-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * When using GTK+3, which has removed GtkItemFactory, or Win32, * 8 | * provide our own implementation; on GTK+2, use the implementation in * 9 | * GTK+ itself. * 10 | * * 11 | * This program is free software; you can redistribute it and/or * 12 | * modify it under the terms of the GNU General Public License * 13 | * as published by the Free Software Foundation; either version 2 * 14 | * of the License, or (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License for more details. * 20 | * * 21 | * You should have received a copy of the GNU General Public License * 22 | * along with this program; if not, write to the Free Software * 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 24 | * MA 02111-1307, USA. * 25 | ************************************************************************/ 26 | 27 | #ifndef __ITEM_FACTORY_H__ 28 | #define __ITEM_FACTORY_H__ 29 | 30 | #ifdef HAVE_CONFIG_H 31 | #include 32 | #endif 33 | 34 | #include 35 | 36 | #ifdef CYGWIN 37 | #include 38 | #include 39 | #include "gtktypes.h" 40 | #else 41 | #include 42 | #endif 43 | 44 | /* Use GTK+2's own implementation of these functions */ 45 | #if GTK_MAJOR_VERSION == 2 46 | #define DPGtkTranslateFunc GtkTranslateFunc 47 | #define DPGtkItemFactoryCallback GtkItemFactoryCallback 48 | #define DPGtkItemFactoryEntry GtkItemFactoryEntry 49 | #define DPGtkItemFactory GtkItemFactory 50 | 51 | GtkItemFactory *dp_gtk_item_factory_new(const gchar *path, 52 | GtkAccelGroup *accel_group); 53 | 54 | #define dp_gtk_item_factory_create_items gtk_item_factory_create_items 55 | #define dp_gtk_item_factory_create_item gtk_item_factory_create_item 56 | #define dp_gtk_item_factory_get_widget gtk_item_factory_get_widget 57 | #define dp_gtk_item_factory_set_translate_func gtk_item_factory_set_translate_func 58 | #else 59 | 60 | typedef gchar *(*DPGtkTranslateFunc) (const gchar *path, gpointer func_data); 61 | 62 | typedef void (*DPGtkItemFactoryCallback) (); 63 | 64 | typedef struct _DPGtkItemFactoryEntry DPGtkItemFactoryEntry; 65 | typedef struct _DPGtkItemFactory DPGtkItemFactory; 66 | 67 | struct _DPGtkItemFactoryEntry { 68 | gchar *path; 69 | gchar *accelerator; 70 | DPGtkItemFactoryCallback callback; 71 | guint callback_action; 72 | gchar *item_type; 73 | }; 74 | 75 | struct _DPGtkItemFactory { 76 | GSList *children; 77 | gchar *path; 78 | GtkAccelGroup *accel_group; 79 | GtkWidget *top_widget; 80 | DPGtkTranslateFunc translate_func; 81 | gpointer translate_data; 82 | }; 83 | 84 | DPGtkItemFactory *dp_gtk_item_factory_new(const gchar *path, 85 | GtkAccelGroup *accel_group); 86 | void dp_gtk_item_factory_create_item(DPGtkItemFactory *ifactory, 87 | DPGtkItemFactoryEntry *entry, 88 | gpointer callback_data, 89 | guint callback_type); 90 | void dp_gtk_item_factory_create_items(DPGtkItemFactory *ifactory, 91 | guint n_entries, 92 | DPGtkItemFactoryEntry *entries, 93 | gpointer callback_data); 94 | GtkWidget *dp_gtk_item_factory_get_widget(DPGtkItemFactory *ifactory, 95 | const gchar *path); 96 | void dp_gtk_item_factory_set_translate_func(DPGtkItemFactory *ifactory, 97 | DPGtkTranslateFunc func, 98 | gpointer data, 99 | GDestroyNotify notify); 100 | #endif /* GTK+2 */ 101 | 102 | #endif /* __ITEM_FACTORY_H__ */ 103 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | DIE=0 5 | package=dopewars 6 | srcfile=src/dopewars.c 7 | 8 | # Uncomment the line below to debug this file 9 | #DEBUG=defined 10 | 11 | debug () 12 | # print out a debug message if DEBUG is a defined variable 13 | { 14 | if test ! -z "$DEBUG" 15 | then 16 | echo "DEBUG: $1" 17 | fi 18 | } 19 | 20 | version_check () 21 | # check the version of a package 22 | # first argument : package name (executable) 23 | # second argument : source download url 24 | # rest of arguments : major, minor, micro version 25 | { 26 | EXACT_VERSION=$1 27 | PACKAGE=$2 28 | URL=$3 29 | MAJOR=$4 30 | MINOR=$5 31 | MICRO=$6 32 | 33 | WRONG= 34 | 35 | debug "major $MAJOR minor $MINOR micro $MICRO" 36 | VERSION=$MAJOR 37 | if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi 38 | if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi 39 | 40 | debug "version $VERSION" 41 | if [ "$EXACT_VERSION" -eq 0 ]; then 42 | echo -n "+ checking for $PACKAGE >= $VERSION ... " 43 | else 44 | echo -n "+ checking for $PACKAGE == $VERSION ... " 45 | fi 46 | 47 | ($PACKAGE --version) < /dev/null > /dev/null 2>&1 || 48 | { 49 | echo 50 | echo "You must have $PACKAGE installed to compile $package." 51 | echo "Download the appropriate package for your distribution," 52 | echo "or get the source tarball at $URL" 53 | return 1 54 | } 55 | # the following line is carefully crafted sed magic 56 | pkg_version=`$PACKAGE --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/^.* //'` 57 | debug "pkg_version $pkg_version" 58 | pkg_major=`echo $pkg_version | cut -d. -f1` 59 | pkg_minor=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f2` 60 | pkg_micro=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f3` 61 | test -z "$pkg_minor" && pkg_minor=0 62 | test -z "$pkg_micro" && pkg_micro=0 63 | 64 | debug "found major $pkg_major minor $pkg_minor micro $pkg_micro" 65 | 66 | #start checking the version 67 | if [ "$EXACT_VERSION" -eq 0 ]; then 68 | debug "version check >=" 69 | if [ "$pkg_major" -lt "$MAJOR" ]; then 70 | WRONG=1 71 | elif [ "$pkg_major" -eq "$MAJOR" ]; then 72 | if [ "$pkg_minor" -lt "$MINOR" ]; then 73 | WRONG=1 74 | elif [ "$pkg_minor" -eq "$MINOR" -a "$pkg_minor" -lt "$MINOR" ]; then 75 | WRONG=1 76 | fi 77 | fi 78 | else 79 | debug "version check ==" 80 | if [ "$MAJOR" -ne "$pkg_major" -o \ 81 | "$MINOR" -ne "$pkg_minor" -o \ 82 | "$MICRO" -ne "$pkg_micro" ]; then 83 | WRONG=1 84 | fi 85 | fi 86 | 87 | if test ! -z "$WRONG"; then 88 | echo "found $pkg_version, not ok !" 89 | echo 90 | if [ "$EXACT_VERSION" -eq 0 ]; then 91 | echo "You must have $PACKAGE $VERSION or greater to compile $package." 92 | echo "Get the latest version from <$URL>." 93 | else 94 | echo "You must have exactly $PACKAGE $VERSION to compile $package." 95 | echo "Get this version from <$URL>." 96 | fi 97 | return 1 98 | else 99 | echo "found $pkg_version, ok." 100 | fi 101 | } 102 | 103 | version_check 0 "autoconf" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 13 || DIE=1 104 | version_check 0 "automake" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 4 || DIE=1 105 | #version_check 0 "xgettext" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 10 38 || DIE=1 106 | #version_check 0 "msgfmt" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 10 38 || DIE=1 107 | 108 | if test "$DIE" -eq 1; then 109 | exit 1 110 | fi 111 | 112 | test -f $srcfile || { 113 | echo "You must run this script in the top-level $package directory" 114 | exit 1 115 | } 116 | 117 | if test -z "$*"; then 118 | echo "I am going to run ./configure with no arguments - if you wish " 119 | echo "to pass any to it, please specify them on the $0 command line." 120 | fi 121 | 122 | echo "+ running aclocal ..." 123 | aclocal -I m4 $ACLOCAL_FLAGS || { 124 | echo 125 | echo "aclocal failed - check that all needed development files are present on system" 126 | exit 1 127 | } 128 | 129 | echo "+ running autoheader ... " 130 | autoheader || { 131 | echo 132 | echo "autoheader failed" 133 | exit 1 134 | } 135 | echo "+ running autoconf ... " 136 | autoconf || { 137 | echo 138 | echo "autoconf failed" 139 | exit 1 140 | } 141 | echo "+ running automake ... " 142 | automake -a -c || { 143 | echo 144 | echo "automake failed" 145 | exit 1 146 | } 147 | 148 | # now remove the cache, because it can be considered dangerous in this case 149 | echo "+ removing config.cache ... " 150 | rm -f config.cache 151 | 152 | echo "+ running configure ... " 153 | if test -n "$*"; then 154 | echo "using: $@" 155 | fi 156 | echo 157 | 158 | ./configure "$@" || { 159 | echo 160 | echo "configure failed" 161 | exit 1 162 | } 163 | 164 | echo 165 | echo "Now type 'make' to compile $package." 166 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltsugar.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 14 | 15 | 16 | # lt_join(SEP, ARG1, [ARG2...]) 17 | # ----------------------------- 18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 19 | # associated separator. 20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 21 | # versions in m4sugar had bugs. 22 | m4_define([lt_join], 23 | [m4_if([$#], [1], [], 24 | [$#], [2], [[$2]], 25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 26 | m4_define([_lt_join], 27 | [m4_if([$#$2], [2], [], 28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 29 | 30 | 31 | # lt_car(LIST) 32 | # lt_cdr(LIST) 33 | # ------------ 34 | # Manipulate m4 lists. 35 | # These macros are necessary as long as will still need to support 36 | # Autoconf-2.59 which quotes differently. 37 | m4_define([lt_car], [[$1]]) 38 | m4_define([lt_cdr], 39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 40 | [$#], 1, [], 41 | [m4_dquote(m4_shift($@))])]) 42 | m4_define([lt_unquote], $1) 43 | 44 | 45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 46 | # ------------------------------------------ 47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 51 | # than defined and empty). 52 | # 53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 55 | m4_define([lt_append], 56 | [m4_define([$1], 57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 58 | 59 | 60 | 61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 62 | # ---------------------------------------------------------- 63 | # Produce a SEP delimited list of all paired combinations of elements of 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 65 | # has the form PREFIXmINFIXSUFFIXn. 66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 67 | m4_define([lt_combine], 68 | [m4_if(m4_eval([$# > 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://github.com/benmwebb/dopewars/workflows/build/badge.svg?branch=develop)](https://github.com/benmwebb/dopewars/actions?query=workflow%3Abuild) 2 | [![Download dopewars drug dealing game](https://img.shields.io/sourceforge/dt/dopewars.svg)](https://dopewars.sourceforge.io/download.html) 3 | 4 | This is dopewars 1.6.2, a game simulating the life of a drug dealer in 5 | New York. The aim of the game is to make lots and lots of money... 6 | unfortunately, you start the game with a hefty debt, accumulating interest, 7 | and the cops take a rather dim view of drug dealing... 8 | 9 | These are brief instructions; see the HTML documentation for full information. 10 | 11 | dopewars 1.6.2 servers should handle clients as old as version 1.4.3 with 12 | hardly any visible problems (the reverse is also true). However, it is 13 | recommended that both clients and servers are upgraded to 1.6.2! 14 | 15 | ## Installation 16 | 17 | Either... 18 | 19 | 1. Get the relevant RPM from https://dopewars.sourceforge.io/ 20 | 21 | Or... 22 | 23 | 1. Get the tarball `dopewars-1.6.2.tar.gz` from the same URL 24 | 2. Extract it via `tar -xvzf dopewars-1.6.2.tar.gz` 25 | 3. Follow the instructions in the `INSTALL` file in the newly-created 26 | `dopewars-1.6.2` directory 27 | 28 | Once you're done, you can safely delete the RPM, tarball and dopewars 29 | directory. The dopewars binary is all you need! 30 | 31 | dopewars stores its high score files by default in `/usr/share/dopewars.sco` 32 | This will be created by make install or by RPM installation. A different high 33 | score file can be selected with the `-f` switch. 34 | 35 | ## Windows installation 36 | 37 | dopewars now compiles as a console or regular application under Win32 (Windows 7 38 | or later). Almost all functionality of the standard Unix binary is retained; 39 | for example, all of the same command line switches are supported. However, for 40 | convenience, the configuration file is the more Windows-friendly 41 | "dopewars-config.txt". 42 | 43 | The easiest way to install the Win32 version is to download the precompiled 44 | binary. To build from source, see the `win32` directory. 45 | 46 | ## Usage 47 | 48 | dopewars has built-in client-server support for multi-player games. For a 49 | full list of options configurable on the command line, run dopewars with 50 | the `-h` switch. 51 | 52 | `dopewars -a` 53 | This is "antique" dopewars; it tries to keep to the original dopewars, based 54 | on the "Drug Wars" game by John E. Dell, as closely as possible. 55 | 56 | `dopewars` 57 | By default, dopewars supports multi-player games. On starting a game, the 58 | program will attempt to connect to a dopewars server so that players can send 59 | messages back and forth, and shoot each other if they really want to... 60 | 61 | `dopewars -s` 62 | Starts a dopewars server. This sits in the background and handles multi-player 63 | games. You probably want to use the `-l` command line option too to direct its 64 | log output to somewhere sensible. 65 | 66 | `dopewars -c` 67 | Create and run a computer dopewars player. This will attempt to connect 68 | to a dopewars server, and if this succeeds, it will then participate in 69 | multi-player dopewars games. 70 | 71 | ## Configuration 72 | 73 | Most of the dopewars defaults (for example, the location of the high score file, 74 | the port and server to connect to, the names of the drugs and guns, etc.) can be 75 | configured by adding suitable entries to the dopewars configuration file. The 76 | global file `/etc/dopewars` is read first, and can then be overridden by 77 | the local settings in `~/.dopewars`. All of the settings here can also be 78 | set on the command line of an interactive dopewars server when no players 79 | are logged on. See the file "example-cfg" for an example configuration file, 80 | and for a brief explanation of each option, type "help" in an interactive 81 | server. A subset of the configuration options can also be tweaked via the 82 | "Options" menu item in the GTK+/Win32 client. 83 | 84 | ## Playing 85 | 86 | dopewars is supposed to be fairly self-explanatory. You should be able to 87 | pick the basics up fairly quickly, but still be discovering subtleties for 88 | _ages_ ;) If you're _really_ stuck, send me an email. I might even answer it! 89 | 90 | Clue: buy drugs when they're cheap, sell them when they're expensive. The Bronx 91 | and Ghetto are "special" locations. Anything more would spoil the fun. ;) 92 | 93 | ## Bugs 94 | 95 | Well, there are bound to be lots. Let me know if you find any by 96 | [opening an issue](https://github.com/benmwebb/dopewars/issues), and I'll see 97 | if I can fix 'em... of course, a 98 | [working patch](https://github.com/benmwebb/dopewars/pulls) would be even 99 | nicer! ;) 100 | 101 | ## License 102 | 103 | dopewars is released under the GNU General Public License; see the text file 104 | LICENCE for further information. dopewars is copyright (C) Ben Webb 1998-2022. 105 | The dopewars icons are copyright (C) Ocelot Mantis 2001. 106 | 107 | ## Support 108 | 109 | dopewars is written and maintained by Ben Webb 110 | Enquiries about dopewars may be sent to this address (keep them sensible 111 | please ;) Bug fixes and reports, improvements and patches are also welcomed. 112 | -------------------------------------------------------------------------------- /src/gtkport/gtktypes.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * gtktypes.h Custom types for gtkport code * 3 | * Copyright (C) 2002-2022 Ben Webb * 4 | * Email: benwebb@users.sf.net * 5 | * WWW: https://dopewars.sourceforge.io/ * 6 | * * 7 | * This program is free software; you can redistribute it and/or * 8 | * modify it under the terms of the GNU General Public License * 9 | * as published by the Free Software Foundation; either version 2 * 10 | * of the License, or (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the Free Software * 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 20 | * MA 02111-1307, USA. * 21 | ************************************************************************/ 22 | 23 | #ifndef __GTKTYPES_H__ 24 | #define __GTKTYPES_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #ifdef CYGWIN 31 | 32 | #define MB_IMMRETURN 0 33 | 34 | #define MYWM_SOCKETDATA (WM_USER+100) 35 | #define MYWM_TASKBAR (WM_USER+101) 36 | #define MYWM_SERVICE (WM_USER+102) 37 | 38 | #define GDK_MOD1_MASK 0 39 | 40 | extern HICON mainIcon; 41 | 42 | #define GDK_KEY_KP_0 0xFFB0 43 | #define GDK_KEY_KP_1 0xFFB1 44 | #define GDK_KEY_KP_2 0xFFB2 45 | #define GDK_KEY_KP_3 0xFFB3 46 | #define GDK_KEY_KP_4 0xFFB4 47 | #define GDK_KEY_KP_5 0xFFB5 48 | #define GDK_KEY_KP_6 0xFFB6 49 | #define GDK_KEY_KP_7 0xFFB7 50 | #define GDK_KEY_KP_8 0xFFB8 51 | #define GDK_KEY_KP_9 0xFFB9 52 | 53 | typedef gint (*GtkFunction) (gpointer data); 54 | typedef void (*GtkDestroyNotify) (gpointer data); 55 | 56 | typedef struct _GtkClass GtkClass; 57 | typedef struct _GObject GObject; 58 | 59 | typedef struct _GtkRequisition GtkRequisition; 60 | typedef struct _GtkAllocation GtkAllocation; 61 | typedef struct _GtkWidget GtkWidget; 62 | typedef struct _GtkSignalType GtkSignalType; 63 | typedef struct _GtkContainer GtkContainer; 64 | 65 | typedef void (*GCallback) (); 66 | typedef void (*GtkSignalMarshaller) (GObject *object, GSList *actions, 67 | GCallback default_action, 68 | va_list args); 69 | 70 | typedef struct _GdkColor GdkColor; 71 | typedef struct _GtkStyle GtkStyle; 72 | typedef struct _GtkMenuShell GtkMenuShell; 73 | typedef struct _GtkMenuBar GtkMenuBar; 74 | typedef struct _GtkMenuItem GtkMenuItem; 75 | typedef struct _GtkMenu GtkMenu; 76 | typedef struct _GtkAdjustment GtkAdjustment; 77 | typedef struct _GtkSeparator GtkSeparator; 78 | typedef struct _GtkMisc GtkMisc; 79 | typedef struct _GtkProgressBar GtkProgressBar; 80 | typedef struct _GtkHSeparator GtkHSeparator; 81 | typedef struct _GtkVSeparator GtkVSeparator; 82 | typedef struct _GtkAccelGroup GtkAccelGroup; 83 | typedef struct _GtkPanedChild GtkPanedChild; 84 | typedef struct _GtkPaned GtkPaned; 85 | typedef struct _GtkVPaned GtkVPaned; 86 | typedef struct _GtkHPaned GtkHPaned; 87 | typedef struct _GtkComboBox GtkComboBox; 88 | 89 | /* Currently we only use cell_layout for combo box, so make it a synonym */ 90 | typedef struct _GtkComboBox GtkCellLayout; 91 | 92 | struct _GtkAccelGroup { 93 | ACCEL *accel; /* list of ACCEL structures */ 94 | gint numaccel; 95 | }; 96 | 97 | struct _GtkSignalType { 98 | gchar *name; 99 | GtkSignalMarshaller marshaller; 100 | GCallback default_action; 101 | }; 102 | 103 | struct _GdkColor { 104 | gulong pixel; 105 | gushort red; 106 | gushort green; 107 | gushort blue; 108 | }; 109 | 110 | struct _GtkStyle { 111 | GdkColor fg[5]; 112 | GdkColor bg[5]; 113 | }; 114 | 115 | typedef gboolean (*GtkWndProc) (GtkWidget *widget, UINT msg, 116 | WPARAM wParam, LPARAM lParam, gboolean *dodef); 117 | 118 | struct _GtkClass { 119 | gchar *Name; 120 | GtkClass *parent; 121 | gint Size; 122 | GtkSignalType *signals; 123 | GtkWndProc wndproc; 124 | }; 125 | 126 | typedef GtkClass *GtkType; 127 | 128 | struct _GObject { 129 | GtkClass *klass; 130 | GData *object_data; 131 | GData *signals; 132 | guint32 flags; 133 | }; 134 | 135 | struct _GtkAdjustment { 136 | GObject object; 137 | gfloat value, lower, upper; 138 | gfloat step_increment, page_increment, page_size; 139 | }; 140 | 141 | struct _GtkRequisition { 142 | gint16 width, height; 143 | }; 144 | 145 | struct _GtkAllocation { 146 | gint16 x, y, width, height; 147 | }; 148 | 149 | struct _GtkWidget { 150 | GObject object; 151 | HWND hWnd; 152 | GtkRequisition requisition; 153 | GtkAllocation allocation; 154 | GtkRequisition usize; 155 | GtkWidget *parent; 156 | }; 157 | 158 | struct _GtkContainer { 159 | GtkWidget widget; 160 | GtkWidget *child; 161 | guint border_width:16; 162 | }; 163 | 164 | #endif /* CYGWIN */ 165 | 166 | #endif /* __GTKTYPES_H__ */ 167 | --------------------------------------------------------------------------------