Commit graph

223 commits

Author SHA1 Message Date
NHOrus
38970a1c98 Unspk'd pour command 2017-07-03 06:12:19 +03:00
Jason S. Ninneman
6af38a92f6 Eliminate the global game.blklin. 2017-07-02 10:37:10 -07:00
NHOrus
8456b866ff Rationalize attack logic
Fix the compiler warnings about bunching ands with ors
2017-07-02 20:29:51 +03:00
Aaron Traas
7eaefce61d Moved application settings to settings_t struct
Since logfp, oldstyle, and prompt were application settings, rather than
have them all as global vars, move them to a single global var, seperate
from game state, as they aren't, technically, game state, but are
application settings.
2017-07-02 12:52:17 -04:00
Jason S. Ninneman
d23111daba Replace datime() with just time().
Also make the 'savetime' value meaningful.

This removes a separate library dependency on some systems.
2017-07-02 09:46:01 -07:00
Aaron Traas
22a557efb1 Coverage -- version command 2017-07-02 02:22:52 -04:00
Aaron Traas
85f8334e17 centralize calls to make_zzword()
make_zzword() now called in set_seed(), because the only times it was
called in the entire application is after every invocation of set_seed().
2017-07-02 02:02:09 -04:00
Jason S. Ninneman
e66b4561d4 Never write the input prompt to log files. 2017-07-01 11:04:21 -07:00
Eric S. Raymond
0d0b8df0a3 Ignore l g z i under oldstyle. 2017-07-01 12:35:31 -04:00
Jason S. Ninneman
ad3b097c9e Replace linenoise with libedit in code and build. 2017-07-01 07:22:53 -07:00
NHOrus
0a87fc9f78 Spread documentation from init.c It was empty without anything to document. Reindented, too 2017-07-01 08:53:03 -04:00
Eric S. Raymond
9714bf8c82 Magic-number elimination. 2017-07-01 01:59:06 -04:00
NHOrus
c83df10dc6 Stop leaking memory 2017-06-30 23:26:18 -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
Eric S. Raymond
ba9e933f20 Use YAML block-literal syntax to avoid wrapped lines.
In vspeak(), andle text with extra trailing \n.
2017-06-30 16:33:31 -04:00
NHOrus
94ea37d2bc Plugged little linenoise memory leaks. 2017-06-30 21:42:37 +03:00
Eric S. Raymond
e10637c419 Implement and document %V escape so version only needs to be set once. 2017-06-30 14:35:18 -04:00
Jason S. Ninneman
d9d089bdcc Remove some disused stuff. 2017-06-30 10:56:38 -07:00
Aaron Traas
ffb8393985 Documentation and comment cleanup.
Also, renove uused enums.
2017-06-29 16:37:07 -04:00
Eric S. Raymond
3001fb1dc1 Re-indented. 2017-06-29 15:45:59 -04:00
Eric S. Raymond
58a8a761e2 Fix an OB1 bug in allocation. 2017-06-29 13:43:36 -04: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
074d2c8a0f Remove MAPLIN(). Fold common.[ch] into other files and remove them. 2017-06-29 08:54:35 -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
50435465a6 Completely wire vocab words in YAML to the code.
This massive patch:
* Finishes working all the vocab words into YAML structures.
* Adds vocab ID generator functions.
* Redoes the input-getting system, removing the need for GETIN(),
  GETTXT(), etc.
* Changes advent<->ascii mapping to avoid the special 'shift'
  character.
* Works around some bad behavior in the dragon attack logic.
* Handles the reservoir magic word without changing the database
  contents.
2017-06-29 01:59:37 -07:00
Eric S. Raymond
1ed8126912 Implement and document state-changes messages in YAML.
Examples at the lamp and grate.  This is a way to pull strings out of
arbitrary_messages and make them part of the object definition.
2017-06-28 16:14:23 -04:00
NHOrus
aca6d79087 Some more linter warnings 2017-06-28 15:09:05 -04:00
Aaron Traas
60847652aa Test coverage: make LCOV ignore code unreachable without interactive shell 2017-06-28 13:23:34 -04:00
Aaron Traas
6521d49c07 Test coverage: make LCOV ignore bug() and all calls to BUG()
In theory, these should be unreachable, so they shouldn't be covered
with testing.
2017-06-28 13:23:34 -04:00
Aaron Traas
94aca03203 Test coverage: make LCOV ignore sig_handler and OOM check 2017-06-28 13:23:34 -04:00
Aaron Traas
1e643da216 Remove unused code 2017-06-27 16:13:49 -04:00
Jason S. Ninneman
2fac8d1aef object_descriptions[] is now objects[]. 2017-06-26 09:43:11 -07:00
Eric S. Raymond
59243cf8bc Take FORTRANish upper-case function names to C-style lowercase...
...except for a few we're planning to get rid of.  This will avoid some
upcoming collisions with macros defined from YAML.
2017-06-26 10:19:33 -04:00
Eric S. Raymond
3a93b2b5f0 Elimination of OBJSND. 2017-06-24 09:08:48 -04:00
Jason S. Ninneman
97241e87d7 Quick-fix the 'pillo bug'.
Once parsing no longer depends on text being broken up into
5-char tokens, the ugly hack to adventure.yaml must go away.
2017-06-21 22:43:16 -07:00
Aaron Traas
3c8530663d xstrdup() not called anywhere in source. Removed. 2017-06-21 13:50:13 -04: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
Jason S. Ninneman
9cda8ad2e2 Don't exit on EOF from get_input(). 2017-06-20 13:43:46 -04:00
Eric S. Raymond
e37f858b08 Comment polishing. 2017-06-20 13:38:11 -04:00
Eric S. Raymond
018ca9ae37 Fix off-by-one error that enabled the fuzzer to find a crash hole.
One has to allocate space for the trailing NUL, too.
2017-06-20 07:20:03 -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
NHOrus
e9aff2568f Even less magic 2017-06-19 20:18:20 +03:00
Jason S. Ninneman
624ba16aad Change YES() to take const char* arguments. 2017-06-18 19:51:59 -07:00
Eric S. Raymond
83ff9d0c0e Attempt to deconfuse the coverage analyzer. 2017-06-18 20:33:36 -04:00
Eric S. Raymond
fd02259c7f Reindent and cleanup. 2017-06-18 20:24:37 -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
65e2e472dd Fix bug that made YES() case-sensitive.
Also fix a related memory leak.
2017-06-18 14:14:13 -07:00