Commit graph

89 commits

Author SHA1 Message Date
John "Elwin" Edwards
3c781f89fe srogue: remove md_droppriv() and md_resetpriv().
These partial privilege-dropping functions are no longer needed.
2015-08-01 16:31:03 -04:00
John "Elwin" Edwards
2e4f161e40 srogue: improve privilege handling.
Setgid privileges are now dropped when not required.  restore() is now
less complex.
2015-08-01 16:23:24 -04:00
John "Elwin" Edwards
bc5b26fece srogue: open the score and log files when the program starts.
Super-Rogue can now use the same privilege-dropping scheme as the other
games.
2015-08-01 15:12:11 -04:00
John "Elwin" Edwards
5d0e3dd646 Don't swap signal handlers in md_shellescape().
md_shellescape() sets SIGINT and SIGQUIT to be ignored, storing the
previous handlers, and restores them after the shell exits.  But it
mixed up the two handlers.

Since the signals were usually handled by the same function, this fix
doesn't have much effect, but anything that makes signal code less
confusing is a good thing.
2015-06-08 10:01:25 -04:00
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
120beada5a srogue: more compatibility improvements.
Randomness now uses mdport, and xcrypt.c has been replaced with the
rogue5 version.

Super-Rogue now builds on MinGW.
2014-05-03 10:31:30 -07:00
John "Elwin" Edwards
b9cc9cf3a7 srogue: add and use more md_* portable functions.
Privileges and memory usage checks are now more portable.
2014-05-02 15:06:23 -07:00
John "Elwin" Edwards
791df4324f srogue: use functions from mdport.c.
Shell escape, passwd entries, terminal settings, and most signal
handling is now done with the more portable md_* functions.
2014-04-30 14:46:30 -07:00
John "Elwin" Edwards
de1e0f2759 srogue: add a complete mdport.c.
srogue/mdport.c is copied from rogue5/mdport.c, with slight changes.
2014-04-27 08:29:14 -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
dff96acf36 srogue: remove unnecessary pointer cast.
Casting char* to int before a comparison doesn't alter the result, and
isn't safe if sizeof(char *) != sizeof(int).
2014-03-27 11:09:30 -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
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
6d1d59555c srogue: enable the keypad when restoring.
keypad() was only being called when starting a new game, which meant
the arrow keys did not work when restoring a saved game.
2013-09-03 15:39:04 -07: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
e9c1b3c8b9 srogue: fix backspace key during prompts.
md_readchar() handled the key properly, but get_str(), which is called
when prompting user entry, called wgetch() instead of md_readchar().
2013-09-03 14:02:15 -07:00
John "Elwin" Edwards
138383b394 srogue: add install and uninstall targets to Makefile 2013-09-02 15:47:37 -07:00
John "Elwin" Edwards
35a6ab583c srogue: begin porting to autoconf.
Super-Rogue can now be built with './configure && make', though
'make install' does not work yet, and there may be problems with
portability.
2013-09-01 20:50:52 -07:00
John "Elwin" Edwards
7d4d7dbbe8 srogue: allow wizard mode to be compiled out. 2013-08-31 14:24:31 -07:00
John "Elwin" Edwards
9d5cb81410 srogue: fix backspace key.
Once the full mdport.c is added to srogue, erasechar() will be replaced
with md_erasechar().
2013-08-28 18:54:35 -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
4aa582dfb6 srogue: add arrow-key support.
This is a first attempt which may not be completely portable.
2013-08-10 17:43:58 -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
a210387f8d srogue: don't store machine-dependent metadata in the savefile.
Super-Rogue, like Rogue V4, stored data of machine-dependent length in
the savefile, to prevent cheating.  This made saved games non-portable.
Also deleted was a check that used this data, and prevented restoring
savefiles from backup.

This change BREAKS SAVEFILE COMPATIBILITY, but old files can be
converted by removing the block at offset 0x1e with length
sizeof(ino_t) + sizeof(dev_t) + 2 * sizeof(time_t).  That seems to be
0x14 on i686 and 0x20 on x86_64.
2013-08-06 19:02:58 -07:00
John "Elwin" Edwards
6badae1890 rogue3, srogue: showing the version should not take a turn. 2012-05-24 05:10:38 +00:00
John "Elwin" Edwards
5114a73d41 srogue: include missing headers. 2012-01-27 17:29:30 +00:00
John "Elwin" Edwards
0195eba9bb srogue: move default locations to /var. 2012-01-24 18:30:17 +00:00
John "Elwin" Edwards
f0a6e6d37c srogue: don't display a room when a monster steps on a teleport trap. 2011-11-09 18:41:21 +00:00
John "Elwin" Edwards
61fb648a88 srogue: prevent aquiring unlimited scrolls of aquirement. 2010-12-07 22:31:33 +00:00
John "Elwin" Edwards
1d8ea533bd Make sure the score list appears in all situations. 2010-12-07 16:46:07 +00:00
John "Elwin" Edwards
02c8fd2586 srogue: Fix CR/LF playback bug. 2010-12-06 19:43:32 +00:00
John "Elwin" Edwards
07b5ea7c50 srogue: add logging. 2010-12-04 14:45:38 +00:00
John "Elwin" Edwards
7aa541b5a8 srogue: fix '2n orange potions' description bug. 2010-12-04 02:26:49 +00:00
John "Elwin" Edwards
e3ef50b351 srogue: fix bug causing healing on invalid commands. 2010-11-27 16:49:44 +00:00
John "Elwin" Edwards
a90fd134ba Prevent changing name or savefile when SAVEDIR is used. 2010-11-27 16:22:30 +00:00
John "Elwin" Edwards
20d469d64f srogue: add support for SAVEDIR 2010-11-25 17:28:29 +00:00
John "Elwin" Edwards
ce4b930551 Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490) 2010-11-25 12:21:41 +00:00