Commit graph

34 commits

Author SHA1 Message Date
John "Elwin" Edwards
6ab6c944fb Only include one copy of the install-sh script. 2015-06-05 18:02:17 -04:00
John "Elwin" Edwards
321e437f47 Fix a typo in configure.ac.
'test' had been misspelled 'text', and the error had propagated to all
seven games.
2015-06-04 14:48:25 -04:00
John "Elwin" Edwards
e3620a3781 Advanced Rogue family: fix the "score" option.
Changing the score file (when permitted) now works again, closing the
old score file and opening the new one.
2015-05-20 08:42:17 -04:00
John "Elwin" Edwards
3554339257 Advanced Rogue family: overhaul privilege handling.
Advanced Rogue 5 and 7, and XRogue, now open the scorefile and logfile
at startup and then drop any set[ug]id privileges if the savedir is not
being used.
2015-05-16 13:39:26 -04:00
John "Elwin" Edwards
be61b1a69e rogue4, arogue5: improve portability.
Most changes merely prevent including header files that don't exist.

All games now build and run on MinGW, though bugs remain.
2014-05-07 14:08:38 -07:00
John "Elwin" Edwards
9a8022c683 Makefiles: don't set defaults for CFLAGS.
CFLAGS is now empty by default.  If its value must be set, it should be
done in the command line for make.
2014-03-29 09:45:33 -07:00
John "Elwin" Edwards
a8b96bbc3e arogue5: make alchemy jugs survive a save and restore.
Alchemy jugs are refilled by the alchemy() fuse, which takes a pointer
to the jug object as an argument.  When written to a save file and read
back out, the pointer is unlikely to point anywhere useful.

Instead, rs_write_daemons() now stores an index into the player's pack
or the list of objects on the floor.  rs_read_daemons() uses this
number to locate the object when restoring.

This change should not cause any new issues with old savefiles, but it
is unable to make a broken alchemy jug work again.
2014-03-28 15:51:43 -07:00
John "Elwin" Edwards
7b0ec1230e arogue5: fix some daemon-related pointer/int casting.
Daemons and fuses take a single argument, nominally an int but either
ignored or unsafely cast to a pointer.  Its type has now been changed
to void*.

The save/restore code no longer tries to store this argument in the
savefile.  For doctor(), this is not a problem, because player is the
only argument it is ever given as a daemon.  However, alchemy() will
fail to do anything when passed NULL.  Fixing this would be complicated
but possible.

Summary: the code is slightly safer, but alchemy jugs are guaranteed to
stop working after save and restore, instead of just extremely likely.
2014-03-28 10:57:03 -07:00
John "Elwin" Edwards
67ec840c3c Don't truncate player name in savefile name or log message.
The player name is stored in whoami[], which is length 80 in most games
(1024 in rogue5).  Only the first 10 chars were used to create
file_name, because that buffer is the same length.  Increasing the size
of file_name to 256 permits using all of whoami.

The name is also no longer truncated to 20 chars when writing the log.

All games should now be able to handle 79-character names without
collisions.  Anything more would break save compatibility.
2014-03-23 21:27:14 -07:00
John "Elwin" Edwards
46568d24a4 arogue5: fix some save/restore-related crashes.
The save/restore code took the pointer intended as an argument for the
doctor() daemon and wrote it to the savefile as an int.  I don't know
why it took so long to fail horribly.  The problem has been avoided by
replacing the value with &player when restoring.  That seems to be the
only argument ever actually used.

The code also writes only four bytes for an unsigned long; if
sizeof(long) == 8, it casts to unsigned int first.  It failed to do the
cast when reading back, with the result that four bytes were read and
the other half of the number was effectively uninitialized.

It apparently works now, but the save/restore code ought still to be
regarded as decidedly unfortunate.
2014-01-06 15:57:17 -05:00
John "Elwin" Edwards
ea75e2ac0b arogue5: use configure's checks to find term.h.
This should make the build process work on OS X.
2013-09-07 09:43:06 -04:00
John "Elwin" Edwards
720d587422 Rename daemon() to start_daemon().
daemon() conflicted with the standard library function, which is
included by default on OS X.
2013-09-07 08:08:00 -04:00
John "Elwin" Edwards
36769ea3e4 Add config.h to the list of headers in the Makefiles.
Some .o files need to be rebuilt if config.h changes.  Adding it to the
list of headers may still fail to solve the problem, because some of
the Makefiles use implicit rules or do not list dependencies properly.
2013-09-03 14:14:48 -07:00
John "Elwin" Edwards
47712fdf5d arogue5: port to autoconf.
'configure' and 'make install' now work.  There may be problems with
hard-to-test features like MAXLOAD.
2013-08-31 09:18:07 -07:00
John "Elwin" Edwards
6b4b35ba1e arogue5: fix backspace key. 2013-08-28 08:37:56 -07:00
John "Elwin" Edwards
1f1ae55a26 Make sure file_name contains '/' between SAVEDIR and the file name.
Duplicated slashes are not a problem.  Missing slashes are.
2013-08-27 22:25:40 -07:00
John "Elwin" Edwards
2d117230ed Refuse to restore if the character is dead.
This prevents recovering from death by killing the game between death
and exit, producing an automatic save.
2013-08-09 09:34:07 -07:00
John "Elwin" Edwards
e375c8bd05 Properly handle invalid room references in savefiles.
In all games, rs_write_room_reference() stored -1 for a nonexistent
room, but rs_read_room_reference() did not check for out-of-bounds
values, leading to pointers to rooms[-1], which sometimes caused
crashes.  rs_read_room_reference() has now been modified to use NULL
instead.

Some of the games required further changes to replace NULL with the
pointer to the actual room.  Others are capable of handling NULL for
objects not in any room.
2013-08-08 12:41:35 -07:00
John "Elwin" Edwards
b6bcf2e3f4 arogue5: make some prayer-related messages appear properly. 2012-09-09 17:58:38 -07:00
John "Elwin" Edwards
ad5245c5f8 arogue5: fix some more drawing to the wrong window.
The spell-choosing and prayer-choosing routines, when the one-line
inventory option is set, displayed to cw instead of msgw.  This caused
permanent corruption of the message line.
2012-09-09 15:55:51 -07:00
John "Elwin" Edwards
cd74a20cc9 arogue5: fix "More" prompt appearing in the wrong place.
The magic and monster detection routines printed "--More--" to cw
instead of msgw, making it appear at the @-sign instead of on the top
line.
2012-09-09 08:55:11 -07:00
John "Elwin" Edwards
8b252e70a9 arogue5: fix player's typed responses getting put at the wrong place.
Some sections of code that prompt the user for a string of input were
calling get_str() with cw (the player-visible screen containing the
map), which caused whatever the player typed to get printed starting at
cw's idea of the cursor position, which was usually the Rogue's @-sign.
This corrupted the map.

The problem has been fixed by passing msgw (the message line at the top
of the screen) to get_str(), so the player's typing appears where msgw
thinks the cursor should be, which is in the sensible place right after
the prompt.  Some other get_str() invocations which used hw or stdscr
have been left unmodified.
2012-09-08 22:05:05 -07:00
John "Elwin" Edwards
5fe41fbc3a arogue5: fix the crash when checking prices in shops.
A buffer called curpurch, which stores a description of an item in a
trading post which the player might be interested in, was only 15
bytes.  It was overflowing into oldrp, a room pointer, leading to
segfaults.  The size of curpurch has been increased to LINELEN*2,
which matches the size of prbuf, which is returned by inv_name and
then strcpy()'d to curpurch.  As long as nothing overflows prbuf it
should be safe now.

NOTE that this breaks savefile compatibility.
2012-09-05 10:14:34 -07:00
John "Elwin" Edwards
e59194b5ce arogue5: fix support for keypad 5. 2012-08-12 14:45:58 +00:00
John "Elwin" Edwards
355fb33eb7 arogue5: avoid segfaulting if getpwuid() fails. 2012-08-11 23:45:34 +00:00
John "Elwin" Edwards
6e2b154419 arogue5: compile out wizard mode by default. 2012-08-11 21:58:20 +00:00
John "Elwin" Edwards
77dd2bd3b6 arogue5: change default program name and options. 2012-08-11 21:53:49 +00:00
John "Elwin" Edwards
4d11069d9c arogue5: update the score list before prompting to exit. 2012-08-11 20:58:24 +00:00
John "Elwin" Edwards
8c27cf1402 arogue5: add nonl() to prevent CR/LF confusion. 2012-08-11 18:56:32 +00:00
John "Elwin" Edwards
f0527564ea arogue5: add missing header files. 2012-08-11 17:19:03 +00:00
John "Elwin" Edwards
5ce56875ec arogue5: close security holes.
Prevent whoami (player name), file_name, and score_file from being
changed if the systemwide save location is being used.
2012-08-11 16:27:20 +00:00
John "Elwin" Edwards
4c16144c6b arogue5: implement logging. 2012-08-10 21:17:14 +00:00
John "Elwin" Edwards
38a8534eb5 arogue5: add the savedir feature. 2012-08-10 05:16:08 +00:00
John "Elwin" Edwards
14fad3b319 Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490) 2012-08-09 22:58:48 +00:00