Commit graph

125 commits

Author SHA1 Message Date
NHOrus
45820bc8cd Reindend, compile out all save stuff 2017-07-01 16:46:51 +03:00
Eric S. Raymond
ab94051da1 Magic-number and state-arithmetic removal. 2017-07-01 09:21:47 -04:00
Jason S. Ninneman
2328739e51 Interim magic number replacement. 2017-07-01 06:15:54 -07:00
Eric S. Raymond
8675c4facd Less magical numbers. 2017-06-30 12:10:26 -04:00
Eric S. Raymond
1f45966dec Magic-number ellimination, contiguity warnings, cleanup. 2017-06-30 12:06:41 -04: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
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
d96d5db51f More magic-number removal. 2017-06-28 17:29:33 -04:00
Eric S. Raymond
b5260417dd Magic-number elimination. 2017-06-28 17:07:15 -04: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
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
Eric S. Raymond
f5719f1aba Magic-number elimination. 2017-06-28 11:45:53 -04:00
Jason S. Ninneman
004fe76917 Clean up missed actspk[] references. 2017-06-26 22:03:42 -07:00
Jason S. Ninneman
a76cbeccbb Use actions[].message instead of actspk[]. 2017-06-26 22:01:23 -07: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
b626371b6c Wire Section 8 YAML to runtime. 2017-06-26 00:09:50 -04:00
Eric S. Raymond
8a6e6aae7d Fully subsume section 7 into YAML. 2017-06-24 20:28:22 -04: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
07207420a2 Elimination of OBJTXT.
This means eveything in Section 13 of adventure.text has moved to YAML.
2017-06-24 09:41:39 -04:00
Eric S. Raymond
3a93b2b5f0 Elimination of OBJSND. 2017-06-24 09:08:48 -04:00
Eric S. Raymond
ea70341cfe Eliminate setting of OBJTXT sell for oyster - OBJTXT is now static.
A necessary step towards getting rid of it.
2017-06-23 15:50:15 -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
2848494a01 Proof of cobcept for state defines.
It is now possible in the YAML to declare defines for all state values
associated with an object.  This are visible in the C code and can be used
to replace magic numbers.
2017-06-23 14:07:44 -04:00
Eric S. Raymond
1e8c3a4a1d Support loud locations. 2017-06-23 11:16:37 -04:00
Eric S. Raymond
f47dc9f447 Location sounds are now declared by YAML. 2017-06-23 10:10:48 -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
433e787de8 Simple fix for GitLab issue #14: Behaviour of magic words changed
Say "Nothing happens" on "foo" not in Giant Room, rather than "What's
the matter, can't you read?  Now you'd best start over." which only
makes sense there.

It would be funnier to say something like "Well, that was remarkably
pointless." Maybe later.
2017-06-21 17:23:28 -04:00
Eric S. Raymond
fd6da15373 Fix GitLab issue #13 - The "eat" command exhibits strange behavior
The problem wasn't actually with "eat" but with "grate".  Processing
of any two-word command with an object of "grate", when given at certain
locations including the start, inappropriately jumped directly
to the movement code (ignoring the verb).

There was a similar bug in the ancestral 2.5, though it manifested slightly
differently.
2017-06-21 16:54:10 -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
Eric S. Raymond
e798355e80 Further code simplification. 2017-06-20 20:44:21 -04:00
Eric S. Raymond
237f1a876f Code simplification. 2017-06-20 20:39:45 -04:00
Eric S. Raymond
358fdd437b Chage read handler argument to by-value.
This (sort of) documents the fact that, unlike say() and attack(),
read() never scribbles on the interpreter's command block.

What those other functions are doing is unclean - though less so than
fully exposed globals. I don't see a way to fix it that isn't pretty
intrusive, alas.
2017-06-20 20:24:30 -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
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
NHOrus
e9aff2568f Even less magic 2017-06-19 20:18:20 +03:00
Eric S. Raymond
0b91efc9eb Restructure some code. 2017-06-19 09:46:04 -04:00
Eric S. Raymond
98b02eeeb1 Magic number elimination, repair some careless replace damage. 2017-06-19 08:37:19 -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
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