--- omega-rpg-0.90-pa9.orig/Makefile +++ omega-rpg-0.90-pa9/Makefile @@ -1,17 +1,17 @@ ### These two definitions are used if you 'make install' ### the value of LIBDIR should be the same as OMEGALIB in defs.h -BINDIR = ./omega/ -LIBDIR = ./lib/ +BINDIR = $(DESTDIR)/usr/games +LIBDIR = $(DESTDIR)/usr/share/games/omega-rpg ### choose your optimization level -OFLAGS = -O2 +OFLAGS = -O2 -pipe ### One of these should be uncommented, as appropriate, unless your compiler ### does it for you. You can test this by simply trying to 'make' omega - ### it will fail if none of them are defined. If you do uncomment ### one, make sure you comment out the other definition of CFLAGS lower down -CFLAGS = -ggdb -Wall $(OFLAGS) -DBSD # -ansi +CFLAGS = -Wall $(OFLAGS) -DBSD # -ansi #CFLAGS = -DSYSV $(OFLAGS) #CFLAGS = -DMSDOS $(OFLAGS) #CFLAGS = -DAMIGA $(OFLAGS) @@ -30,15 +30,15 @@ #LIBS = -lcurses -ltermlib #LIBS = -lpdcurses #Linux links in term?? automatically. -#LIBS = -lncurses +LIBS = -lncurses ### uncomment to use "op-curses" package -OPDEF = -DUSE_OPCURSES -CUROBJ = ../opcurses/curses.o ../opcurses/curgtk.o +#OPDEF = -DUSE_OPCURSES +#CUROBJ = ../opcurses/curses.o ../opcurses/curgtk.o ### uncomment to compile using opcurses GTK+ driver -CPPFLAGS = `gtk-config --cflags` -DUSE_OPCURSES -LDFLAGS = `gtk-config --libs` +#CPPFLAGS = `gtk-config --cflags` -DUSE_OPCURSES +#LDFLAGS = `gtk-config --libs` #################### that's it for changing the Makefile #################### @@ -49,7 +49,7 @@ CLROBJ = clrgen.o OBJ = omega.o abyss.o aux1.o aux2.o aux3.o bank.o char.o city.o\ - command1.o command2.o command3.o country.o date.o effect1.o\ + command1.o command2.o command3.o country.o effect1.o\ effect2.o effect3.o etc.o env.o file.o gen1.o gen2.o guild1.o guild2.o\ house.o init.o inv.o item.o itemf1.o itemf2.o itemf3.o lev.o map.o\ mmelee.o mmove.o mon.o move.o movef.o mspec.o mstrike.o mtalk.o\ @@ -60,7 +60,7 @@ omega: $(CUROBJ) $(CLROBJ) $(OBJ) $(CC) $(LDFLAGS) $(OFLAGS) $(CUROBJ) $(CLROBJ) $(OBJ) $(LIBS) -o omega - rm date.c date.o + #rm date.c date.o date.c: tools/makedate > date.c @@ -70,26 +70,29 @@ cd tools/libsrc; make maps.dat install: omega maps.dat $(BINDIR) $(LIBDIR) - cp omega $(BINDIR) - chmod 4711 $(BINDIR)/omega + cp omega $(BINDIR)/omega-rpg + chmod 4711 $(BINDIR)/omega-rpg - cp lib/* $(LIBDIR) - cp maps.dat $(LIBDIR) + cp lib/maps.dat $(LIBDIR) chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt chmod 0600 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/maps.dat - chmod 0600 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log $(LIBDIR)/omegahi.bak + chmod 0600 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log $(LIBDIR)/omega.hi.backup install_not_suid: omega maps.dat $(BINDIR) $(LIBDIR) - cp omega $(BINDIR) - chmod 0711 $(BINDIR)/omega + cp omega $(BINDIR)/omega-rpg + chmod 0711 $(BINDIR)/omega-rpg - cp lib/* $(LIBDIR) cp maps.dat $(LIBDIR) chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt chmod 0644 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/*.dat chmod 0666 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log - chmod 0600 $(LIBDIR)/omegahi.bak + chmod 0600 $(LIBDIR)/omega.hi.backup clean: - rm -f $(OBJ) clrgen.h clrgen.c genclr.o genclr omega + rm -f $(OBJ) $(CLROBJ) clrgen.h clrgen.c genclr.o genclr omega + cd tools; $(MAKE) clean + cd tools/libsrc; $(MAKE) clean + cd lib; $(MAKE) clean distclean: rm -f $(OBJ) $(CUROBJ) $(TOOLS) $(OLIBSTUFF) clrgen.h clrgen.c genclr.o genclr omega @@ -98,12 +101,13 @@ $(CUROBJ): ../opcurses/curses.h ../opcurses/cmacros.h ../opcurses/xcurses.h -$(CLROBJ): clrgen.h +$(CLROBJ): clrgen.c $(OBJ): defs.h extern.h glob.h iinit.h minit.h clrgen.h -clrgen.h clrgen.c: genclr.c minit.h defs.h - $(MAKE) genclr +clrgen.c: clrgen.h + +clrgen.h: genclr minit.h defs.h $(CPP) $(OPDEF) -DOMEGA_CLRGEN *.[ch] | ./genclr clrgen.c clrgen.h genclr: genclr.o --- omega-rpg-0.90-pa9.orig/bank.c +++ omega-rpg-0.90-pa9/bank.c @@ -1142,6 +1142,9 @@ int num_accounts; bank_account *account; + if(!bank) + return 0; + num_accounts = 0; for (account = bank; account; account = account->next_account) { --- omega-rpg-0.90-pa9.orig/char.c +++ omega-rpg-0.90-pa9/char.c @@ -17,7 +17,7 @@ int oldchar=FALSE; FILE *fd; char *lname; - int ret_value = FALSE; + int loaded = FALSE; #ifndef MSDOS struct passwd *dastuff; #endif @@ -81,18 +81,20 @@ optionset(COMPRESS_OPTION); #endif optionset(SHOW_COLOUR); - ret_value = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */ + loaded = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */ } /* This gets executed when the player loads from .omegarc */ /* DAG - put the code back in the same place, rather than duplicating */ Searchnum = max(1,min(9,Searchnum)); - Player.hp = Player.maxhp = Player.maxcon; - Player.mana = Player.maxmana = calcmana(); - Player.click = 1; - strcpy(Player.meleestr,"CCBC"); + if (!loaded) { + Player.hp = Player.maxhp = Player.maxcon; + Player.mana = Player.maxmana = calcmana(); + Player.click = 1; + strcpy(Player.meleestr,"CCBC"); + } calc_melee(); ScreenOffset = -1000; /* to force a redraw */ - return ret_value; /* RM 04-19-2000: loading patch */ /* DAG */ + return loaded; /* RM 04-19-2000: loading patch */ /* DAG */ } @@ -103,7 +105,7 @@ if ((fd = fopen("omega.rc","rb")) != NULL) { print2("Use omega.rc charcter record in current directory? [yn] "); #else - sprintf(Str1, "%s/.omegarc", getenv("HOME")); + snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME")); if ((fd = fopen(Str1,"r")) != NULL) { print2("Use .omegarc in home directory? [yn] "); #endif @@ -160,7 +162,7 @@ #if defined(MSDOS) || defined(AMIGA) fd = fopen("omega.rc","wb"); #else - sprintf(Str1, "%s/.omegarc", getenv("HOME")); + snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME")); fd = fopen(Str1,"w"); #endif if (fd == NULL) --- omega-rpg-0.90-pa9.orig/city.c +++ omega-rpg-0.90-pa9/city.c @@ -543,18 +543,15 @@ void resurrect_guards(void) { int i,j; - char site; + map *city; - FILE *fd; - - strcpy(Str3,Omegalib); - strcat(Str3,"city.dat"); - fd = checkfopen(Str3,"rb"); - site = cryptkey("city.dat"); + /* Get the original city. */ + city = map_open(MAP_city); + map_setLevel(city,0); + for(j=0;jlevel_length;j++) { for(i=0;ilevel_width;i++) { - site = getc(fd)^site; - if (site == 'G') { + if (map_getSiteChar(city,i,j) == 'G') { make_site_monster(i,j,GUARD); Level->site[i][j].creature->monstring = "undead guardsman"; Level->site[i][j].creature->meleef = M_MELEE_SPIRIT; @@ -569,9 +566,7 @@ m_status_set(Level->site[i][j].creature,AWAKE); } } - site = getc(fd)^site; } - fclose(fd); } --- omega-rpg-0.90-pa9.orig/command3.c +++ omega-rpg-0.90-pa9/command3.c @@ -206,15 +206,13 @@ xredraw(); } -extern const char * LAST_OMEGA_BUILD_TIME; - void version(void) { setgamestatus(SKIP_MONSTERS); print3(VERSIONSTRING); nprint3(":"); nprint3(" build date: "); - nprint3((char *)LAST_OMEGA_BUILD_TIME); + nprint3(__DATE__" "__TIME__); } void fire(void) --- omega-rpg-0.90-pa9.orig/debian/README.Debian +++ omega-rpg-0.90-pa9/debian/README.Debian @@ -0,0 +1,3 @@ +The savegame format has changed somewhere between 0.90.4 and 0.90-pa9. No +conversion tool is available. If you want to continue with your old savegames, +you will have to downgrade to 0.90.4. --- omega-rpg-0.90-pa9.orig/debian/changelog +++ omega-rpg-0.90-pa9/debian/changelog @@ -0,0 +1,113 @@ +omega-rpg (1:0.90-pa9-15build1) xenial; urgency=medium + + * No-change rebuild for ncurses6 transition. + + -- Matthias Klose Sun, 07 Feb 2016 09:44:30 +0000 + +omega-rpg (1:0.90-pa9-15) unstable; urgency=low + + * Fix potential crash when a manastorm or ball spell occurs at the edge of a + map. Closes: #471919 + + -- Guus Sliepen Sun, 01 Jun 2008 17:27:29 +0200 + +omega-rpg (1:0.90-pa9-14) unstable; urgency=low + + * Allow parallel builds. + + -- Guus Sliepen Fri, 04 Jan 2008 13:07:32 +0100 + +omega-rpg (1:0.90-pa9-13) unstable; urgency=low + + * Fix bitshifting in save_country() and save_level(). This probably fixes + loss of state in restored savegames. + + -- Guus Sliepen Sat, 19 Aug 2006 18:11:28 +0000 + +omega-rpg (1:0.90-pa9-12) unstable; urgency=low + + * Fix enchanting negatively enchanted items. Closes: #246038 + * Fix debit card creation if bank has been robbed. Closes: #246117 + + -- Guus Sliepen Tue, 27 Apr 2004 13:04:02 +0200 + +omega-rpg (1:0.90-pa9-11) unstable; urgency=low + + * Apply patch from Debian Security Team preventing buffer overflows in + command line and environment variable handling. + + -- Guus Sliepen Fri, 7 Nov 2003 13:57:06 +0100 + +omega-rpg (1:0.90-pa9-10) unstable; urgency=low + + * Apply patch from Richard Braakman to fix disappearing items after + escaping from pickup command. Closes: #199627 + + -- Guus Sliepen Wed, 2 Jul 2003 14:41:27 +0200 + +omega-rpg (1:0.90-pa9-9) unstable; urgency=low + + * Don't cast result of getitem_prompt() to char prematurely. Closes: #161930 + + -- Guus Sliepen Sun, 22 Sep 2002 22:06:01 +0200 + +omega-rpg (1:0.90-pa9-8) unstable; urgency=low + + * Remove highscore and log when purging. Closes: #161410 + + -- Guus Sliepen Sun, 22 Sep 2002 15:00:03 +0200 + +omega-rpg (1:0.90-pa9-7) unstable; urgency=low + + * Added menu hints. Closes: #141850 + + -- Guus Sliepen Tue, 9 Apr 2002 21:36:17 +0200 + +omega-rpg (1:0.90-pa9-6) unstable; urgency=low + + * Include patch from Richard Braakman. Closes: #134371 + * Enforce correct permissions on hiscore file. Closes: #134372 + + -- Guus Sliepen Mon, 18 Feb 2002 13:54:31 +0100 + +omega-rpg (1:0.90-pa9-5) unstable; urgency=low + + * Added Richard Braakman's patches. Closes: #112851, #130539 + + -- Guus Sliepen Mon, 28 Jan 2002 22:01:38 +0100 + +omega-rpg (1:0.90-pa9-4) unstable; urgency=low + + * When resurrecting guards access maps.dat instead of city.dat. + Closes: #131042 + + -- Guus Sliepen Sat, 26 Jan 2002 23:03:16 +0100 + +omega-rpg (1:0.90-pa9-3) unstable; urgency=low + + * Spelling fixes for description. Closes: #125203 + * Actually install lintian overrides file. + + -- Guus Sliepen Fri, 21 Dec 2001 19:05:59 +0100 + +omega-rpg (1:0.90-pa9-2) unstable; urgency=low + + * Added entry to Debian's menu system. + + -- Guus Sliepen Wed, 12 Dec 2001 23:48:11 +0100 + +omega-rpg (1:0.90-pa9-1) unstable; urgency=low + + * New upstream release. + * Set WIZARD to "root". Closes: #112404 + * Added lintian overrides. + + -- Guus Sliepen Sun, 16 Sep 2001 23:50:00 +0200 + +omega-rpg (0.90.4-1) unstable; urgency=low + + * Initial Release. Closes: #89200 + * Changed library directory to /usr/share/games/omega-rpg for FHS + compliance, seperated highscore and log file to /var/games/omega-rpg. + + -- Guus Sliepen Sun, 11 Mar 2001 22:57:08 +0100 --- omega-rpg-0.90-pa9.orig/debian/compat +++ omega-rpg-0.90-pa9/debian/compat @@ -0,0 +1 @@ +4 --- omega-rpg-0.90-pa9.orig/debian/control +++ omega-rpg-0.90-pa9/debian/control @@ -0,0 +1,19 @@ +Source: omega-rpg +Section: games +Priority: optional +Maintainer: Guus Sliepen +Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 4.0.0), libncurses5-dev + +Package: omega-rpg +Architecture: any +Depends: ${shlibs:Depends} +Description: A text-based roguelike game + Omega is a complex rogue-style game of dungeon exploration. Unlike other such + games, there are a number of ways to "win", depending on various actions + taken during play. The ways you can get your name on the high score board + include becoming the highest ranked head of a guild, sect, college, etc., as + well as gaining the most points figured from possessions and experience. The + game (via the oracle) may impose some structure on your exploration, but you + need not follow all of the oracle's advice. There *is* a "total winner" + status, by the way. --- omega-rpg-0.90-pa9.orig/debian/copyright +++ omega-rpg-0.90-pa9/debian/copyright @@ -0,0 +1,61 @@ +omega +===== + +General Public License: + +omega is copyright (C) 1987,1988,1989,1998 by Laurence R. Brothers + +Omega 0.90 is distributed under the terms of the GNU Library General Public +Licence, version 2, which can be found in /usr/share/common-licenses/LGPL-2. +The license on the pre-alpha versions of Omega 0.90 is revocable by notice from +Laurence R. Brothers. If this license is revoked, Omega will revert to being +licensed according to the terms of Laurence's original license.txt, included +here as license.old. See omega.bug2 for a (non-binding) explanation of the +motives for this change. + +For the purposes of the LGPL, Omega is defined as a library, and a "program" +is considered additional levels, monsters, and other modifications beyond +those distributed in the pristine 0.90 source, only if said additions affect +only the runtime (so that an Omega binary which can use said additions may +be correctly compiled from the possibly modified source you provide +according to the terms of the LGPL). + +No warranty is made for omega's operation. Any damages incurred in the use +of omega or in its implementation are solely the responsibility of the +end-user. + +Compensation: I waive all rights to compensation for the use of omega +by licensees. However, those wishing to send money, international +postal reply coupons, interesting postcards, marbles, grimoires, etc. +will find their contributions freely accepted. + +Suggestions, fan mail, and money may be sent to the +author at: + + Laurence R. Brothers + Bell Communications Research + RRC 1H-225 + 444 Hoes Lane + Piscataway, NJ 08854 + USA + +All the above save money may also be sent to: + + brothers@paul.rutgers.edu + +Bug reports and suggestions can also be sent to the current maintainer +of Omega. Currently, this is + wtanksle@ucsd.edu (William Tanksley) +Since Laurence has moved on and indicates that he is no longer interested +in maintaining the game, you have a much greater chance of action if you +email the maintainer. + +The latest version of omega is available for anonymous ftp from +monu1.cc.monash.edu.au [130.194.1.101] in /pub/omega. + +This version of Omega, 0.90 prealpha 2, is distributed by wtanksle@ucsd.edu +(William Tanksley). If you have any troubles with it, suggestions for a +friendlier user interface, more puzzles, or any other topic you'd like to +see addressed, please write to William. Every suggestion's fair game; it's +been too long since Omega's gotten the respect that it deserves. Feel free +to check for the latest version at http://lyric.ml.org/~wtanksle/omega/. --- omega-rpg-0.90-pa9.orig/debian/menu +++ omega-rpg-0.90-pa9/debian/menu @@ -0,0 +1,3 @@ +?package(omega-rpg):command="/usr/games/omega-rpg" \ + needs="text" section="Games/Adventure" \ + title="Omega" hints="Roguelike,Dungeon" --- omega-rpg-0.90-pa9.orig/debian/omega-rpg.docs +++ omega-rpg-0.90-pa9/debian/omega-rpg.docs @@ -0,0 +1,2 @@ +buglist.txt +omega.ad --- omega-rpg-0.90-pa9.orig/debian/omega-rpg.overrides +++ omega-rpg-0.90-pa9/debian/omega-rpg.overrides @@ -0,0 +1,2 @@ +omega-rpg: extra-license-file usr/share/games/omega-rpg/license.txt +omega-rpg: non-standard-dir-perm var/games/omega-rpg/ 2775 != 0755 --- omega-rpg-0.90-pa9.orig/debian/omega-rpg.postinst +++ omega-rpg-0.90-pa9/debian/omega-rpg.postinst @@ -0,0 +1,17 @@ +#!/bin/sh -e + +# Copy the default highscore/log files if there are non present. +if [ "$1" = "configure" ]; then + if [ ! -f /var/games/omega-rpg/omega.hi ]; then + cp -a /usr/share/games/omega-rpg/omega.hi /var/games/omega-rpg/omega.hi + chgrp games /var/games/omega-rpg/omega.hi + chmod g+w /var/games/omega-rpg/omega.hi + fi + if [ ! -f /var/games/omega-rpg/omega.log ]; then + cp -a /usr/share/games/omega-rpg/omega.log /var/games/omega-rpg/omega.log + chgrp games /var/games/omega-rpg/omega.log + chmod g+w /var/games/omega-rpg/omega.log + fi +fi + +#DEBHELPER# --- omega-rpg-0.90-pa9.orig/debian/omega-rpg.postrm +++ omega-rpg-0.90-pa9/debian/omega-rpg.postrm @@ -0,0 +1,9 @@ +#!/bin/sh -e + +case "$1" in + purge) + rm -rf /var/games/omega-rpg + ;; +esac + +#DEBHELPER# --- omega-rpg-0.90-pa9.orig/debian/rules +++ omega-rpg-0.90-pa9/debian/rules @@ -0,0 +1,66 @@ +#!/usr/bin/make -f + +build: build-stamp +build-stamp: + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + rm -f build-stamp + + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + mkdir -p debian/omega-rpg/usr/games + mkdir -p debian/omega-rpg/usr/share/games/omega-rpg + + DESTDIR=`pwd`/debian/omega-rpg $(MAKE) install + + mkdir -p debian/omega-rpg/usr/share/man/man6 + cp docs/omega.6 debian/omega-rpg/usr/share/man/man6/omega-rpg.6 + + mkdir -p debian/omega-rpg/usr/share/lintian/overrides + cp debian/omega-rpg.overrides debian/omega-rpg/usr/share/lintian/overrides/omega-rpg + +# Build architecture-independent files here. +binary-indep: +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installchangelogs + dh_installmenu + dh_link + dh_strip + dh_compress + dh_fixperms + chgrp -R games `pwd`/debian/omega-rpg/usr/games/omega-rpg + chmod g+s `pwd`/debian/omega-rpg/usr/games/omega-rpg + mkdir -p `pwd`/debian/omega-rpg/var/games/omega-rpg + chmod 755 -R `pwd`/debian/omega-rpg/var + chgrp games `pwd`/debian/omega-rpg/var/games/omega-rpg + chmod g+ws `pwd`/debian/omega-rpg/var/games/omega-rpg + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- omega-rpg-0.90-pa9.orig/defs.h +++ omega-rpg-0.90-pa9/defs.h @@ -71,7 +71,8 @@ This might usually be "/usr/games/lib/omegalib/", for unix, or something like "c:\\games\\omega\\omegalib\\" for msdos */ -#define OMEGALIB "./lib/" +#define OMEGALIB "/usr/share/games/omega-rpg/" +#define OMEGAVAR "/var/games/omega-rpg/" /* TILEFILE is the name of the file you want to use for graphics tiles. You */ /* aren't really free to use any file you want here. It should be the Omega */ @@ -93,7 +94,7 @@ /* set WIZARD to maintainers's username */ -#define WIZARD "sheldon" +#define WIZARD "root" /* If CATCH_SIGNALS is set to 1, will not dump core, nicer for players. */ /* dbx still intercepts the signals first, so it's ok for debugging */ --- omega-rpg-0.90-pa9.orig/effect1.c +++ omega-rpg-0.90-pa9/effect1.c @@ -80,11 +80,11 @@ } } else { - if (Player.possessions[i]->plus > random_range(20)+1) { + if (abs(Player.possessions[i]->plus) > random_range(20)+1) { print1("Uh-oh, the force of the enchantment was too much!"); print2("There is a loud explosion!"); morewait(); - manastorm(Player.x,Player.y,Player.possessions[i]->plus*5); + manastorm(Player.x,Player.y,abs(Player.possessions[i]->plus)*5); dispose_lost_objects(1,Player.possessions[i]); } else { @@ -382,6 +382,9 @@ for(i=0;i<9;i++) { ex = xx + Dirs[0][i]; ey = yy + Dirs[1][i]; + + if(offscreen(ex, ey)) + continue; if ((ex == Player.x) && (ey == Player.y)) { switch(dtype) { --- omega-rpg-0.90-pa9.orig/extern.h +++ omega-rpg-0.90-pa9/extern.h @@ -1126,6 +1126,7 @@ void do_los( Symbol,int *,int *,int,int ); void do_object_los (Symbol, int *, int *, int, int); void findspace( int *,int *,int ); +int try_findspace( int *,int *,int ); void initdirs( void ); #ifdef NO_USLEEP void usleep( int ); --- omega-rpg-0.90-pa9.orig/file.c +++ omega-rpg-0.90-pa9/file.c @@ -14,6 +14,7 @@ # include # endif # include +# include # include # include # include @@ -160,13 +161,13 @@ FILE * lockfile; - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.hi.lock"); do { /* create lock file */ - lock = open(Str1, O_CREAT | O_EXCL, 0600); + lock = open(Str1, O_WRONLY | O_CREAT | O_EXCL, 0600); if (lock < 0 && errno == EEXIST) { lockfile = fopen(Str1, "rb"); @@ -206,7 +207,7 @@ void unlock_score_file(void) { #ifndef MSDOS - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.hi.lock"); unlink(Str1); #endif @@ -218,7 +219,7 @@ int i; lock_score_file(); - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.hi"); fd = checkfopen(Str1,"rb"); filescanstring(fd,Hiscorer); @@ -302,10 +303,10 @@ if (gamestatusp(CHEATED)) return; lock_score_file(); - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.hi"); infile = checkfopen(Str1,"rb"); - strcpy(Str2,Omegalib); + strcpy(Str2,Omegavar); #ifdef MSDOS strcat(Str2,"omegahi.new"); /* stupid 8.3 msdos filename limit */ #else @@ -377,6 +378,7 @@ } fclose(infile); fclose(outfile); + chmod(Str2, 0664); unlink(Str1); #if defined(MSDOS) || defined(AMIGA) rename(Str2, Str1); @@ -434,7 +436,7 @@ change_to_game_perms(); npcbehavior=fixnpc(lifestatus); checkhigh(descrip,npcbehavior); - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.log"); fd = checkfopen(Str1,"a"); fprintf(fd, " %d %d %d %s\n", lifestatus, Player.level, npcbehavior, @@ -496,10 +498,15 @@ char *required_file_list[] = { - "maps.dat", "omega.hi", "omega.log", "motd.txt", + "maps.dat", "motd.txt", "license.txt", NULL }; +char *required_writeable[] = +{ + "omega.hi", "omega.log", NULL +}; + char *optional_file_list[] = { "help1.txt", "help2.txt", "help3.txt", "help4.txt", "help5.txt", @@ -516,24 +523,30 @@ int endpos; int file; - strcpy(Str1, Omegalib); + strcpy(Str1, Omegavar); endpos = strlen(Str1); - for (file = 0; required_file_list[file]; file++) + for (file = 0; required_writeable[file]; file++) { - strcpy(&(Str1[endpos]), required_file_list[file]); - if ((strcmp(required_file_list[file], "omega.hi") == 0 || - strcmp(required_file_list[file], "omega.log") == 0) && - test_file_access(Str1, 'w') == 0) + strcpy(&(Str1[endpos]), required_writeable[file]); + if (test_file_access(Str1, 'w') == 0) { impossible = TRUE; printf("\nError! File not appendable or accessible: %s", Str1); } - else if (test_file_access(Str1, 'r') == 0) + } + + strcpy(Str1, Omegalib); + endpos = strlen(Str1); + for (file = 0; required_file_list[file]; file++) + { + strcpy(&(Str1[endpos]), required_file_list[file]); + if (test_file_access(Str1, 'r') == 0) { impossible = TRUE; printf("\nError! File not accessible: %s", Str1); } } + for (file = 0; optional_file_list[file]; file++) { strcpy(&(Str1[endpos]), optional_file_list[file]); @@ -545,13 +558,13 @@ } if (impossible) { printf("\nFurther execution is impossible. Sorry."); - if (strcmp(Omegalib, OMEGALIB)) + if (strcmp(Omegavar, OMEGALIB)) printf("\nEnvironment variable OMEGALIB badly set\n"); else { printf("\nOMEGALIB may be badly #defined in defs.h\n"); #ifndef FIXED_OMEGALIB printf("\nYou can set the environment variable OMEGALIB to\n"); - printf("the location of the omegalib directory.\n"); + printf("the location of the omegavar directory.\n"); #endif } return(0); --- omega-rpg-0.90-pa9.orig/gen2.c +++ omega-rpg-0.90-pa9/gen2.c @@ -243,7 +243,13 @@ /* corridor which is guaranteed to connect */ - findspace(&tx,&ty,i); + + /* If there is no starting point for it, then our current room + * might have been big enough to wipe out all previous rooms on + * the level (it's rare but possible). In that case just consider + * this the new first room, and continue. -- Richard Braakman */ + if (!try_findspace(&tx,&ty,i)) + continue; /* figure out where to start corridor from */ if ((ty <= t) && (tx <= l+e)) { @@ -390,79 +396,79 @@ case 4: rsi = RS_FIREPLANE; break; case 5: rsi = RS_HIGHASTRAL; break; } + } - maze_corridor(1 + random_range(Level->level_width - 1), - 1 + random_range(Level->level_length - 1), - 1 + random_range(Level->level_width - 1), - 1 + random_range(Level->level_length - 1), - rsi, - 0); + maze_corridor(1 + random_range(Level->level_width - 1), + 1 + random_range(Level->level_length - 1), + 1 + random_range(Level->level_width - 1), + 1 + random_range(Level->level_length - 1), + rsi, + 0); - if (E_ASTRAL == Current_Dungeon) + if (E_ASTRAL == Current_Environment) + { + for (x_idx = 0; x_idx < Level->level_width; ++x_idx) { - for (x_idx = 0; x_idx < Level->level_width; ++x_idx) + for (y_idx = 0; y_idx < Level->level_length; ++y_idx) { - for (y_idx = 0; y_idx < Level->level_length; ++y_idx) + if (WALL == Level->site[x_idx][y_idx].locchar) { - if (WALL == Level->site[x_idx][y_idx].locchar) + switch (Level->depth) { - switch (Level->depth) - { - case 1: - Level->site[x_idx][y_idx].aux = 500; - break; - - case 2: - Level->site[x_idx][y_idx].locchar = WHIRLWIND; - Level->site[x_idx][y_idx].p_locf = L_WHIRLWIND; - break; - - case 3: - Level->site[x_idx][y_idx].locchar = WATER; - Level->site[x_idx][y_idx].p_locf = L_WATER; - break; - - case 4: - Level->site[x_idx][y_idx].locchar = FIRE; - Level->site[x_idx][y_idx].p_locf = L_FIRE; - break; - - case 5: - Level->site[x_idx][y_idx].locchar = ABYSS; - Level->site[x_idx][y_idx].p_locf = L_ABYSS; - break; - } + case 1: + Level->site[x_idx][y_idx].aux = 500; + break; + + case 2: + Level->site[x_idx][y_idx].locchar = WHIRLWIND; + Level->site[x_idx][y_idx].p_locf = L_WHIRLWIND; + break; + + case 3: + Level->site[x_idx][y_idx].locchar = WATER; + Level->site[x_idx][y_idx].p_locf = L_WATER; + break; + + case 4: + Level->site[x_idx][y_idx].locchar = FIRE; + Level->site[x_idx][y_idx].p_locf = L_FIRE; + break; + + case 5: + Level->site[x_idx][y_idx].locchar = ABYSS; + Level->site[x_idx][y_idx].p_locf = L_ABYSS; + break; } } + } + } - switch (Level->depth) - { - case 1: mid = LORD_EARTH; break; /* Elemental Lord of Earth */ - case 2: mid = LORD_AIR; break; /* Elemental Lord of Air */ - case 3: mid = LORD_WATER; break; /* Elemental Lord of Water */ - case 4: mid = LORD_FIRE; break; /* Elemental Lord of Fire */ - case 5: mid = ELEM_MASTER; break; /* Elemental Master */ - default: mid = ELEM_MASTER; assert(FALSE); /* bomb if this happens */ - } + switch (Level->depth) + { + case 1: mid = LORD_EARTH; break; /* Elemental Lord of Earth */ + case 2: mid = LORD_AIR; break; /* Elemental Lord of Air */ + case 3: mid = LORD_WATER; break; /* Elemental Lord of Water */ + case 4: mid = LORD_FIRE; break; /* Elemental Lord of Fire */ + case 5: mid = ELEM_MASTER; break; /* Elemental Master */ + default: mid = ELEM_MASTER; assert(FALSE); /* bomb if this happens */ + } - if (5 == Level->depth) - { - findspace(&tx, &ty, -1); - Level->site[tx][ty].p_locf = L_ENTER_CIRCLE; - Level->site[tx][ty].locchar = STAIRS_DOWN; - } + if (5 == Level->depth) + { + findspace(&tx, &ty, -1); + Level->site[tx][ty].p_locf = L_ENTER_CIRCLE; + Level->site[tx][ty].locchar = STAIRS_DOWN; + } - if (!gamestatusp(COMPLETED_ASTRAL)) - { - findspace(&tx, &ty, -1); - Level->mlist = checkmalloc(sizeof(mltype)); - Level->mlist->next = NULL; - Level->mlist->m = make_creature(mid); - Level->mlist->m->x = tx; - Level->mlist->m->y = ty; - Level->site[tx][ty].creature = Level->mlist->m; - } - } + if (!gamestatusp(COMPLETED_ASTRAL)) + { + findspace(&tx, &ty, -1); + Level->mlist = checkmalloc(sizeof(mltype)); + Level->mlist->next = NULL; + Level->mlist->m = make_creature(mid); + Level->mlist->m->x = tx; + Level->mlist->m->y = ty; + Level->site[tx][ty].creature = Level->mlist->m; } } else if (E_VOLCANO == Current_Environment) --- omega-rpg-0.90-pa9.orig/glob.h +++ omega-rpg-0.90-pa9/glob.h @@ -26,6 +26,9 @@ /* This string holds the path to the library files */ extern char *Omegalib; +/* This string holds the path to the highscore and log files */ +extern char *Omegavar; + /* one of each monster */ extern struct monster Monsters[NUMMONSTERS]; --- omega-rpg-0.90-pa9.orig/inv.c +++ omega-rpg-0.90-pa9/inv.c @@ -78,7 +78,7 @@ may drop things back onto the now null ground */ void pickup_at (int x, int y) { - char response; + char response = 0; pol ol; pol temp; @@ -90,10 +90,10 @@ while (ol != 0) { - clearmsg1(); - response = cinema_ynq(strjoin("Pick up: ", itemid(ol->thing))); - if ('q' == response) - break; + if(response != 'q') { + clearmsg1(); + response = cinema_ynq(strjoin("Pick up: ", itemid(ol->thing))); + } if (response == 'y') gain_item(ol->thing); @@ -106,15 +106,6 @@ temp->thing = 0; free(temp); } - - while (ol != 0) - { - temp = ol; - ol = ol->next; - temp->next = 0; - temp->thing = 0; - free(temp); - } } /* WDT -- convert from a char (keypress) to an item index in @@ -553,7 +544,7 @@ int getitem_prompt (char * prompt, Symbol itype) { - char key; + int key; char *line3; char invstr[64]; char selectstr[80]; --- omega-rpg-0.90-pa9.orig/lib/Makefile +++ omega-rpg-0.90-pa9/lib/Makefile @@ -10,3 +10,6 @@ .map.dat: cd ../tools; make -f makefile ../tools/crypt $@ > $@ < $< + +clean: + rm -f .maps.dat maps.dat --- omega-rpg-0.90-pa9.orig/lib/motd.txt +++ omega-rpg-0.90-pa9/lib/motd.txt @@ -9,7 +9,7 @@ * ** ** * ***** ***** - omega version 0.90-pa8 is copyright (C) 1987,1988,1989 by: + omega version 0.90-pa9 is copyright (C) 1987,1988,1989 by: Laurence R. Brothers and is licensed under the LGPL. Maintained by: William Tanksley (wtanksley@bigfoot.com). --- omega-rpg-0.90-pa9.orig/mon.c +++ omega-rpg-0.90-pa9/mon.c @@ -696,7 +696,7 @@ status = 2; strcpy(Str2,"Malaprop the Misnamed"); - strcpy(Str1,Omegalib); + strcpy(Str1,Omegavar); strcat(Str1,"omega.log"); fd = checkfopen(Str1,"r"); n = 1; --- omega-rpg-0.90-pa9.orig/omega.c +++ omega-rpg-0.90-pa9/omega.c @@ -22,6 +22,7 @@ /* most globals originate in omega.c */ char *Omegalib; /* contains the path to the library files */ +char *Omegavar; /* contains the path to the highscore and log files */ #ifdef DEBUG FILE *DG_debug_log; /* debug log file pointer */ @@ -300,13 +301,13 @@ } else { /* savefile given */ continuing = 1; - strcpy(SaveFileName,argv[optind]); + strncpy(SaveFileName,argv[optind],sizeof(SaveFileName)-1); } #else /* alternate code for people who don't support getopt() -- no enhancement */ if (argc ==2) { - strcpy( SaveFileName, argv[1]); + strncpy( SaveFileName, argv[1], sizeof(SaveFileName)-1); continuing = 1; } else { strcpy( SaveFileName,"Omega"); @@ -358,6 +359,11 @@ #endif Omegalib = OMEGALIB; +#ifndef FIXED_OMEGALIB + if (!(Omegavar = getenv("OMEGAVAR"))) +#endif + Omegavar = OMEGAVAR; + /* if filecheck is 0, some necessary data files are missing */ if (filecheck() == 0) exit(0); --- omega-rpg-0.90-pa9.orig/save.c +++ omega-rpg-0.90-pa9/save.c @@ -336,7 +336,7 @@ } mask >>= 1; if (level->site[i][j].lstatus&SEEN) - mask |= (1<<(sizeof(long int)*8 - 1)); + mask |= (1UL<<(sizeof(long int)*8 - 1)); run--; } if (run < 8*sizeof(long int)) @@ -477,7 +477,7 @@ } mask >>= 1; if (c_statusp(i, j, SEEN)) - mask |= (1<<(sizeof(long int)*8 - 1)); + mask |= (1UL<<(sizeof(long int)*8 - 1)); run--; } if (run < 8*sizeof(long int)) --- omega-rpg-0.90-pa9.orig/tools/libsrc/Makefile +++ omega-rpg-0.90-pa9/tools/libsrc/Makefile @@ -9,3 +9,6 @@ ../crypt: ../crypt.c cd ..; make + +clean: + rm -f maps.dat ../crypt --- omega-rpg-0.90-pa9.orig/util.c +++ omega-rpg-0.90-pa9/util.c @@ -850,6 +850,21 @@ assert(FALSE); } +/* finds floor space on level with buildaux not equal to baux, +sets x,y there. Return false is no such space exists on the level. */ +int try_findspace (int * x_out, int * y_out, int baux) +{ + /* try to quickly find a space by sampling randomly */ + if (findspace_method_one(x_out, y_out, Level, baux)) + return TRUE; + + /* examine every space on the level */ + if (findspace_method_two(x_out, y_out, Level, baux)) + return TRUE; + + return FALSE; +} + /* is prefix a prefix of s? */ int strprefix(char *prefix, char *s) {