Commit graph

107 commits

Author SHA1 Message Date
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
Eric S. Raymond
3a93b2b5f0 Elimination of OBJSND. 2017-06-24 09:08:48 -04:00
Eric S. Raymond
15b7c00e0a Abolish unclean operation on OBJSOUND - it's now static.
Save/Restore no longer needs to treat it specially.
2017-06-23 15:13:47 -04:00
Eric S. Raymond
ecff53d3a8 Name the lamp, grate, and bird states. 2017-06-23 14:59:32 -04:00
Eric S. Raymond
6c6c72f327 Replace macros with condition bits. 2017-06-22 18:41:25 -04:00
Eric S. Raymond
51494657fd Give the FORCED property a real cond bit. Delete some unused code. 2017-06-22 17:49:06 -04:00
Eric S. Raymond
7f7f49b739 Switch fully over to YAML generation of condition bits. COND is gone. 2017-06-22 17:28:39 -04:00
Eric S. Raymond
537c4511e2 Generate initializer from YAML for Section 9 bits. 2017-06-22 16:45:38 -04:00
Eric S. Raymond
9c7c23b75a Improve namespace hygiene. 2017-06-22 08:58:11 -04:00
Aaron Traas
3c8530663d xstrdup() not called anywhere in source. Removed. 2017-06-21 13:50:13 -04: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
9437ccca36 WD* globals abolished. They're now members of the command block. 2017-06-20 20:06:32 -04:00
Eric S. Raymond
7a3f3ec7a6 Introduce command encapsulation structure. 2017-06-20 17:40:41 -04:00
Jason S. Ninneman
6ecd001093 Fix typo and compiler warning. 2017-06-19 14:49:15 -07:00
Jason S. Ninneman
ba64c57eb0 Add token_to_packed() utility function. 2017-06-19 14:45:32 -07:00
Eric S. Raymond
a678b68b39 Mostly confine assumptions about what token_t is to misc.c
The token_t things like WD* are presently longs and will someday be
char[6].  By introducing some trivial functions - wordeq(),
wordempty(), and wordclear() - we mostly hide the difference.

All runtime knowledge about packing now lives only in misc.c and the
list of magic WORD_* defines in advent.h.  Outside this, literals are
now accessed through #define names that could expand to either longs
or strings.

Still to be done: WD* values are sometiimes compated to zero in
ways implying they can be negative. Must figure out wat thus means.
2017-06-19 17:21:45 -04:00
Eric S. Raymond
87961483a2 Concentrate all magic-number values for packed-string constants in one place. 2017-06-19 16:53:55 -04:00
Eric S. Raymond
79f5701e07 More semantic typing - a step towards eliminating packing. 2017-06-19 14:20:45 -04:00
Eric S. Raymond
0eb85f233a Boolify some logical variables. 2017-06-19 13:21:15 -04:00
NHOrus
e9aff2568f Even less magic 2017-06-19 20:18:20 +03:00
Eric S. Raymond
4c100261c4 Magic-number elimination. 2017-06-19 11:09:24 -04:00
Eric S. Raymond
d46407d327 Magic-number elimination. Fix possible glitch in troll-bridge death. 2017-06-19 11:00:23 -04:00
Jason S. Ninneman
624ba16aad Change YES() to take const char* arguments. 2017-06-18 19:51:59 -07:00
Eric S. Raymond
fa9b6d317f No longer restricted to 6-character FORTRAN identifiers. 2017-06-18 21:17:57 -04:00
Bob Little
04eca720d9 magic numbers, show usage, fixed linty warnings
Show usage when using bad parameter with ./advent
Converted magic numbers to enums for BUG().  Also bug now shows
stringify'ed version of bug enumeration (not just a number).
2017-06-18 19:33:21 -04:00
Jason S. Ninneman
550734fd3f Gut and rebuild YES() with cleaner approach that doesn't rely on packing.
The new support functions get_input() and echo_input() (and others not made yet) will eventually replace GETIN() and MAPLIN().
2017-06-18 13:39:59 -07:00
Eric S. Raymond
ba5c7dacb5 Remove unused code. 2017-06-18 13:20:04 -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
937714f31d Magic-number limination. Improve test coverage. 2017-06-18 09:44:34 -04:00
Bob Little
d844c2a391 Added 'linty' target for make
"make linty" does lots of error checking while compiling.
Simplified the standard make's CFLAGS.
Cleaned up code to eliminate resulting warnings generated by "make linty".
2017-06-17 22:28:40 -04:00
Bob Little
a3485d2a41 Move a few prototypes and static'ed a few functions
Moved prototypes for initialise() and action() from main.c to advent.h
Made the following functions static, so they wouldn't require prototypes:
   sig_handler (main.c)
   spotted_by_pirate (main.c)
   light (actions.c)
2017-06-17 18:19:09 -04:00
NHOrus
300d246179 Resume from file on startup 2017-06-17 09:20:42 +03:00
Peje Nilsson
a6feda5307 Split saveresume to reduce complexity
Fixed a bug where current time was printed as version of advent
when loading an old savegame.
2017-06-16 14:16:02 -04:00
Eric S. Raymond
d97574d35c Magic-number elimination. 2017-06-16 08:55:53 -04:00
Eric S. Raymond
a57d93ce35 Magic-number elimination. 2017-06-16 07:00:57 -04:00
Eric S. Raymond
ec031b0417 Name another magic number. 2017-06-15 17:34:06 -04:00
Eric S. Raymond
14486d67d4 Magic-numnber elimination. 2017-06-15 12:19:06 -04:00
Eric S. Raymond
0dc78b4221 More use of manifest constants. 2017-06-15 10:59:43 -04:00
NHOrus
46bb20deb3 Lowering the scope And cleaning up some warnings from static analysis 2017-06-14 15:17:02 -04:00
Eric S. Raymond
4993be4c08 Include LCG state in game saves. 2017-06-14 13:00:28 -04:00
Eric S. Raymond
dc6a5751ed Magic-number elimination. 2017-06-13 18:54:53 -04:00
Eric S. Raymond
d61cab352e Makere magic numbers for cond bits into symbols. 2017-06-13 18:38:04 -04:00
Eric S. Raymond
a3c14ba077 Abolish setup check, there's no possibility of restart.
Note, this silently breaks old saves.
2017-06-13 10:20:15 -04:00
Eric S. Raymond
760e2e3282 Remove more unused code. 2017-06-13 09:42:18 -04:00
Eric S. Raymond
fb93f9d67e Remove now-unused code. 2017-06-13 09:35:39 -04:00
Jason S. Ninneman
ca0e042952 Use strdup() instead of strncpy(). 2017-06-12 21:36:06 +00:00
Eric S. Raymond
a044f10411 Turn MOD from function to macro.
I experimented with expanding it to ((N % M) everywhere, but in context
the MOD(N, M) notation seems easier to read.
2017-06-12 17:33:21 -04:00
Eric S. Raymond
66c22301ed Add -s option.
Re-enables pasting multiline sequences to the > prompt (for making checkfiles).
2017-06-12 16:51:35 -04:00