Commit graph

318 commits

Author SHA1 Message Date
John "Elwin" Edwards
59f448e92e Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
2016-01-31 13:45:07 -05:00
John "Elwin" Edwards
0f87d5b4d8 rogue4: add more function declarations. 2016-01-28 18:55:47 -05:00
John "Elwin" Edwards
c1d6a6af6a rogue4: fix most GCC5 warnings.
Converting all function definitions to ANSI style accounts for most of
the change.  This has exposed other problems, such as daemons not
actually being their stated type, that will require more careful
solutions.
2016-01-27 19:41:05 -05:00
John "Elwin" Edwards
384386d71c rogue3, rogue5: fix all GCC5 warnings.
GCC5 enables more warnings by default, including pre-ANSI implicit
function definitions.  These two games now build cleanly, but the others
will require more effort.
2016-01-23 09:35:14 -05:00
John "Elwin" Edwards
b937606ef8 rogue5: fix 'make install'.
The location of install-sh was hardcoded, so installation has not worked
since that script was moved to the top directory in 78ca6502.
2016-01-22 21:16:54 -05:00
John "Elwin" Edwards
b731962f3b rogue3: replace alarm() calls with a portable function.
Calls to alarm() in main.c are replaced with md_start_checkout_timer(),
so the #ifdefs around nonportable code can be confined to mdport.c.
2016-01-22 19:19:48 -05:00
John "Elwin" Edwards
11f7731a3d Initialize some more pointers for the benefit of MSVC.
There should be no more errors with Visual Studio 2015, in Debug or
Release mode.
2016-01-21 21:10:23 -05:00
John "Elwin" Edwards
71bc6ff210 arogue5: fix a typo that broke compilation with GCC 5.
"msg" had been used instead of "msgw".  I'm not sure why neither GCC 4
nor MSVC caught this.
2016-01-17 18:59:50 -05:00
John "Elwin" Edwards
e1d228b946 Merge the MSVC branch. 2015-11-27 08:59:24 -05:00
John "Elwin" Edwards
231295a1ab Advanced Rogue 7: rename magic users to magicians.
Class names with spaces in them confuse anything that parses the
logfile.  The documentation does refer mostly to magicians.
2015-08-22 10:55:53 -04:00
John "Elwin" Edwards
d20fe81e22 Update the Visual Studio project files.
These files were produced by Visual Studio 2015 on Windows 8.1.
2015-08-18 13:23:56 -04:00
John "Elwin" Edwards
13f4a96d93 XRogue: fix md_htonl() and md_ntohl().
xcrypt requires them.  The implementations in state.c used htonl() and
ntohl(), which aren't available on Windows.  So the Advanced Rogue 7
versions were copied over.

This implementation could be problematic on other systems where
sizeof(long) == 8.  Maybe someday I can convert everything to C99 and
use stdint.h.
2015-08-13 17:17:40 -04:00
John "Elwin" Edwards
b2ebcf72c9 XRogue: add and use more md_ functions.
Portable md_fileno() and md_unlink() have been added to state.c.
2015-08-13 15:15:21 -04:00
John "Elwin" Edwards
7d750a4410 XRogue: fix some header includes. 2015-08-13 14:57:26 -04:00
John "Elwin" Edwards
50961af028 Permit not defining score and log files. 2015-08-13 07:47:01 -04:00
John "Elwin" Edwards
6813e9c5bf Advanced Rogue 7: add and use more md_ functions.
md_fileno() and md_fdopen() are now included.  I still hope to rewrite
everything to use FILE *'s.
2015-08-13 07:38:57 -04:00
John "Elwin" Edwards
916a683bf6 Advanced Rogue 7: remove some unused md_ functions.
md_hasclreol() and md_sleep() were not actually portable.  If they were
needed in the future, fixing them would be possible.
2015-08-12 17:03:15 -04:00
John "Elwin" Edwards
9c93a66db7 Fix some preprocessor directives.
Include process.h in the right place, and use the correct definition of
PATH_MAX, when compiling on Windows.
2015-08-12 16:56:19 -04:00
John "Elwin" Edwards
295a180ea1 Advanced Rogue 7: initialize multiple variables.
MSVC complained that they might be used uninitialized.  In some cases,
this might have been possible.

XRogue already has initializations for all these variables.
2015-08-12 15:42:02 -04:00
John "Elwin" Edwards
b41fb230b0 Advanced Rogue 5: remove an unneeded fstat() call.
The results of the call are no longer used to check for savefile
copying.
2015-08-11 16:19:04 -04:00
John "Elwin" Edwards
9ad85754bd Advanced Rogue 5: replace calls to unlink() with md_unlink(). 2015-08-11 16:12:09 -04:00
John "Elwin" Edwards
4381177d66 Advanced Rogue 5: rearrange some of mdport.c.
process.h is now included in the proper place for compiling with MSVC.

md_sleep() has been removed.  If it were used anywhere, it could have
been fixed by replacing _sleep() with Sleep().
2015-08-11 15:29:31 -04:00
John "Elwin" Edwards
47df21eb66 Advanced Rogue 5: add and use md_fdopen().
Portability is improved.
2015-08-11 15:15:09 -04:00
John "Elwin" Edwards
c0f3e1f004 Advanced Rogue 5: initialize some variables. 2015-08-11 13:13:08 -04:00
John "Elwin" Edwards
6fda9fb94b Advanced Rogue 5: don't declare getenv() in rogue.h.
stdlib.h can declare it better.
2015-08-11 12:28:17 -04:00
John "Elwin" Edwards
bd3da25934 Advanced Rogue 7: rearrange messages from potions of food detection.
The message about detecting food now appears before the food symbols
are displayed.  I think this is closer to the original behavior.
2015-08-10 20:39:40 -04:00
John "Elwin" Edwards
1713cb840c Merge a bug fix from the stable branch. 2015-08-07 09:07:14 -04:00
John "Elwin" Edwards
aad9327bd4 srogue: fix an uninitialized variable.
In wanderer(), if rp == hr, the loop could test ch before its value has
been set.  Initializing ch to '-' now causes the loop to repeat until
a location is found.
2015-08-04 11:39:49 -04:00
John "Elwin" Edwards
268b30f851 srogue: provide type definitions if needed.
If not defined in headers, uid_t and gid_t will be defined as
unsigned ints, and pid_t as int.
2015-08-03 21:29:16 -04:00
John "Elwin" Edwards
3b34109c93 srogue: clean up configuration in mdport.c.
curses.h is already included in rogue.h and doesn't need to be included
twice more in mdport.c.

Also set flags for some features when they are present.
2015-08-03 17:16:42 -04:00
John "Elwin" Edwards
00142507db srogue: add and use md_fdopen().
The implementation was copied from rogue4.  Using fdopen() is necessary
because the scorefile needs both encread() and encwrite().  For some
reason I have failed to discover, one of them uses FILE *'s and the
other uses file descriptors.
2015-08-03 09:27:43 -04:00
John "Elwin" Edwards
e857a2cec6 srogue: make checking directories slightly more portable.
MSVC sys/stat.h doesn't define S_ISDIR().
2015-08-03 09:05:15 -04:00
John "Elwin" Edwards
214c2f6608 srogue: remove remnants of deleted savefile checks.
save_file() used fstat() and direct write() as part of the inode check
which was deleted in f11eeafc.  These operations no longer had any
effect.
2015-08-03 07:04:48 -04:00
John "Elwin" Edwards
b1e2b6206d srogue: replace unlink() with md_unlink().
md_unlink_open_file() might be needed eventually.
2015-08-03 06:42:59 -04:00
John "Elwin" Edwards
2c4ad7e941 srogue: another unistd.h which should not be included on Windows. 2015-08-03 06:30:09 -04:00
John "Elwin" Edwards
e79714e88d srogue: don't try to include unistd.h on Windows. 2015-08-02 15:25:24 -04:00
John "Elwin" Edwards
0b952fe136 Merge Super-Rogue fixes into the MSVC testing branch. 2015-08-02 12:25:44 -04:00
John "Elwin" Edwards
de013693fd srogue: prevent overflowing the score file name.
If SCOREFILE is not defined, roguehome() is called to find a directory
for the score file.  It copies up to PATH_MAX-20 bytes from an
environment variable to a static buffer.  Later these are strcpy()'d to
scorefile, which is of size LINLEN.  Unfortunately LINLEN is 80 and
PATH_MAX is at least 256.  On Linux, it happens to be 4096.

I haven't yet managed to crash or exploit it, but there are surely no
beneficial consequences, so roguehome() has been modified to check the
length, and the string it returns is also checked in main().
2015-08-02 12:14:47 -04:00
John "Elwin" Edwards
dea62ef934 srogue: initialize some pointers.
MSVC complained that they might be used uninitialized.
2015-08-01 21:23:55 -04:00
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
097b315235 rogue4: don't try to close the scorefile if it isn't open.
The MSVC library uses a debug assertion to prevent closing file
descriptors that are negative.  This is always the case with the
scoreboard file descriptor if the scoreboard has been compiled out.
2015-07-31 20:12:33 -04:00
John "Elwin" Edwards
4bd72ac69f rogue4: rearrange some includes.
Using MSVC with pdcurses, curses.h has to be included after windows.h
and before process.h.  This is apparently because bool is now a
built-in type which pdcurses is not allowed to redefine.  But I don't
entirely understand how the headers are interacting, and I don't think
the MSDN page does either.
2015-07-31 20:01:44 -04:00
John "Elwin" Edwards
00d28d536a rogue3: initialize various pointers.
MSVC is afraid they might get used while uninitialized.
2015-07-31 15:34:34 -04:00
John "Elwin" Edwards
2d3d25c5e9 Remove an extra '='.
This is a bug I can't blame on the original authors.
2015-07-23 19:28:12 -04:00
John "Elwin" Edwards
3ebd6da87d arogue7: fix messages from detection potions.
Another fix for overwritten messages, this time for potions of monster
detection and magic detection.

I've made the message appear before the display of information, which
may be closer to the originally intended behavior.
2015-07-02 16:27:39 -04:00
John "Elwin" Edwards
c864015af9 Advanced Rogue family: fix messages from some scrolls.
When scrolls of magic mapping or gold detection were read, their
characteristic messages were displayed before overwriting the whole
screen to show the newly discovered information.  They are now shown
after updating the screen, so they will be visible.
2015-07-02 08:04:16 -04:00
John "Elwin" Edwards
366f2a27a8 arogue7: fix messages from potions of food detection.
Updates to the screen took place in the wrong order, causing messages
and "--More--" prompts to be hidden before they could be seen.

There are probably similar bugs caused by other items.
2015-06-30 15:32:32 -04:00
John "Elwin" Edwards
4c696eef47 arogue7: fix inventory display bug again.
Removing the call to msg() in restore() resulted in msgw remaining as
it was when the game was saved.  This results in another display glitch
like that fixed by r163.  Adding an empty message puts msgw into a
reliable state.
2015-06-30 12:00:02 -04:00