Commit graph

270 commits

Author SHA1 Message Date
Jason S. Ninneman
24d102781c Typedefify command_t; simplify code accordingly. 2017-08-03 08:29:46 -07:00
Jason S. Ninneman
23ae7edb10 Upgrade get_vocab_metadata() to use command_type_t. 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
0d3393ebee Datatype definition for command word types. 2017-08-03 08:16:19 -07:00
Eric S. Raymond
06c8c97738 Exclude %V from coverage since we removed it from the test suite. 2017-08-01 19:55:34 -04:00
Aaron Traas
8765f49fdc Address Gitlab issue #35 2017-07-22 14:41:23 -04:00
Aaron Traas
30f13c6c25 Back up to 100% coverage. 2017-07-21 17:22:03 -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
a3c159660b Comment cleanup, semantic types, information hiding. 2017-07-21 07:38:09 -04:00
Eric S. Raymond
b27f767cc6 Fix a prototype. 2017-07-20 22:53:15 -04:00
Eric S. Raymond
6718c57d49 Address GitLab issue #34: static char* get_input() is not a prototype 2017-07-20 22:04:01 -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
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
243d05b4f8 Fix core dump in debug mode due to uninitialized allocated storage. 2017-07-20 12:58:42 -04:00
Eric S. Raymond
b7af7b9e87 Prevent OB1 error. 2017-07-20 11:27:02 -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
2fa530340d No more packing in the parser.
As a side effect, ill-formed input consisting of "_\n" gives
a slighty better error message.
2017-07-20 10:17:56 -04:00
Eric S. Raymond
d998965faf Make compparuson out to TOKLEN only explicit in vocab lookups. 2017-07-20 05:54:55 -04:00
Eric S. Raymond
2fca59d9fd Information hiding. 2017-07-16 15:23:03 -04:00
Eric S. Raymond
d1e29319fa Code cleanup. 2017-07-14 13:10:13 -04:00
NHOrus
03b2f1c86e Removed unused code, reindented 2017-07-13 21:52:27 -04:00
Jason S. Ninneman
50efa22849 Express word type with an enum instead of magic numbers.
* Make a cleaner function for getting vocab metadata.
* Get rid of magic numbers.
* Purge get_vocab_id().
* Abolish the *_WORD() macros.
* Add FIXME comment on some ugliness.
2017-07-12 10:35:00 -07:00
Eric S. Raymond
4a4c113624 Prevent game from uttering solecisms about the "floor" when outside. 2017-07-12 00:19:16 -04:00
Eric S. Raymond
1cbc3d827b Eliminate magic numbers from C side of condition handling. 2017-07-07 15:01:25 -04:00
NHOrus
551838cea2 Deal around newline-only lines pruned to zero-lenght
Test for that, too
2017-07-07 11:21:37 +03:00
NHOrus
ef97d579ea Don't zero stuff twice 2017-07-07 11:18:02 +03:00
NHOrus
ca7ac4063f Magic-number elimination and fix
More test coverage for some of the cases
2017-07-06 17:55:56 +03:00
Eric S. Raymond
73608b6307 Further infiltrare semantic types. 2017-07-05 16:55:16 -04:00
NHOrus
725105b4a2 Made feeding a switch instead of elsif chain 2017-07-05 15:41:36 -04:00
NHOrus
40ff648431 Moved state_change to misc.c to start using it in main.c, too 2017-07-05 20:23:34 +03:00
NHOrus
c35cf99966 Static analysis warnings squished 2017-07-05 17:45:12 +03:00
Eric S. Raymond
fd57b3b5bd Fix dropped stitch in last commit. 2017-07-05 02:55:51 -04:00
Eric S. Raymond
d522d22c71 Magic-number elimination. 2017-07-05 02:53:39 -04:00
Eric S. Raymond
df87c596fb Under oldstyle, mangled echoed unknown text to simulate old behavior. 2017-07-05 02:34:36 -04:00
Eric S. Raymond
f37a413524 Magic-number elimination. 2017-07-04 14:15:20 -04:00
NHOrus
babf08ddc4 Cleaned up unused variables 2017-07-04 15:18:49 +03:00
Jason S. Ninneman
07e7b8131e Upgrade get_vocab_id() to handle empty strings. 2017-07-03 18:08:04 -07:00
Eric S. Raymond
1c4fcaf43e Discard implementation of %L and %U format specifiers, now never used. 2017-07-03 18:40:06 -04:00
Eric S. Raymond
df36b62c74 Reducing use of dynamic allocation forecloses many errors. 2017-07-03 17:53:25 -04:00
Eric S. Raymond
6e67222206 Information hiding. 2017-07-03 17:21:06 -04:00
Eric S. Raymond
4b51b06b73 Simplify tokenization code. 2017-07-03 17:13:28 -04:00
Eric S. Raymond
a768555312 Use the raw buffer in tr command structure for editing.
This fixes some minor bugs. Unknown words are no longer truncated
nor uppercased on echo.
2017-07-03 12:52:28 -04:00
Eric S. Raymond
f03bde268e Refactor tokenization to save raw tokens and use static buffer space...
...rather than dynamic storage.

As a side effect, this seems to have fixed a very ninor bug in the processing
of the bare word 'nothing'.  But I don't know where the bug was.  Not happy.
2017-07-03 08:53:10 -04:00
Eric S. Raymond
eba8015059 Magic-number elimination. 2017-07-03 07:14:15 -04:00
NHOrus
63152e6714 Broke all logical or into multiline statement to show lcov's lies
Results are weird, some things that need to be checked aren't and
at least my local lcov doesn't show them as unchecked
2017-07-03 07:20:37 +03:00
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