Commit graph

19 commits

Author SHA1 Message Date
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
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
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
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
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
e8e6e604c3 Advanced Rogue 7: convert to ANSI-style function declarations.
Almost 1500 lines of compiler warnings remain, and the GCC developers
are already working on a new version with even more warnings turned on
by default.
2016-02-19 21:02:28 -05: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
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
b369d09125 arogue7: fix the backspace key in prompts.
md_readchar() now translates KEY_BACKSPACE to the erase character.

XRogue seems to work already.
2015-05-28 09:41:29 -04:00
John "Elwin" Edwards
d793ca961f arogue7, xrogue: add support for keypad 5.
Keypad 5 is now equivalent to the '.' key.

XRogue does not include md_readchar() and its ability to work around
deficiencies in the terminfo entry. So the key will not be recognized
in screen/tmux or anywhere else without the kb2 capability.  Adding
md_readchar() would be more complex than it was for Super-Rogue, since
XRogue already does KEY_* interpretation in command().
2015-05-27 17:29:32 -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
ea4244de91 arogue7, xrogue: prevent potential NULL dereferencing.
It is possible for getpwuid() to fail and return NULL.  Various md_get*
functions now check for this.
2015-05-18 10:53:22 -04:00
John "Elwin" Edwards
3095366864 arogue7: add missing header includes. 2015-05-08 16:45:41 -04:00
John "Elwin" Edwards
cf121ade21 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490) 2015-05-08 15:24:40 -04:00