Commit graph

172 commits

Author SHA1 Message Date
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
Eric S. Raymond
9b585f40d8 Two coverage imprivenents, one by recognizing dead code. 2017-07-16 05:33:43 -04:00
Eric S. Raymond
d1e29319fa Code cleanup. 2017-07-14 13:10:13 -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
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
Aaron Traas
4d7858d333 Cleaned up do_command() a little 2017-07-10 17:21:09 -04:00
NHOrus
53b68161ff Two more lines of coverage; more cleanup for macros 2017-07-09 20:25:28 +03:00
NHOrus
a3ffa2455b № and minor syntax correction 2017-07-08 21:00:26 +03:00
Eric S. Raymond
1cbc3d827b Eliminate magic numbers from C side of condition handling. 2017-07-07 15:01:25 -04:00
NHOrus
8f5c262e6d Semantic type for verb 2017-07-06 18:40:11 +03:00
NHOrus
de2b1894f2 obj_t in actions. And some more magical word removal
Also, reindented everything, as usual
2017-07-06 10:05:11 +03:00
Eric S. Raymond
73608b6307 Further infiltrare semantic types. 2017-07-05 16:55:16 -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
8613f0b3d9 Magic number elimination
Special state/locations for game.fixd object array
2017-07-05 07:56:36 +03:00
Eric S. Raymond
abf820bb5c Magic-number elimination. 2017-07-04 14:40:10 -04:00
Eric S. Raymond
f37a413524 Magic-number elimination. 2017-07-04 14:15:20 -04:00
Eric S. Raymond
a8ac2f477a Abstract out some state arithmetic. 2017-07-04 13:41:12 -04:00
NHOrus
294f2b8a6d Removed magic from checks for liquids 2017-07-04 15:18:49 +03:00
Jason S. Ninneman
4f78dfea24 Begin replacing tests on strings with tests on vocab IDs. 2017-07-03 18:21:25 -07:00
Jason S. Ninneman
07e7b8131e Upgrade get_vocab_id() to handle empty strings. 2017-07-03 18:08:04 -07: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
393010ec41 Entirely eliminate wd1x and wd2x members of the command block.
In the process, fix another case-smashing bug.
2017-07-03 16:49:33 -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
Eric S. Raymond
e712f4c0e0 Magic-number elimination. 2017-07-02 14:47:21 -04:00
Jason S. Ninneman
6af38a92f6 Eliminate the global game.blklin. 2017-07-02 10:37:10 -07:00
Eric S. Raymond
346bcf9458 Magic-number elimination. 2017-07-02 13:22:50 -04: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
Jason S. Ninneman
e66b4561d4 Never write the input prompt to log files. 2017-07-01 11:04:21 -07:00
Jason S. Ninneman
dec4cf3968 Jettison the -s option.
It's no longer needed since libedit doesn't have the 'paste bug'.
2017-07-01 07:22:53 -07:00
Jason S. Ninneman
36a6cbca34 Add a DEMOTE_WORD() macro. 2017-07-01 06:18:24 -07:00
Jason S. Ninneman
2328739e51 Interim magic number replacement. 2017-07-01 06:15:54 -07:00
Eric S. Raymond
065caace64 Move PRNG initialization to simplify cheat.c 2017-07-01 08:59:45 -04: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
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
Jason S. Ninneman
030fa6d27d The bugtype enum doesn't need explicit numbers. 2017-06-30 13:25:12 -07:00
Jason S. Ninneman
40acab43af Remove disused function definitions. 2017-06-30 11:08:54 -07:00
Jason S. Ninneman
4fe9b94db4 Remove more disused macros. 2017-06-30 11:05:37 -07: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