summaryrefslogtreecommitdiffstats
path: root/games/battlestar/com5.c
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1999-04-19 03:59:02 +0000
committersteve <steve@FreeBSD.org>1999-04-19 03:59:02 +0000
commitd59a3ca336bac3dac6ad8918ff6cb28fcbbba718 (patch)
treec2b57d23128f242645f8e3e16274a587229383ec /games/battlestar/com5.c
parent390eb1b3d201760a5e8b76e2431c1f667648718f (diff)
downloadFreeBSD-src-d59a3ca336bac3dac6ad8918ff6cb28fcbbba718.zip
FreeBSD-src-d59a3ca336bac3dac6ad8918ff6cb28fcbbba718.tar.gz
Merge a bunch of cleanups from NetBSD.
PR: 8083 Submitted by: Stephen J. Roznowski <sjr@home.net> Obtained from: a whole slew of NetBSD PRs
Diffstat (limited to 'games/battlestar/com5.c')
-rw-r--r--games/battlestar/com5.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c
index 5bdea6a..3027afd 100644
--- a/games/battlestar/com5.c
+++ b/games/battlestar/com5.c
@@ -247,6 +247,19 @@ give()
person = wordvalue[wordnumber];
last2 = wordnumber;
}
+ /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
+ * plain `give'. However, detecting this case is liable to detect
+ * `give foo' as well, which would give a confusing error. We
+ * need to make sure the -1 value can cause no problems if it arises.
+ * If in the below we get to the drop("Given") then drop will look
+ * at word 0 for an object to give, and fail, which is OK; then
+ * result will be -1 and we get to the end, where wordnumber gets
+ * set to something more sensible. If we get to "I don't think
+ * that is possible" then again wordnumber is set to something
+ * sensible. The wordnumber we leave with still isn't right if
+ * you include words the game doesn't know in your command, but
+ * that's no worse than what other commands than give do in
+ * the same place. */
wordnumber = last1 - 1;
if (person && testbit(location[position].objects,person))
if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
@@ -255,6 +268,7 @@ give()
result = drop("Given");
else {
puts("I don't think that is possible.");
+ wordnumber = max(last1, last2) + 1;
return(0);
}
if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
@@ -319,6 +333,6 @@ give()
break;
}
}
- wordnumber = max(last1,last2);
+ wordnumber = max(last1,last2) + 1;
return(firstnumber);
}
OpenPOWER on IntegriCloud