Commit Graph

130 Commits

Author SHA1 Message Date
dholland a2e3e41dc6 Don't crash if we're asked to restore from /dev/null. (woops) 2008-02-24 06:12:49 +00:00
dholland 5ec0096cd0 Fix a bit more lint. 2008-02-24 06:07:06 +00:00
dholland c0cbd1abb5 Fix some more lint. (There's plenty to go around.)
If we try to load a game and it bombs, keep prompting for another one,
because if we try to continue with a half-loaded game we'll probably
end up in trouble.
2008-02-24 06:03:35 +00:00
dholland a537df81a5 Don't cast the return value of calloc. 2008-02-24 05:53:33 +00:00
christos dc11f84d61 fix some lint 2008-02-24 03:56:48 +00:00
christos 7cafbb8e59 need errno.h 2008-02-24 03:52:09 +00:00
dholland aab0bc87a0 Update for today's changes: 1-player games are not allowed, and cards.pck
no longer appears.
2008-02-24 03:50:07 +00:00
dholland 8015839b21 Fix the OpenBSD housing shortage code. 2008-02-24 03:26:26 +00:00
dholland 15d2107a88 ret_card(), which I moved earlier, was consequently filed under the wrong
source file name. fix.
2008-02-24 03:01:13 +00:00
dholland ad6f43e622 We do not need special code for pdp11. Also, because random() returns all
good bits (unlike rand()) we can simplify this.
2008-02-24 02:58:33 +00:00
dholland c303095d59 Typo patrol 2008-02-24 02:55:20 +00:00
dholland 295acf7fa6 This file is also no longer used. 2008-02-24 02:53:18 +00:00
dholland 97464386e1 Abolish the initdeck program and the weird little binary file it generates.
The card deck data is now compiled in. (And it always should have been,
even back when memory usage counted. It's small.)

This changes the save format slightly. (I am riding the previous
breakage an hour ago and not providing compat. There should be no
further breakage.)
2008-02-24 02:43:18 +00:00
dholland b51259daf4 Source files should be named *.c or *.h, not random other things.
Fold monop.ext (which was extern data decls) into monop.h and deck.h.
Fold monop.def (which had definitions for the extern data) into monop.c.
Fold brd.dat/mon.dat/prop.dat (which were array initializers for some of
the data) into monop.c.

Rearrange includes accordingly. No functional change.
2008-02-24 01:57:34 +00:00
dholland a6c98779b0 Remove last traces of old save/load code. We no longer need a private
copy of malloc.
2008-02-24 01:41:14 +00:00
dholland 67021c2ac7 Sort out the memory leak fix properly. 2008-02-24 01:37:57 +00:00
dholland fe527d1ba8 New save/load code. Related to (but not the same as) the new save/load
code in OpenBSD.

Note: this breaks compatibility with old save files. However, the old
save files were missing critical information, had a completely insane
format, and didn't work anyway.

I will be riding this breakage with another breakage within a day or
two when I fix the insanity in the card deck handling.
2008-02-24 01:30:56 +00:00
dholland 98e588be9a Fixes from OpenBSD.
- If a player goes bankrupt buying a property (which shouldn't be
allowed, but I guess it is), don't cause them to resign to themselves.
   - Use "NULL", not "0", for pointers.
   - Avoid undefined behavior adjusting the current player after resigning.
   - Don't leak the memory used to store player names.

The last of these is disabled for the moment because we have the pointers
in question tagged const. Will see to this when I'm finished merging.
2008-02-23 22:28:46 +00:00
dholland 693812a822 Fix from OpenBSD: don't say "1 houses". 2008-02-23 22:20:35 +00:00
dholland 4e54ceffce Bug fixes from OpenBSD:
- don't truncate unreasonably long player names when bidding;
   - don't allow players to bid more cash than they have.
2008-02-23 22:17:02 +00:00
dholland 7913f644df Bug fix: having $0 does not mean you need to mortgage something. Plus some
tidyup.
From OpenBSD.
2008-02-23 22:06:30 +00:00
dholland d49f907ead More fixes from OpenBSD:
- initialize in the proper order
  - don't allow 1-player games
  - make the check for players named "done" work properly
  - a couple other minor things
2008-02-23 21:48:46 +00:00
dholland 5ed7a7102f Sanity fixes for input handling. Suggested by OpenBSD, but different code. 2008-02-23 21:35:13 +00:00
dholland 52f0089409 A first stab at supporting the housing shortage rules. From OpenBSD.
(note: this is not fully correct - I will fix it when I finish merging)
2008-02-23 21:07:52 +00:00
dholland c844dfca6b Don't increment booleans. From OpenBSD 2008-02-23 20:18:46 +00:00
dholland ff1acb6483 Sanity fixes for input buffer handling. From OpenBSD 2008-02-23 20:12:15 +00:00
dholland 61715c12c2 Improve the behavior of get-out-of-jail-free cards by returning them to
the bottom of the deck when used. There are still a few other problems.
From OpenBSD.
2008-02-23 19:54:06 +00:00
dholland 82ff30a443 Rename ->last_card to ->top_card to match OpenBSD (and also to make
somewhat more sense...)
2008-02-23 19:49:21 +00:00
dholland 8b5e597afa Move ret_card() to cards.c, where it more rationally belongs. From OpenBSD. 2008-02-23 19:09:00 +00:00
dholland 32e86dd423 A few more whitespace/KNF. I keep hoping I've found them all... 2008-02-20 05:08:46 +00:00
dholland 1958cbf73e Add the sizes to the extern array declarations. This may not be
necessary, but it's safe and reduces unnecessary divergence.
From OpenBSD.
2008-02-20 04:50:12 +00:00
dholland a03fcca33d Use random() rather than rand(). Suggested by diffing against OpenBSD. 2008-02-20 04:48:10 +00:00
dholland 72aa2a5043 Remove unused swap() macro. 2008-02-20 04:10:34 +00:00
dholland fff414b851 Don't misuse random strings as printf formats, even where it's harmless.
Found by diffing against OpenBSD.
2008-02-20 04:10:01 +00:00
dholland b63df5c6e0 One more (hopefully the last) whitespace fix. 2008-02-19 10:48:47 +00:00
dholland 3a2a525c4b getinp() no longer magically treats the prompt arg as a printf format, so
don't escape % as %%. From OpenBSD.
2008-02-19 10:47:40 +00:00
dholland e084c0089c Move function heading comments to something vaguely like the right place. 2008-02-19 10:46:21 +00:00
dholland 16168c2070 KNF/whitespace nits. No functional changes. 2008-02-19 09:45:02 +00:00
dholland eefb74f4dc Fix bugs in debug printouts. From OpenBSD. 2008-02-19 09:34:40 +00:00
dholland c4dc2f9e61 Don't use sprintf; use snprintf. 2008-02-19 09:32:34 +00:00
dholland 0419d05bfc Don't use perror(); use err/warn instead.
Suggested by diffing against OpenBSD.
2008-02-19 09:30:26 +00:00
dholland 98ff506f59 Fix capitalization of street names. from pjanzen@openbsd 2008-02-19 09:28:05 +00:00
dholland a7f37f4351 More typo fixes 2008-02-19 09:25:21 +00:00
dholland b113ea6af6 Fix formatting bug apparently introduced when the page was mdoc'd. (Had
.Nm, should have been .Pp.)

Also bump date; for some reason this hadn't been done since the original
import.
2008-02-19 09:24:43 +00:00
dholland df819b0896 Remove transient thingy that wasn't supposed to see the light of day, and
finish dealing with some local variables that shadow a global. (hi dholland)
2008-02-19 09:05:55 +00:00
dholland 5538b1cced Fix (another) typo in comment 2008-02-19 08:26:10 +00:00
dholland c1dc5a85f2 Fix typo in comment 2008-02-19 08:07:51 +00:00
dholland 4e5cdff5fd Make this build with WARNS=4. 2008-01-28 06:16:13 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
dogcow e283c9fc02 A terrible kludge: don't compile/link malloc.c if arch=sun2. My apologies
to the legions of sun2 monop fans who will probably be unable to save/restore
games.
2007-11-17 00:10:55 +00:00