From ed51e2ee8c47dbb4c8041637e215fab3dac5bc06 Mon Sep 17 00:00:00 2001 From: jsm Date: Sat, 23 Sep 2000 19:23:57 +0000 Subject: Use a lookup table to identify whether objects are plural or singular, instead of testing the final character against 's' in each place. Avoids oddities about "pot of jewels" and "compass". --- battlestar/com3.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'battlestar/com3.c') diff --git a/battlestar/com3.c b/battlestar/com3.c index 86b2e9c1..ea6d122b 100644 --- a/battlestar/com3.c +++ b/battlestar/com3.c @@ -1,4 +1,4 @@ -/* $NetBSD: com3.c,v 1.9 2000/09/22 08:19:21 jsm Exp $ */ +/* $NetBSD: com3.c,v 1.10 2000/09/23 19:23:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com3.c,v 1.9 2000/09/22 08:19:21 jsm Exp $"); +__RCSID("$NetBSD: com3.c,v 1.10 2000/09/23 19:23:58 jsm Exp $"); #endif #endif /* not lint */ @@ -194,7 +194,6 @@ int shoot() { int firstnumber, value; - int n; firstnumber = wordnumber; if (!testbit(inven, LASER)) @@ -204,11 +203,11 @@ shoot() while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); - for (n = 0; objsht[value][n]; n++); if (testbit(location[position].objects, value)) { clearbit(location[position].objects, value); ourtime++; - printf("The %s explode%s\n", objsht[value], (objsht[value][n - 1] == 's' ? (objsht[value][n - 2] == 's' ? "s." : ".") : "s.")); + printf("The %s explode%s\n", objsht[value], + (is_plural_object(value) ? "." : "s.")); if (value == BOMB) die(); } else -- cgit v1.2.3