Commit graph

101 commits

Author SHA1 Message Date
Eric S. Raymond
cb293f4aa4 Rename some macos for clarity. 2024-06-30 14:48:44 -04:00
Eric S. Raymond
5b917084b0 Minor repair of savefile validation code. 2024-02-04 11:43:36 -05:00
Eric S. Raymond
0175344caa 1TBS reflow, the bracening. 2024-01-29 12:14:56 -05:00
Eric S. Raymond
be429016af 1TBS reflow with clang-format. 2024-01-28 08:09:39 -05:00
Eric S. Raymond
258b7703f2 Simplify SPDX copyright lines to the shortest canonical form...
...because if we leave them longer than 80 chars, reflow is going to
mess them up.
2024-01-28 07:14:46 -05:00
Eric S. Raymond
2db3bed3f1 Fix up copyright notices. SPDX wants only one per file. 2024-01-03 06:30:40 -05:00
Eric S. Raymond
75bc031b46 Reduce include complexity. 2024-01-03 05:55:57 -05:00
Nicola Smaniotto
5016978156
saveresume.c: add missing semicolon
Fixes compilation when ADVENT_NOSAVE is set
2023-11-27 17:41:26 +01:00
Eric S. Raymond
4d4e8dce96 Magic-number elimination. 2023-04-10 19:27:07 -04:00
Eric S. Raymond
1af01ff91f Confine use of STATE_NOTFOUND to macros. 2023-04-08 23:04:34 -04:00
Eric S. Raymond
02987d0330 Encapsulate object-state state tests and setttings in macros.
This isn't a complete refwctoring, just the part than can be done with
transparetly correct capture of inlinre logic into macros.

No logic changes. Tests pass, 100% coverage.
2023-04-08 19:35:41 -04:00
Eric S. Raymond
eebc87f889 Structurize object info. 2023-04-07 10:35:13 -04:00
Eric S. Raymond
8fe07c8bf3 Structurize locatiuon info. 2023-04-07 09:30:33 -04:00
Eric S. Raymond
ff9c73a37d Structurize the informaruin about dwarves. 2023-04-07 09:15:20 -04:00
Torbjörn Andersson
7e21108e95 Spelling fixes. 2023-04-07 10:50:01 +02:00
Eric S. Raymond
520d365f74 Resume now detects if a save has incompatible endianness. 2023-04-06 19:41:22 -04:00
Eric S. Raymond
4b08b726f9 Simplify the signature of savefile(). 2023-04-06 19:26:04 -04:00
Eric S. Raymond
58cf204eba Implement the magic-cookie check and its test. 2023-04-06 19:03:02 -04:00
Eric S. Raymond
d16822a583 Give savefiles an identifting header. SAve format version gets bumped. 2023-04-06 17:54:02 -04:00
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