Commit graph

74 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
c11938aed5 Place1TBS mandatory braces. 2024-01-28 07:14:46 -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
9e9731d59b Turn an odd test into a macro disjunction.
Was game.objects[i].prop > STATE_NOTFOUND.

This finishes off all the statec comparisons we want to macroize.
2023-04-08 21:17:55 -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
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
25230068fe Partial REUSE cmpliance. 2023-04-03 11:25:11 -04: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
9a1b4d021e Improve message emission when player wins. 2023-02-28 15:10:54 -05:00
Eric S. Raymond
20859304c0 Eliminate a bad code smell. 2023-02-28 06:45:24 -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
782c5c3f29 SPDXify the code. 2018-03-08 20:56:21 -05: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
NHOrus
3d2ba18355 Do not base endgame bonus on arbitrary messages
This may break save files, but doesn't, due to padding
2017-07-14 16:38:25 +03:00
Eric S. Raymond
abf820bb5c Magic-number elimination. 2017-07-04 14:40:10 -04:00
Eric S. Raymond
e712f4c0e0 Magic-number elimination. 2017-07-02 14:47:21 -04:00
Jason S. Ninneman
8bc08773fa Various cleanups.
* Remove disused macro.
* GCC doesn't seem to mind if IGNORE() is left off.
* Enumify phase codes.
* Use EXIT_* macros in all exit() calls.
* How did this even work without extern?
* Give advent.h a much-needed makeover.
* Use the chomp indicator in YAML string blocks to avoid code ugliness.
2017-07-01 03:19:33 +00:00
NHOrus
0f15c9e0f3 Breaking one-line conditionals 2017-06-29 22:51:30 +03:00
NHOrus
bf2fa227f0 Unshadowed k2 into k3 in main.c
Reindented everything
2017-06-29 20:11:53 +03:00
Jason S. Ninneman
1ee0e5c7b0 Finish newdb -> dungeon renaming. 2017-06-29 08:54:55 -07:00
Jason S. Ninneman
83fb64b5a8 Jettison MAKEWD(), GETTXT(), vocab(), GETIN(), and the old db compiler. 2017-06-29 08:54:35 -07:00
Jason S. Ninneman
2fac8d1aef object_descriptions[] is now objects[]. 2017-06-26 09:43:11 -07:00
Eric S. Raymond
c3a2816821 Replace magic MINTRS/MAXTRS with a treasure attribute in YAML. 2017-06-24 10:47:59 -04:00
Eric S. Raymond
985137d9c7 Rationalize names of structure array sizes.
Everything that camn be #define become one, in all caps to signify that
it's a constant.
2017-06-24 09:55:32 -04:00
Jason S. Ninneman
79ffdb36f0 Switch to 0-indexing for hint handling code. 2017-06-21 10:26:23 -07:00
Jason S. Ninneman
c8f6ff3701 Abolish HNTMAX and HNTSIZ in favor of HINT_COUNT.
This change necessitated include guards on newdb.h.
2017-06-21 10:25:12 -07:00
Peje Nilsson
deb61e3dcd Replace SETPRM/[PR]SPEAK with variadic [pr]speak
Rename/rewrite old speak to vspeak and take a va_list
Add new speak that takes variadic parameters

Remove SETPRM & PARMS[]
2017-06-21 13:14:53 -04:00
Eric S. Raymond
ddb0df85b3 YAMLify section 11 (hints). 2017-06-21 11:22:18 -04:00
Eric S. Raymond
f6373dd32e Section 10 (class thresholds) is now parsed entirely from YAML. 2017-06-21 06:17:20 -04:00
Jason S. Ninneman
06e8d5a83e Abolish MAXDIE in favor of maximum_deaths. 2017-06-18 20:02:03 -07:00
Eric S. Raymond
fa9b6d317f No longer restricted to 6-character FORTRAN identifiers. 2017-06-18 21:17:57 -04:00
Jason S. Ninneman
672ef17d4c Rename newspeak() to speak(). 2017-06-18 10:06:14 -07:00
Eric S. Raymond
704b86afbb Refactor scoring so score() does not conditionally exit. 2017-06-18 12:51:05 -04:00
Eric S. Raymond
b3057f038b Re-format to consistent indent style with "make indent". 2017-06-18 06:18:51 -04:00
Eric S. Raymond
900822d38f Magic-number elimination. 2017-06-17 19:39:25 -04:00
Eric S. Raymond
a57d93ce35 Magic-number elimination. 2017-06-16 07:00:57 -04:00
Eric S. Raymond
eaee02aa09 Squasgh -Wextra warnings. 2017-06-15 19:39:43 -04:00
Eric S. Raymond
0d5f9064c7 Comment fix. 2017-06-15 12:20:49 -04:00
Eric S. Raymond
14486d67d4 Magic-numnber elimination. 2017-06-15 12:19:06 -04:00
NHOrus
f1f7cfd4e9 Localizing variables 2017-06-15 16:16:21 +03:00
Eric S. Raymond
a141f021d5 Meaningful shortnames for RSPEAK messages. 2017-06-15 07:35:03 -04:00
Eric S. Raymond
fef9657e3e Move from random message numbers to ARB_* symbols generate from YAML. 2017-06-14 17:36:30 -04:00
Jason S. Ninneman
15ff262d17 More retrofitting. 2017-06-11 15:42:25 -07:00
Eric S. Raymond
e6f183ba7f Use C idioms for increment/decrement. 2017-06-10 12:38:40 -04:00
Eric S. Raymond
fa2fb48436 Localize K in score.c. 2017-06-07 15:20:19 -04:00
Eric S. Raymond
1b59175d8d Scoring code is fully translated to C. 2017-06-07 15:00:16 -04:00
Eric S. Raymond
db4b972fc7 Reformat score.c like normal C, since it now almost is.
Still two gotos to get rid of.
2017-06-07 14:50:45 -04:00