Commit graph

78 commits

Author SHA1 Message Date
John "Elwin" Edwards
35c5e434e6 Rearrange some Autoconf files.
Autoconf was failing to detect install-sh at the top level and needed
some explicit directions.  It also wants config.guess and config.sub to
be provided too.

A few other macros have also been updated.
2023-09-05 20:05:24 -04:00
John "Elwin" Edwards
8a4bf37667 Naming items should not use up a turn.
This was fixed by adding "after = FALSE;" to the relevant cases in
command().

Rogue V4 and V5 are not affected.
2021-10-31 21:35:53 -04:00
John "Elwin" Edwards
2a9d279baa Advanced Rogue 5, 7: fix some trading post messages.
When attempting to buy an unaffordable object, messages were often of
the form "You can't afford that a scroll of hold monster !", because
the object description (stored in curpurch) was the same text used in
inventory displays.

This has been worked around by inspecting the contents of curpurch and
using different message templates.
2021-10-24 20:26:21 -04:00
John "Elwin" Edwards
6a654fbe69 Update the Autoconf files.
These are mostly automatic updates for obsolete macros.
2021-05-11 22:30:03 -04:00
John "Elwin" Edwards
06cad9ee1e Fix one more batch of compiler warnings.
A few of these were potential bugs.
2021-05-04 21:03:47 -04:00
John "Elwin" Edwards
3dfd8fd09b Advanced Rogue family: fix some potential buffer overflows.
Some code for determining the score file location assumed that PATH_MAX
would be less than 1024, which cannot be guaranteed.

Advanced Rogue 5 and 7, and XRogue, have had the buffers for the file
name enlarged.  UltraRogue never called the functions, so the code has
been deleted instead.
2021-05-03 19:05:37 -04:00
John "Elwin" Edwards
ca9e48d5f6 Fix some warnings related to format strings. 2021-04-30 20:48:30 -04:00
John "Elwin" Edwards
6c3cd116ff Fix many compiler warnings.
There should only be two changes in behavior:

arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly
applied to characters who are not monks instead of monks who are not
empty-handed.

urogue/fight.c: fixed an interaction with the "debug" macro that could
cause the wrong message to be displayed.
2021-04-14 18:55:33 -04:00
John "Elwin" Edwards
7d459d7d36 Fix an assortment of compiler warnings.
A few potential bugs were removed in the process.  Much code cleanup
remains to be done.
2019-11-22 21:18:27 -05:00
John "Elwin" Edwards
338214459d Fix a portability issue with md_hasclreol().
Some games' implementation of md_hasclreol() poked around in ncurses
internals, which does not work for some ncurses build configuration.
Most games did not actually call md_hasclreol(), so it was removed.
There is a standard terminfo function which can retrieve the value of
the clr_eol capability, so this was used for rogue5.
2017-12-27 10:26:06 -05:00
John "Elwin" Edwards
359d0987a4 Remove version numbers from docdir paths.
Most Unix systems prefer to omit the versions.
2017-10-16 19:53:38 -04:00
John "Elwin" Edwards
172c83f254 Fix some potential problems detected by clang.
Most of these are unnecessary comparisons and functions returning the
wrong types.
2017-09-23 09:47:00 -04:00
John "Elwin" Edwards
614dcfffd2 Fix more header-related warnings.
This fixes all current default warnings with GCC7 on Linux.  That does
not mean the code is anywhere close to clean.
2017-09-22 16:24:40 -04:00
John "Elwin" Edwards
90d5708d84 Fix a few more compiler warnings. 2017-09-18 19:36:14 -04:00
John "Elwin" Edwards
0936c8f216 Excise md_putchar().
The function wrapped the standard putchar(), doing nothing beside
discarding the return value.  That could cause problems with tputs(),
which expects an int to be returned.
2017-09-18 19:11:57 -04:00
John "Elwin" Edwards
ab25967717 Fix potential segfaults at restore related to ctime().
In some games, restore() passes the result of ctime() to mvprintw() or
some other variadic message-formatting function.  If ctime() has not
been declared properly, its return type is inferred to be int instead
of char *.  This does not cause a warning because the compiler does not
know the correct type of variadic arguments.

On platforms where ints and pointers are not the same size, this can,
probably depending on alignment, result in a segfault that is not easy
to trace.

Including time.h fixes the problem.  Some games manually declared
ctime() and avoided the bug.  These declarations have also been
replaced with the include.
2017-09-15 20:51:10 -04:00
John "Elwin" Edwards
c661fd79d4 Use C stdio functions for score files and save files.
Switching from Unix file descriptor operations to C standard FILE*
functions will reduce portability problems.
2017-09-15 19:57:54 -04:00
John "Elwin" Edwards
f8d1f422c8 Remove an extra bracket from some Autoconf macros. 2017-09-10 17:30:13 -04:00
John "Elwin" Edwards
7eeb9ddcb6 Add some braces to a loop in parse_opts().
A for loop had no braces around its body, which was a single if-else
statement.  In Advanced Rogue 5, another statement had been added,
accidentally removing the if-else from the loop.  This could have
resulted in an out-of-bounds access to the options array.

In the other games, the added braces are only for clarity.
2017-02-10 09:02:58 -05:00
John "Elwin" Edwards
62047972cc Use more portable random seed generation.
The new function md_random_seed() has replaced time() + getpid() and
similar methods.  Putting everything in mdport.c slightly reduces the
warnings and workarounds.
2017-01-28 15:49:41 -05:00
John "Elwin" Edwards
63b2707739 Enable the logfile on 64-bit Windows.
It seems to work without any problems.

One use of a non-portable function was corrected in the process.
2016-05-17 21:28:34 -04:00
John "Elwin" Edwards
2d4a66298a Fix some functions not returning the right type. 2016-03-19 16:18:58 -04:00
John "Elwin" Edwards
8df0a6308d Merge the GCC5 and build fix branches.
This fixes all warnings produced by GCC 5, except the ones related to
system functions.  Those could be fixed by including the proper headers,
but it would be better to replace the system-dependent code with
functions from mdport.c.
2016-03-11 19:47:52 -05:00
John "Elwin" Edwards
e30aa0e491 Makefiles: don't rely on built-in implicit rules.
Not all make implementations will use CPPFLAGS when compiling C files.
2016-03-08 19:45:41 -05:00
John "Elwin" Edwards
a6c73eb65a Fix various overlooked causes of warnings.
GCC5 now produces under 300 lines of warnings, but the remaining ones
will require more complex solutions.
2016-03-06 21:02:59 -05:00
John "Elwin" Edwards
5cf0194676 Declare some function arguments as const.
Some functions, mostly in fight.c, declared variables as pointers to
const char but passed them to functions that took pointers to ordinary
char.  The strings did not actually get modified, so adding 'const' to
the function definitions removed the warnings.
2016-03-06 19:32:47 -05:00
John "Elwin" Edwards
fece552183 Don't force the use of GCC.
Due to incomplete autoconfiscation, most of the Makefiles ignored the
C compiler found by 'configure' and always used 'gcc'.
2016-03-06 17:09:17 -05:00
John "Elwin" Edwards
35bea2ba0d Use uniform return types for functions related to options.
Functions for printing options now return void.  Functions for setting
options now return int.  Argument types still vary, though converting
all the option pointers to void* would be possible.
2016-03-06 14:45:18 -05:00
John "Elwin" Edwards
0a354903e0 Daemons and fuses now return void.
Functions for starting and stopping daemons and fuses now expect the
type 'void (*func)()'.  Only a few functions in XRogue needed to be
modified to fit.  Determining the type of the argument is left for a
later date.

Building with GCC5 should now produce less than 200 lines of warnings
per game.
2016-03-05 20:49:37 -05:00
John "Elwin" Edwards
8bf09d3064 Merge the GCC5 and build fix branches. 2016-03-02 21:28:34 -05:00
John "Elwin" Edwards
f5c2898524 Makefile fixes related to installation.
'make install' and 'make uninstall' should now work correctly, placing
the documentation in the proper places.  Any directories needed will be
created.
2016-02-26 17:30:30 -05:00
John "Elwin" Edwards
eab5aa2ec4 Fix curses library detection.
A custom autoconf macro searched for the curses library, and provided an
option to use ncurses instead of a (presumably deficient) curses
implementation.  Unfortunately, some of the Makefiles ignored the
search's results.

Now that this is fixed, building against pdcurses should be easier too.
2016-02-12 15:12:37 -05:00
John "Elwin" Edwards
f38b2223c8 Advanced Rogue 5: convert to ANSI function declarations.
This still leaves over a thousand lines of warning messages, mostly
related to the return types of daemons and fuses.
2016-02-07 14:39:21 -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
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
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
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
8fed78336a ARogue family: don't hide messages caused by moving to a new level.
new_level() redraws the whole screen, including the message line, so if
msg() has just been called, the message will likely not last long
enough to be noticed.  These cases have been changed so that msg() is
called after new_level().

If a fall through a trapdoor is fatal, "You fall into a trap!" is no
longer printed, but the tombstone should make things clear.
2015-06-29 20:37:32 -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
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