Commit graph

217 commits

Author SHA1 Message Date
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
Eric S. Raymond
87452af448 Sync patch. 2018-11-14 11:43:38 -05:00
NHOrus
db2daf1da4 Type constants to prevent overflow 2017-09-12 08:18:17 +03:00
NHOrus
4e4c2e0198 Be consistent 2017-09-11 00:58:13 +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
25424a01db Verify bounds for linked lists 2017-08-24 13:47:57 +03:00
NHOrus
0fbd79b608 Reindentation 2017-08-13 15:56:07 +01:00
Eric S. Raymond
cf92b9d9d6 Remove duplicative phase code. 2017-08-03 15:51:39 -04:00
Jason S. Ninneman
24d102781c Typedefify command_t; simplify code accordingly. 2017-08-03 08:29:46 -07:00
Jason S. Ninneman
5c30d6429f Simplify command word handling. 2017-08-03 08:24:18 -07:00
Jason S. Ninneman
5c91ea3739 Encapsulate command words into their own struct. 2017-08-03 08:24:18 -07:00
Jason S. Ninneman
a15e7c9f91 Add command_word_t, for command words. 2017-08-03 08:16:19 -07:00
Jason S. Ninneman
0d3393ebee Datatype definition for command word types. 2017-08-03 08:16:19 -07:00
Eric S. Raymond
a00229050a Remove unused phase codes. 2017-08-01 19:26:29 -04:00
Aaron Traas
ca5374edc3 Modified action() to take take a copy of command rather than a pointer.
It should be safer now that we're not scribbling all over command in
action(), as it's closer to pure. Also fixed a bug in say.
2017-07-21 18:27:02 -04:00
Aaron Traas
e8a627f964 Specials excised from adventure.yaml 2017-07-21 17:15:23 -04:00
Aaron Traas
5337e00725 Fix to Gitlab issue #32. Now SEED and WASTE are in adventure.yaml
NOTE: the tests are all updated because now, like every other action,
SEED and WASTE have a \n before their output, as they correctly use
SPEAK
2017-07-21 10:23:02 -04:00
Eric S. Raymond
ef236aea3b More type hygiene. 2017-07-21 07:44:09 -04:00
Eric S. Raymond
a3c159660b Comment cleanup, semantic types, information hiding. 2017-07-21 07:38:09 -04:00
Eric S. Raymond
609159ad6d Abolish as many undifferentiated long variables as possible.
Simple counter become ints.
2017-07-20 18:49:08 -04:00
Eric S. Raymond
7c3f834bca Full comments for all game structure members. 2017-07-20 18:24:57 -04:00
Eric S. Raymond
617f368673 Comment and structure cleanup. 2017-07-20 17:42:31 -04:00
Eric S. Raymond
51182c6bc9 More comment cleanup. 2017-07-20 17:25:03 -04:00
Eric S. Raymond
535d9e7964 Comment cleanup. 2017-07-20 17:25:03 -04:00
Aaron Traas
a167945e19 Information hiding - moved all of command input parsing to misc.c
get_command_input() is effectively an I/O function that takes raw input
and makes it into a command_t. With other I/O functions, it belongs in
misc.c.

This alos allowed me to make 4 other functions static, as they were only
called by get_command_input();
2017-07-20 16:02:54 -04:00
Eric S. Raymond
6fda3acbe6 Remove unused enum. 2017-07-20 13:46:42 -04:00
Eric S. Raymond
aa5870a92e Some vocabulary lookup code can be hidden from main.c. 2017-07-20 10:38:59 -04:00
Eric S. Raymond
8bd947b54d Last remnants of packing removed.
As a bonus, a bug in %S pluralization became obvious and was fixed.
2017-07-20 10:36:22 -04:00
Eric S. Raymond
2fca59d9fd Information hiding. 2017-07-16 15:23:03 -04:00