open-adventure.git
7 years agoImprove comments, eliminate magic numbers.
Eric S. Raymond [Sat, 24 Jun 2017 16:22:25 +0000 (12:22 -0400)]
Improve comments, eliminate magic numbers.

7 years agoGive generate constant arrays the const specifier.
Eric S. Raymond [Sat, 24 Jun 2017 15:07:07 +0000 (11:07 -0400)]
Give generate constant arrays the const specifier.

Also, move the adventure.txt format documentation to dungeon.c to be
removed when that file is.

7 years agoReplace magic MINTRS/MAXTRS with a treasure attribute in YAML.
Eric S. Raymond [Sat, 24 Jun 2017 14:42:23 +0000 (10:42 -0400)]
Replace magic MINTRS/MAXTRS with a treasure attribute in YAML.

7 years agoLOCSIZ -> NLOCATIONS, finishing limit-name cleanup.
Eric S. Raymond [Sat, 24 Jun 2017 14:20:36 +0000 (10:20 -0400)]
LOCSIZ -> NLOCATIONS, finishing limit-name cleanup.

7 years agoMore fixed limits (NOBJECTS, LOCSIZ) stop being fixed.
Eric S. Raymond [Sat, 24 Jun 2017 14:18:33 +0000 (10:18 -0400)]
More fixed limits (NOBJECTS, LOCSIZ) stop being fixed.

7 years agoRationalize names of structure array sizes.
Eric S. Raymond [Sat, 24 Jun 2017 13:55:32 +0000 (09:55 -0400)]
Rationalize names of structure array sizes.

Everything that camn be #define become one, in all caps to signify that
it's a constant.

7 years agoElimination of OBJTXT.
Eric S. Raymond [Sat, 24 Jun 2017 13:41:39 +0000 (09:41 -0400)]
Elimination of OBJTXT.

This means eveything in Section 13 of adventure.text has moved to YAML.

7 years agoCorrect buggy behavior of sign in endgame. Add a test for this.
Eric S. Raymond [Sat, 24 Jun 2017 13:30:15 +0000 (09:30 -0400)]
Correct buggy behavior of sign in endgame. Add a test for this.

7 years agoExtend test coverage. read sign in endgame.
Eric S. Raymond [Sat, 24 Jun 2017 13:15:40 +0000 (09:15 -0400)]
Extend test coverage. read sign in endgame.

7 years agoElimination of OBJSND.
Eric S. Raymond [Sat, 24 Jun 2017 12:45:22 +0000 (08:45 -0400)]
Elimination of OBJSND.

7 years agoExtend test coverage of vending-machine actions.
Eric S. Raymond [Sat, 24 Jun 2017 12:06:42 +0000 (08:06 -0400)]
Extend test coverage of vending-machine actions.

7 years agoImprove test coverage.
Eric S. Raymond [Sat, 24 Jun 2017 03:30:17 +0000 (23:30 -0400)]
Improve test coverage.

7 years agoEliminate setting of OBJTXT sell for oyster - OBJTXT is now static.
Eric S. Raymond [Fri, 23 Jun 2017 19:50:15 +0000 (15:50 -0400)]
Eliminate setting of OBJTXT sell for oyster - OBJTXT is now static.

A necessary step towards getting rid of it.

7 years agoAbolish unclean operation on OBJSOUND - it's now static.
Eric S. Raymond [Fri, 23 Jun 2017 19:13:47 +0000 (15:13 -0400)]
Abolish unclean operation on OBJSOUND - it's now static.

Save/Restore no longer needs to treat it specially.

7 years agoName the lamp, grate, and bird states.
Eric S. Raymond [Fri, 23 Jun 2017 18:21:25 +0000 (14:21 -0400)]
Name the lamp, grate, and bird states.

7 years agoProof of cobcept for state defines.
Eric S. Raymond [Fri, 23 Jun 2017 18:07:44 +0000 (14:07 -0400)]
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.

7 years agoDocumentation polishing.
Eric S. Raymond [Fri, 23 Jun 2017 15:27:20 +0000 (11:27 -0400)]
Documentation polishing.

7 years agoSupport loud locations.
Eric S. Raymond [Fri, 23 Jun 2017 15:16:37 +0000 (11:16 -0400)]
Support loud locations.

7 years agoLocation sounds are now declared by YAML.
Eric S. Raymond [Fri, 23 Jun 2017 14:10:48 +0000 (10:10 -0400)]
Location sounds are now declared by YAML.

7 years agoobjsound.py: add a (temporary) YAML transformer for translating Section 13.
Eric S. Raymond [Fri, 23 Jun 2017 13:19:50 +0000 (09:19 -0400)]
objsound.py: add a (temporary) YAML transformer for translating Section 13.

This will go away after it's applied/

7 years agoAdd YAML markup for location sounds.
Eric S. Raymond [Fri, 23 Jun 2017 11:54:49 +0000 (07:54 -0400)]
Add YAML markup for location sounds.

7 years agoToss unused parts of dungeon.c and init.c
Eric S. Raymond [Fri, 23 Jun 2017 02:33:24 +0000 (22:33 -0400)]
Toss unused parts of dungeon.c and init.c

7 years agoReplace macros with condition bits.
Eric S. Raymond [Thu, 22 Jun 2017 22:30:36 +0000 (18:30 -0400)]
Replace macros with condition bits.

7 years agoGive the FORCED property a real cond bit. Delete some unused code.
Eric S. Raymond [Thu, 22 Jun 2017 21:49:06 +0000 (17:49 -0400)]
Give the FORCED property a real cond bit.  Delete some unused code.

7 years agoSwitch fully over to YAML generation of condition bits. COND is gone.
Eric S. Raymond [Thu, 22 Jun 2017 21:28:39 +0000 (17:28 -0400)]
Switch fully over to YAML generation of condition bits. COND is gone.

7 years agoGenerate initializer from YAML for Section 9 bits.
Eric S. Raymond [Thu, 22 Jun 2017 19:56:42 +0000 (15:56 -0400)]
Generate initializer from YAML for Section 9 bits.

7 years agoUse YAML references to tie hints to locations.
Eric S. Raymond [Thu, 22 Jun 2017 18:27:22 +0000 (14:27 -0400)]
Use YAML references to tie hints to locations.

This change makes locbit.py obsolete; it's deleted.

7 years agoFixups to the adventure.yaml commentary.
Jason S. Ninneman [Thu, 22 Jun 2017 17:20:42 +0000 (10:20 -0700)]
Fixups to the adventure.yaml commentary.

7 years agoLocation YAML now has conditions.
Eric S. Raymond [Thu, 22 Jun 2017 15:59:41 +0000 (11:59 -0400)]
Location YAML now has conditions.

COND initionalization doesn't use these yet. That's the next step.

7 years agolocbit.py: Can't set a FORCED attribute in the YAML...
Eric S. Raymond [Thu, 22 Jun 2017 15:24:00 +0000 (11:24 -0400)]
locbit.py: Can't set a FORCED attribute in the YAML...

...it has to be computed from the travel arrays.

7 years agoRepair a check file.
Eric S. Raymond [Thu, 22 Jun 2017 15:14:42 +0000 (11:14 -0400)]
Repair a check file.

7 years agoCheck in the tool for folding Section 9 COND bits into YAML.
Eric S. Raymond [Thu, 22 Jun 2017 13:46:09 +0000 (09:46 -0400)]
Check in the tool for folding Section 9 COND bits into YAML.

Needs to be in the repo history for reference, though it won't
be manifest after the conversion.

We shouldn't actually apply this until the murk around FORCED has been
dispelled.

7 years agoImprove namespace hygiene.
Eric S. Raymond [Thu, 22 Jun 2017 12:58:11 +0000 (08:58 -0400)]
Improve namespace hygiene.

7 years agoPatch around non-working pillo bug fix.
Eric S. Raymond [Thu, 22 Jun 2017 11:24:45 +0000 (07:24 -0400)]
Patch around non-working pillo bug fix.

7 years agoQuick-fix the 'pillo bug'. 130/head
Jason S. Ninneman [Thu, 22 Jun 2017 05:43:16 +0000 (22:43 -0700)]
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.

7 years agoSimple fix for GitLab issue #14: Behaviour of magic words changed
Eric S. Raymond [Wed, 21 Jun 2017 21:23:28 +0000 (17:23 -0400)]
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.

7 years agoFix GitLab issue #13 - The "eat" command exhibits strange behavior
Eric S. Raymond [Wed, 21 Jun 2017 20:54:10 +0000 (16:54 -0400)]
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.

7 years agoRevert "Test coverage - Almost all of score.c". It's breaking tests.
Eric S. Raymond [Wed, 21 Jun 2017 20:43:27 +0000 (16:43 -0400)]
Revert "Test coverage - Almost all of score.c".  It's breaking tests.

7 years agoRevert "Test coverage - 100% score.c". It's breaking tests.
Eric S. Raymond [Wed, 21 Jun 2017 20:37:59 +0000 (16:37 -0400)]
Revert "Test coverage - 100% score.c". It's breaking tests.

7 years agoTest coverage - 100% score.c 129/head
Aaron Traas [Wed, 21 Jun 2017 19:10:23 +0000 (15:10 -0400)]
Test coverage - 100% score.c

7 years agoTest coverage - Almost all of score.c
Aaron Traas [Wed, 21 Jun 2017 19:04:41 +0000 (15:04 -0400)]
Test coverage - Almost all of score.c

7 years agoxstrdup() not called anywhere in source. Removed.
Aaron Traas [Wed, 21 Jun 2017 17:50:13 +0000 (13:50 -0400)]
xstrdup() not called anywhere in source. Removed.

7 years agoSwitch to 0-indexing for hint handling code. 127/head
Jason S. Ninneman [Wed, 21 Jun 2017 17:22:45 +0000 (10:22 -0700)]
Switch to 0-indexing for hint handling code.

7 years agoAbolish HNTMAX and HNTSIZ in favor of HINT_COUNT.
Jason S. Ninneman [Wed, 21 Jun 2017 17:01:16 +0000 (10:01 -0700)]
Abolish HNTMAX and HNTSIZ in favor of HINT_COUNT.

This change necessitated include guards on newdb.h.

7 years agoReplace SETPRM/[PR]SPEAK with variadic [pr]speak
Peje Nilsson [Wed, 21 Jun 2017 16:34:07 +0000 (18:34 +0200)]
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[]

7 years agoResolve GitLab issue #3. Applies MISRA and CERT guidelines.
David James Sherman [Wed, 21 Jun 2017 15:09:02 +0000 (17:09 +0200)]
Resolve GitLab issue #3.  Applies MISRA and CERT guidelines.

MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case

MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
literal suffix

CERT DCL16-C. - Use "L," not "l," to indicate a long value

CERT DCL16-CPP. - Use "L," not "l," to indicate a long value

CERT, DCL50-J. - Use visually distinct identifiers

7 years agoTest Coverage -- lots of new pieces of actions.c 125/head
Aaron Traas [Wed, 21 Jun 2017 16:14:24 +0000 (12:14 -0400)]
Test Coverage -- lots of new pieces of actions.c

7 years agoDocumentation polishing.
Eric S. Raymond [Wed, 21 Jun 2017 15:58:58 +0000 (11:58 -0400)]
Documentation polishing.

7 years agoDocumentation and polishing.
Eric S. Raymond [Wed, 21 Jun 2017 15:45:16 +0000 (11:45 -0400)]
Documentation and polishing.

7 years agoYAMLify section 11 (hints).
Eric S. Raymond [Wed, 21 Jun 2017 13:41:01 +0000 (09:41 -0400)]
YAMLify section 11 (hints).

7 years agoDocument the YAML, remove some dead code, fix typos.
Eric S. Raymond [Wed, 21 Jun 2017 11:39:10 +0000 (07:39 -0400)]
Document the YAML, remove some dead code, fix typos.

7 years agoSection 10 (class thresholds) is now parsed entirely from YAML.
Eric S. Raymond [Wed, 21 Jun 2017 10:17:20 +0000 (06:17 -0400)]
Section 10 (class thresholds) is now parsed entirely from YAML.

7 years agoFurther code simplification.
Eric S. Raymond [Wed, 21 Jun 2017 00:44:21 +0000 (20:44 -0400)]
Further code simplification.

7 years agoCode simplification.
Eric S. Raymond [Wed, 21 Jun 2017 00:39:45 +0000 (20:39 -0400)]
Code simplification.

7 years agoChage read handler argument to by-value.
Eric S. Raymond [Wed, 21 Jun 2017 00:24:30 +0000 (20:24 -0400)]
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.

7 years agoWD* globals abolished. They're now members of the command block.
Eric S. Raymond [Wed, 21 Jun 2017 00:06:32 +0000 (20:06 -0400)]
WD* globals abolished. They're now members of the command block.

7 years agoFix another ob1 error.
Jason S. Ninneman [Tue, 20 Jun 2017 23:09:33 +0000 (16:09 -0700)]
Fix another ob1 error.

7 years agoClean out some disused variables.
Jason S. Ninneman [Tue, 20 Jun 2017 22:46:25 +0000 (15:46 -0700)]
Clean out some disused variables.

7 years agoFix off-by-one error.
Jason S. Ninneman [Tue, 20 Jun 2017 22:43:08 +0000 (15:43 -0700)]
Fix off-by-one error.

7 years agoRefactor how turn threshold penalties are accounted for.
Jason S. Ninneman [Tue, 20 Jun 2017 22:35:30 +0000 (15:35 -0700)]
Refactor how turn threshold penalties are accounted for.

7 years agoTest coverage -- more corner cases in actions.c 120/head
Aaron Traas [Tue, 20 Jun 2017 22:43:19 +0000 (18:43 -0400)]
Test coverage -- more corner cases in actions.c

7 years agoIntroduce command encapsulation structure.
Eric S. Raymond [Tue, 20 Jun 2017 20:04:50 +0000 (16:04 -0400)]
Introduce command encapsulation structure.

7 years agoRefactored dungeon generator. 119/head
Jason S. Ninneman [Tue, 20 Jun 2017 21:31:35 +0000 (14:31 -0700)]
Refactored dungeon generator.

7 years agoClean up adventure.yaml.
Jason S. Ninneman [Tue, 20 Jun 2017 21:30:56 +0000 (14:30 -0700)]
Clean up adventure.yaml.

7 years agoDon't exit on EOF from get_input().
Jason S. Ninneman [Tue, 20 Jun 2017 16:02:34 +0000 (09:02 -0700)]
Don't exit on EOF from get_input().

7 years agoTest coverage - more corner cases in actions.c
Aaron Traas [Tue, 20 Jun 2017 16:06:49 +0000 (12:06 -0400)]
Test coverage - more corner cases in actions.c

7 years agoComment polishing.
Eric S. Raymond [Tue, 20 Jun 2017 17:38:11 +0000 (13:38 -0400)]
Comment polishing.

7 years agoAdd test for "cage bird".
Eric S. Raymond [Tue, 20 Jun 2017 13:32:35 +0000 (09:32 -0400)]
Add test for "cage bird".

7 years agoPolish help text.
Eric S. Raymond [Tue, 20 Jun 2017 12:41:06 +0000 (08:41 -0400)]
Polish help text.

7 years agoAdd -l to coverage testing.
Eric S. Raymond [Tue, 20 Jun 2017 12:34:01 +0000 (08:34 -0400)]
Add -l to coverage testing.

7 years agoDocumentation update.
Eric S. Raymond [Tue, 20 Jun 2017 12:20:34 +0000 (08:20 -0400)]
Documentation update.

7 years agoFix off-by-one error that enabled the fuzzer to find a crash hole.
Eric S. Raymond [Tue, 20 Jun 2017 11:20:03 +0000 (07:20 -0400)]
Fix off-by-one error that enabled the fuzzer to find a crash hole.

One has to allocate space for the trailing NUL, too.

7 years agoTest logic for lamp dimming triggering battery replacement.
Eric S. Raymond [Tue, 20 Jun 2017 10:52:52 +0000 (06:52 -0400)]
Test logic for lamp dimming triggering battery replacement.

7 years agoMerge branch 'master' into magic-number 116/head
Peje Nilsson [Mon, 19 Jun 2017 22:06:49 +0000 (00:06 +0200)]
Merge branch 'master' into magic-number

7 years agoFix typo and compiler warning. 115/head
Jason S. Ninneman [Mon, 19 Jun 2017 21:49:15 +0000 (14:49 -0700)]
Fix typo and compiler warning.

7 years agoAdd token_to_packed() utility function.
Jason S. Ninneman [Mon, 19 Jun 2017 21:45:32 +0000 (14:45 -0700)]
Add token_to_packed() utility function.

7 years agoMerge branch 'master' into magic-number
Peje Nilsson [Mon, 19 Jun 2017 21:44:48 +0000 (23:44 +0200)]
Merge branch 'master' into magic-number

7 years agoCleanup Arithmetic on message number
Peje Nilsson [Mon, 19 Jun 2017 21:44:03 +0000 (23:44 +0200)]
Cleanup Arithmetic on message number

7 years agoTest coverage More misuse of transitive verbs
Aaron Traas [Mon, 19 Jun 2017 20:26:14 +0000 (16:26 -0400)]
Test coverage More misuse of transitive verbs

7 years agoTest coverage - failure to fill
Aaron Traas [Mon, 19 Jun 2017 20:07:35 +0000 (16:07 -0400)]
Test coverage - failure to fill

7 years agoTest coverage -- intransitive carry when one object is present
Aaron Traas [Mon, 19 Jun 2017 19:36:42 +0000 (15:36 -0400)]
Test coverage -- intransitive carry when one object is present

7 years agoTest coverage - drink with no valid object
Aaron Traas [Mon, 19 Jun 2017 19:21:03 +0000 (15:21 -0400)]
Test coverage - drink with no valid object

7 years agoMostly confine assumptions about what token_t is to misc.c
Eric S. Raymond [Mon, 19 Jun 2017 21:21:45 +0000 (17:21 -0400)]
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.

7 years agoConcentrate all magic-number values for packed-string constants in one place.
Eric S. Raymond [Mon, 19 Jun 2017 20:53:55 +0000 (16:53 -0400)]
Concentrate all magic-number values for packed-string constants in one place.

7 years agoMore semantic typing - a step towards eliminating packing.
Eric S. Raymond [Mon, 19 Jun 2017 18:20:45 +0000 (14:20 -0400)]
More semantic typing - a step towards eliminating packing.

7 years agoReally 100% test coverage for saveresume.c
Aaron Traas [Mon, 19 Jun 2017 17:39:49 +0000 (13:39 -0400)]
Really 100% test coverage for saveresume.c

7 years agoShould have 100% coverage on saveresume.c now
Aaron Traas [Mon, 19 Jun 2017 17:23:24 +0000 (13:23 -0400)]
Should have 100% coverage on saveresume.c now

7 years agoPublish more things on the website.
Eric S. Raymond [Mon, 19 Jun 2017 16:53:43 +0000 (12:53 -0400)]
Publish more things on the website.

7 years agoBoolify some logical variables.
Eric S. Raymond [Mon, 19 Jun 2017 16:49:07 +0000 (12:49 -0400)]
Boolify some logical variables.

7 years agoEven less magic 111/head
NHOrus [Mon, 19 Jun 2017 17:13:50 +0000 (20:13 +0300)]
Even less magic

7 years agoSave/resume fail test coverage -- test works in Docker now 110/head
Aaron Traas [Mon, 19 Jun 2017 17:09:15 +0000 (13:09 -0400)]
Save/resume fail test coverage -- test works in Docker now

7 years ago-r doesn't show with NOSAVE build 109/head
NHOrus [Mon, 19 Jun 2017 16:29:00 +0000 (19:29 +0300)]
-r doesn't show with NOSAVE build

7 years agoNo need to tease with excluded options 108/head
NHOrus [Mon, 19 Jun 2017 16:11:07 +0000 (19:11 +0300)]
No need to tease with excluded options

7 years agoRevert "Improved test coverage -- save/resume fail"
Eric S. Raymond [Mon, 19 Jun 2017 15:37:03 +0000 (11:37 -0400)]
Revert "Improved test coverage -- save/resume fail"

Fails in GitLab CI - looks like /dev/badfilename can actually be opened there.

7 years agoImproved test coverage -- save/resume fail
Aaron Traas [Mon, 19 Jun 2017 13:25:36 +0000 (09:25 -0400)]
Improved test coverage -- save/resume fail

7 years agoMagic-number elimination.
Eric S. Raymond [Mon, 19 Jun 2017 15:09:24 +0000 (11:09 -0400)]
Magic-number elimination.

7 years agoMagic-number elimination. Fix possible glitch in troll-bridge death.
Eric S. Raymond [Mon, 19 Jun 2017 15:00:23 +0000 (11:00 -0400)]
Magic-number elimination. Fix possible glitch in troll-bridge death.

7 years agoAdd axeorama log, extending test coverage.
Eric S. Raymond [Mon, 19 Jun 2017 14:32:58 +0000 (10:32 -0400)]
Add axeorama log, extending test coverage.

7 years agoRestructure some code.
Eric S. Raymond [Mon, 19 Jun 2017 13:46:04 +0000 (09:46 -0400)]
Restructure some code.

7 years agoL12 is gone again. Magic numbers have been almost eliminated.
Eric S. Raymond [Mon, 19 Jun 2017 12:43:51 +0000 (08:43 -0400)]
L12 is gone again. Magic numbers have been almost eliminated.