Commit graph

107 commits

Author SHA1 Message Date
Eric S. Raymond
19553e69fc Goto elimination. 2017-06-06 14:41:03 -04:00
Eric S. Raymond
c1ee521f73 Begin to split undifferentiated longs into semantic types. 2017-06-06 14:28:27 -04:00
Eric S. Raymond
978168523a Magic-number elimination. 2017-06-06 11:12:00 -04:00
Eric S. Raymond
fd10d380df Abstract out NOBJECTS (formerly magic number 100). 2017-06-06 10:44:25 -04:00
Eric S. Raymond
4d6078d8a8 Replace homebrew IABS() with C kubrary labs(3). 2017-06-06 09:21:46 -04:00
Eric S. Raymond
1445c7ebcc MAPLIN is no longer called during setup phase. 2017-06-06 07:52:07 -04:00
Jason S. Ninneman
3a1a3eb774 Actually return a value from SETBIT(). 2017-06-04 09:47:49 -07:00
Jason S. Ninneman
83048ee832 Remove a disused function, thereby upping the code coverage. 2017-06-04 08:58:43 -07:00
Jason S. Ninneman
4babd6d058 Rescope and retype a variable. 2017-06-03 11:30:56 -07:00
Jason S. Ninneman
ab46b5261b Make GETTXT() a bit closer to actual C. 2017-06-03 11:30:56 -07:00
Eric S. Raymond
aef609291d Simplify bitmask test/set from FORTRANish to actual C. 2017-06-02 16:40:29 -04:00
Eric S. Raymond
63f53c026d Macro elimination - easy cases first. No logic changes. 2017-06-02 16:20:40 -04:00
Eric S. Raymond
d402e09411 Header consolidation - main.h, misc.h, and share.h merge to advent.h.
For a project this small size with a small type ontology, it's better
C style to have one header where all the assumptions about types and
structures are immediately visible.

This is a first step towards turning all that global state into a handful
of structures - probably just two, one saveable as a binary game state.
2017-06-02 15:06:33 -04:00
Michael Jarvis
44c444d638 added braces around initialization of subobjects for clarity 2017-06-02 08:44:40 -04:00
Michael Jarvis
092f478790 Cast size_t to long to silence warning 2017-06-02 08:44:40 -04:00
Jason S. Ninneman
650575394f Fix a bug in RNDVOC() that prevented the reservoir magic word for working.
To do this, I first had to refactor the code into proper C, just so I could understand it. Then I found another layer of encryption around the value itself. Finally, I discovered that the line to actually set the new magic word was placed such that it was using a global index instead of the local one.
2017-05-29 14:22:52 -07:00
Jason S. Ninneman
18eac9f55d Make RNDVOC() into better C. 2017-05-29 13:59:06 -07:00
Jason S. Ninneman
519d8f07e6 Really mean it about strict C99 compliance. 2017-05-29 09:30:37 -07:00
Eric S. Raymond
5ae76995d2 Simplify build: nested makefiles considered harmful. 2017-05-29 01:33:59 -04:00
Jason S. Ninneman
f0528b0ded Move database compilation out into its own tool (for now). 2017-05-28 21:46:54 -07:00
Jason S. Ninneman
df46df6979 Factor out handling of variables populated from the database.
This reorganization is a first step toward handling database compilation separately.
2017-05-28 15:42:05 -07:00
Jason S. Ninneman
2270c6ad12 Just say no to encrypting internal state. 2017-05-26 10:21:19 -07:00
Eric S. Raymond
d2643712dd Fix bug that led to comments bnot being ignored. 2017-05-26 05:14:18 -04:00
Eric S. Raymond
79ef3e38c2 Implement fallback handler that looks at the raw command buffer.
With database cinpilation not broken this time...
2017-05-25 18:21:38 -04:00
Jason S. Ninneman
580565e254 Stop command-logging from non-stdin sources. 2017-05-24 22:31:26 -07:00
Eric S. Raymond
6ba9a7de7f Once again, take srand()/random() out of the initialization chain.
They have exactly the wrong kind of randomness for this job - not
returning consistent sequences across different platforms or C library
versions, and because pseodorandom not really better than sampling
the clock.
2017-05-24 23:36:25 -04:00
Eric S. Raymond
6146406990 Re-enable skipping of #-led comments. 2017-05-24 23:05:19 -04:00
Eric S. Raymond
3a2c0ca199 Reapply "Clean up logic for exiting input loop and scoring." 2017-05-24 22:51:36 -04:00
Eric S. Raymond
31837249f8 Revert SEED handling and comment orocessing. It broke database compilation.
This code is remarkably like the game it implements - a maze of twisty
little FORTRANisms, all alike.  Very easy to get lost.
2017-05-24 18:24:09 -04:00
Eric S. Raymond
44e7ddc2ed Take srand()/rand() out of the initialization chain...
...they're not guatanteed to produce consistent across platforms or
libc versions.
2017-05-24 11:57:53 -04:00
Eric S. Raymond
c703bd78d9 Clean up logic for exiting input loop and scoring. 2017-05-24 11:16:59 -04:00
Eric S. Raymond
263b5ac3ba Allow comments in logfiles. 2017-05-24 10:07:05 -04:00
Eric S. Raymond
cf219e920b Seed command fully implemented but apparently buggy.
Dwarf appearance is not yet reproducible.
2017-05-24 09:06:41 -04:00
Eric S. Raymond
65c081a0ac Implement stub handler for SEED command. Not hooked up to PRNG yet. 2017-05-24 08:30:06 -04:00
Jason S. Ninneman
627144354c Remove a bad use of tv_nsec. 2017-05-23 23:46:20 -07:00
Jason S. Ninneman
61031ce55c Move a line that got out of place. 2017-05-23 23:42:54 -07:00
Jason S. Ninneman
8a8770375e Add seedable PRNG using an adaptation the original LCG algorithm. 2017-05-23 23:37:56 -07:00
Eric S. Raymond
2bc887c84e Fix the slightly broken prompt test. 2017-05-24 00:28:38 -04:00
Eric S. Raymond
484ca4e9fd Revert structurization changes, they broke database compilation...
...bug showing only if adventure.data was absent.  We'll need to sneak up
on this more carefully.
2017-05-24 00:17:19 -04:00
Eric S. Raymond
f9eb6383f1 Revert a variable name previously changed to be out of the way.
Also, make output from replays easier to interpret by adding prompts.
2017-05-23 22:29:24 -04:00
Eric S. Raymond
8d0587b0ec Echo commands to stdout when replaying...
...makes check loads full transcripts abd more readable.
2017-05-23 20:38:46 -04:00
Eric S. Raymond
42189d79d7 Begin gathering saveable game state into a structure. Not yet complete.
No logic changes.  A bunch of globals turn into fields (with the same names
except for lowercasing) in struct game_t.

Eventually this will allow drastic simplification of the save/load logic.
2017-05-23 18:47:04 -04:00
Eric S. Raymond
dc9d9e467b Input source is parametrized all the way down.
This means that, potentially, do_command() could be called on any text file
pointer and the right thing would happen.
2017-05-23 15:57:38 -04:00
Eric S. Raymond
935d8b8e68 Added oldstyle option. 2017-05-23 11:28:56 -04:00
Eric S. Raymond
f89f63c6d1 Fix capitalization glitches. 2017-05-23 09:18:28 -04:00
Eric S. Raymond
943b3a62e6 Add -l option to enable command logging. 2017-05-23 08:57:35 -04:00
Eric S. Raymond
040f19adde Fix strange inside-out organization of the input routines.
Seems to have nbben a result of FORTRAN not having anything like a
stream object that can be passed around.

A step towards logging and log replay.
2017-05-22 21:26:14 -04:00
Eric S. Raymond
19b3e3e656 Remove unused labels. 2017-05-22 20:55:21 -04:00
Eric S. Raymond
5e2ca9a0e4 Don't use a magic number when we can use sizeof(). 2017-05-22 20:33:23 -04:00
Eric S. Raymond
ef24a63ced Prototypization. 2017-05-22 18:47:39 -04:00