Commit graph

245 commits

Author SHA1 Message Date
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
a6ec8a9595 Simplify some dependencies. 2024-01-03 06:15:04 -05:00
Torbjörn Andersson
b28eb66868 Spelling fixes. 2023-04-18 18:44:08 +02:00
Eric S. Raymond
6cef68cda5 Use fixed-lwength types to make the save format more portable 2023-04-17 07:24:51 -04:00
Eric S. Raymond
234da6b468 Remove unnecessary code duplication. 2023-04-17 07:06:56 -04:00
Eric S. Raymond
869c53d1b1 Comment polishing. 2023-04-15 10:00:23 -04:00
Eric S. Raymond
ef78c36ddb Improve state-macro encapsulation. 2023-04-15 09:29:28 -04:00
Eric S. Raymond
5d3205e1e9 Add explanatory comments. 2023-04-15 06:29:59 -04:00
Eric S. Raymond
4d4e8dce96 Magic-number elimination. 2023-04-10 19:27:07 -04:00
Eric S. Raymond
82c3ae5e65 Condition in alternative state-management macros.
These do not entirely work yet. #define FOUNDBOOL to enable them.

All tests pass, 100% coverage.
2023-04-10 19:26:18 -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
9cd7c53d78 Refactor put() function and calls. 2023-04-07 13:19:51 -04:00
Eric S. Raymond
8d4d64fafb Structurization of hints. 2023-04-07 10:52:16 -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
Eric S. Raymond
195e6e149b Apply loc_t type. 2023-04-07 08:18:50 -04:00
Eric S. Raymond
4369284c75 Boolification. 2023-04-07 07:35:28 -04:00
Torbjörn Andersson
7e21108e95 Spelling fixes. 2023-04-07 10:50:01 +02:00
Eric S. Raymond
4b08b726f9 Simplify the signature of savefile(). 2023-04-06 19:26:04 -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
fe378b9e13 Improved behavior when magic words are said before they're seen.
Note: there is a tiny risk that this could break savefile
compatibility, as I swiped an unused int member in the game structure
and turned it into a bool. int and bool *should* be the same sixe...
2023-04-05 19:49:38 -04:00
Eric S. Raymond
4ce4de190e Magic number removal. 2023-04-05 18:02:47 -04:00
Eric S. Raymond
9b53140f1c GO_* enums no longer have an order constraint. 2023-04-05 17:48:26 -04:00
Eric S. Raymond
25230068fe Partial REUSE cmpliance. 2023-04-03 11:25:11 -04:00
Eric S. Raymond
ff46cf7fac Add -d option 2023-03-29 16:04:36 -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
b7bf85904d Fix a formal-type glitch. 2023-03-11 09:44:51 -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
d9d58ea168 Base UNDEEP on the previiously unreferenced DEEP condition bit.
Removes the only dependency on the order of locations left in the macros.
2022-04-18 10:01:14 -04:00
Eric S. Raymond
4069bf210b cppcheck cleanup. 2022-04-13 20:55:57 -04:00
Eric S. Raymond
bb2b8e0fca Support execution of command script arguments. 2022-04-05 14:33:29 -04: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
83f432780a Remove use of Unicode number sign in comments.
"#" for this use is well established in English.  It's not worth opening the
i18n can of worms here.
2019-02-28 05:18:04 -05:00
Horst H. von Brand
894ac28186 Another typo
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2018-12-10 22:09:22 -03:00
Horst H. von Brand
64b120c03b A couple of "locaiton" in advent.h
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2018-12-10 21:38:27 -03:00
Aaron Traas
8c6593ad0c Commenting and cleanups 2018-12-10 10:56:35 -05:00
Aaron Traas
e7dc3eab5d Correct return types for all of the action handling functions in actions, so it's clear we're not just using arbitrary ints 2018-12-07 10:36:42 -05:00
Aaron Traas
2a5dac3d8c Abstracted a chuck of do_command() into seperate function do_move(), moved that call to main loop, so as to narrow the focus of do_command() to getting and processing commands. 2018-12-07 10:35:36 -05:00
Aaron Traas
5f4df123b4 Refactored; added state property to command struct to notate where in the lifecycle of command processing that the command is. 2018-12-05 15:05:55 -05:00
Eric S. Raymond
6667ffd1f1 Address GitLab issue #45: OSX Compile issue 2018-11-30 09:50:25 -05:00
Eric S. Raymond
08f77c692a Attempting voodoo change to banish GitLab error.
This shouldn't be necessary.
2018-11-18 12:39:04 -05:00
Eric S. Raymond
17e6078122 Remove some dead symbols revealed by coverage analysis. 2018-11-15 14:00:37 -05:00
Eric S. Raymond
a4c87aa0b3 Fix for GitLab issue #37: prompt incorrectly handled. 2018-11-14 13:01:39 -05:00
Eric S. Raymond
876fbb2f78 Prepare for sync with the issue #37 bugfix branch. 2018-11-14 11:52:55 -05:00