Commit graph

82 commits

Author SHA1 Message Date
Eric S. Raymond
3640e5cb96 Refactoring step - change some visibilities. 2023-04-06 17:44:11 -04:00
Eric S. Raymond
f5ff25f52a Magic-number elimination. 2023-04-06 10:03:24 -04:00
Eric S. Raymond
25230068fe Partial REUSE cmpliance. 2023-04-03 11:25:11 -04:00
Torbjörn Andersson
54927c33e5 Spelling fixes 2023-04-02 07:32:24 +02:00
Eric S. Raymond
f07b3ba2d4 Address GitLab issue #66: Missing couple of ; in saveresume.c 2023-03-16 07:43:17 -04:00
Eric S. Raymond
87855f8124 Avoid a compiler warning. 2023-03-14 14:58:26 -04:00
Eric S. Raymond
5929a68b88 Real test coverage dor SAVE_TAMPERING. 2023-03-12 17:37:58 -04:00
Eric S. Raymond
282842c4a9 Whitespace trimming of save and resume names. 2023-03-12 12:10:30 -04:00
Eric S. Raymond
0ffb297801 Relax the savefile validity check a little.
There was a very old bug, probably predating the OpenAdventure port,
that would poke a stashed value of -1 into the snake object if you did
a save in endgame, and then fail the savefile validation on resume.
This was masked for a long time by a bug in put() just fixed a couple
of revisions ago.
2023-03-12 10:03:43 -04:00
Eric S. Raymond
04df0ce64c Add message and bailout on invalid save.
Note: save/resume still fails at saveresume.4
at this revision.
2023-03-12 06:39:57 -04:00
Eric S. Raymond
ba3248224e Add C coverage exclsion required by unbreaking the property setter. 2023-03-11 10:29:38 -05:00
Eric S. Raymond
643656fcc3 Complain to user on save/resume.restore when it's disabled. 2023-03-04 19:48:17 -05:00
Rob Swindell (on Debian Linux)
dfff80faa8 Add optional auto-save/restore feature using -a <filename> option
To enable use with online Bulletin Board Systems (BBSes) where users
may be disconnected unexpectedly, but would naturally want to resume
playing their same game, added support for an optional save game
path/filename to be specified on the command-line (very similar to
"-r <filename>"), except this save/restore file is:
1. automatically loaded/restored if it exists
2. automatically created when starting a new game
3. automatically updated when exiting a game for any reason
4. cannot be changed to a different path/filename by the user

Since a BBS server program can be expected to send a SIGHUP or SIGTERM
to the game process upon user disconnection (or timeout), those
signals are caught and a graceful termination will occur which saves
the current game state.

Build with ADVENT_AUTOSAVE defined to enable this option.

BUG:
The 'info' command still reports the save/suspend/pause commands as
valid, though they are not when this build option is used (same is
true of ADVENT_NOSAVE, and that doesn't apparently bother anyone).
2023-03-02 19:44:47 -08:00
Eric S. Raymond
94e7cc6505 Address Gitlab isse #62: Comment typos. 2023-03-01 13:04:53 -05:00
Eric S. Raymond
d320212622 Indent cleanup. 2022-04-18 10:31:13 -04:00
Eric S. Raymond
4069bf210b cppcheck cleanup. 2022-04-13 20:55:57 -04:00
Eric S. Raymond
49e2479efa Improve test coverage. 2022-04-07 06:42:20 -04:00
Eric S. Raymond
bb2b8e0fca Support execution of command script arguments. 2022-04-05 14:33:29 -04:00
Eric S. Raymond
0799bc2f79 Address Gitlib issu #57: Resume can't open save file...
...when auto-completed filename is followed by a space character.
2022-04-04 17:51:06 -04:00
Eric S. Raymond
989bdad3ee Add a warning to avoid CI breakage. 2019-02-28 22:42:59 -05:00
Eric S. Raymond
b2b4377f71 Bump the save format number, just in case. 2019-02-28 06:04:57 -05:00
Eric S. Raymond
81af59974b The FORTRAN-derived longs were semantically ints. Make it so.
Note. because we used fixed-length declrations in the right places, this
shouldn't break saves.

(Besides being right, this will someday make a port to Go a touch easier,
if we decide to do that.)
2019-02-28 05:58:16 -05:00
Eric S. Raymond
3ca9613bcd More coverage tweaks. 2018-11-15 13:33:16 -05:00
Eric S. Raymond
5ce427b62b Another coverage tweak. 2018-11-15 12:40:04 -05:00
Eric S. Raymond
79875c8088 Tweak code-coverage exclusions. 2018-11-15 12:18:27 -05:00
Eric S. Raymond
876fbb2f78 Prepare for sync with the issue #37 bugfix branch. 2018-11-14 11:52:55 -05:00
Eric S. Raymond
87452af448 Sync patch. 2018-11-14 11:43:38 -05:00
Eric S. Raymond
782c5c3f29 SPDXify the code. 2018-03-08 20:56:21 -05:00
NHOrus
5ff7592a51 Unlike objects, player doesn't go to -1 when destroyed.
Tighten bounds check.
2017-09-13 19:34:35 +03:00
NHOrus
076bb8908b If divident negative, then remainder is negative too.
RNG values need to be always positive.
Solution: Transposing positively by divisor. In all the two places it may happen.
2017-09-11 21:27:57 +03:00
NHOrus
9e2cb3c191 Put some of important parameters into fixed width signed integers
Massaged test files. Fixes issue #41
2017-09-11 00:58:13 +03:00
NHOrus
43f0cb232b Silenced fallthrough warning 2017-09-05 18:32:56 +03:00
NHOrus
96ead306b5 Prevent RNG overflow.
Pass save under validation by pointer, so we could mess with underlying
values a little. Only thing I feel we can safely and sanely modify.
2017-09-05 18:20:21 +03:00
NHOrus
0dd40bba32 Removed old copy-paste error
Put numdie bounds check in croak to prevent OOB access on negative
numdie while preserving tests
2017-09-05 17:46:38 +03:00
NHOrus
e5a0c6e2b7 Prevent tampering with PRNG parameters in save 2017-08-24 14:48:02 +03:00
NHOrus
917af2e744 Fixed copy-paste errors 2017-08-24 14:41:21 +03:00
NHOrus
17d94c46cd Prevent division by zero 2017-08-24 14:25:29 +03:00
NHOrus
25424a01db Verify bounds for linked lists 2017-08-24 13:47:57 +03:00
NHOrus
5e39abf730 Corrected limit for atloc, see init.c for filling double-linked list 2017-08-24 13:40:10 +03:00
NHOrus
aeaa0400cb Fix value, add check for linked locations 2017-08-24 13:02:51 +03:00
NHOrus
98b21323a6 Bounds check for properties; it is not violated in normal game 2017-08-24 11:21:10 +03:00
NHOrus
f496bff945 Syntax error 2017-08-13 15:58:35 +01:00
NHOrus
ad9c53abdb Validate dwarves and tally 2017-08-13 15:56:37 +01:00
NHOrus
f0dc3d3b7c Verify sanity of location arrays 2017-08-13 15:16:09 +01:00
NHOrus
36f72f1902 Validating sanity of locations in restored game 2017-08-13 15:13:20 +01:00
Jason S. Ninneman
26bf324e07 Use the '=' operator (not memcpy()) to shallow-copy structs. 2017-08-03 12:41:35 -07:00
NHOrus
63152e6714 Broke all logical or into multiline statement to show lcov's lies
Results are weird, some things that need to be checked aren't and
at least my local lcov doesn't show them as unchecked
2017-07-03 07:20:37 +03:00
Jason S. Ninneman
73278b1a3c Bump save file version number.
Also add missing space in the version mesage.
2017-07-02 09:55:53 -07:00
Jason S. Ninneman
d23111daba Replace datime() with just time().
Also make the 'savetime' value meaningful.

This removes a separate library dependency on some systems.
2017-07-02 09:46:01 -07:00
Aaron Traas
85f8334e17 centralize calls to make_zzword()
make_zzword() now called in set_seed(), because the only times it was
called in the entire application is after every invocation of set_seed().
2017-07-02 02:02:09 -04:00