+/* $NetBSD: play.c,v 1.10 2019/02/03 03:19:25 mrg Exp $ */
+
/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Timothy C. Stoehr.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char sccsid[] = "@(#)play.c 5.3 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: play.c,v 1.10 2019/02/03 03:19:25 mrg Exp $");
+#endif
#endif /* not lint */
/*
#include "rogue.h"
+#define __unreachable() __builtin_unreachable()
+
boolean interrupted = 0;
-char *unknown_command = "unknown command";
-extern short party_room, bear_trap;
-extern char hit_message[];
-extern boolean wizard, trap_door;
+static const char unknown_command[] = "unknown command";
-play_level()
+void
+play_level(void)
{
short ch;
int count;
for (;;) {
interrupted = 0;
if (hit_message[0]) {
- message(hit_message, 1);
+ messagef(1, "%s", hit_message);
hit_message[0] = 0;
}
if (trap_door) {
case 'u':
case 'n':
case 'b':
- (void) one_move_rogue(ch, 1);
+ (void)one_move_rogue(ch, 1);
break;
case 'H':
case 'J':
throw();
break;
case 'v':
- message("rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims", 0);
+ messagef(0, "rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims");
break;
case 'Q':
quit(0);
+ __unreachable();
case '0':
case '1':
case '2':
if (wizard) {
inventory(&level_objects, ALL_OBJECTS);
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case '\023':
if (wizard) {
draw_magic_map();
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case '\024':
if (wizard) {
show_traps();
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case '\017':
if (wizard) {
show_objects();
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case '\001':
if (wizard) {
c_object_for_wizard();
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case '\015':
if (wizard) {
show_monsters();
} else {
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
}
break;
case 'S':
save_game();
break;
default:
- message(unknown_command, 0);
+ messagef(0, "%s", unknown_command);
break;
}
}