diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-08-12 19:52:57 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-08-12 19:52:57 +0000 |
commit | c2e1d74226b20206e9e33c41723486628cdeb3a1 (patch) | |
tree | fd5bcdb6cb8d286780cb6c21305c3939ab76d8d6 /games | |
parent | 7eaf07daccb49c3c8beb61622d11e876aa317c65 (diff) |
make get_input_line more general (only affects wizard mode)
make special attacks a bit less likely in wizard mode
remove declarations of a few nonexistant functions
Diffstat (limited to 'games')
-rw-r--r-- | games/rogue/message.c | 9 | ||||
-rw-r--r-- | games/rogue/object.c | 6 | ||||
-rw-r--r-- | games/rogue/pack.c | 5 | ||||
-rw-r--r-- | games/rogue/rogue.h | 7 | ||||
-rw-r--r-- | games/rogue/spec_hit.c | 32 | ||||
-rw-r--r-- | games/rogue/zap.c | 9 |
6 files changed, 31 insertions, 37 deletions
diff --git a/games/rogue/message.c b/games/rogue/message.c index 455303f35d6..5d66689b640 100644 --- a/games/rogue/message.c +++ b/games/rogue/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.6 2000/07/24 00:56:05 pjanzen Exp $ */ +/* $OpenBSD: message.c,v 1.7 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $ */ /* @@ -136,8 +136,9 @@ check_message() } int -get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo) - char *prompt, *buf, *insert; +get_input_line(prompt, insert, buf, buf_size, if_cancelled, add_blank, do_echo) + char *prompt, *insert, *buf; + int buf_size; char *if_cancelled; boolean add_blank; boolean do_echo; @@ -157,7 +158,7 @@ get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo) } while (((ch = rgetchar()) != '\r') && (ch != '\n') && (ch != CANCEL)) { - if ((ch >= ' ') && (ch <= '~') && (i < MAX_TITLE_LENGTH-2)) { + if ((ch >= ' ') && (ch <= '~') && (i < buf_size - 2)) { if ((ch != ' ') || (i > 0)) { buf[i++] = ch; if (do_echo) { diff --git a/games/rogue/object.c b/games/rogue/object.c index 4801d086492..e96016063f5 100644 --- a/games/rogue/object.c +++ b/games/rogue/object.c @@ -1,4 +1,4 @@ -/* $OpenBSD: object.c,v 1.4 2001/08/10 18:32:46 pjanzen Exp $ */ +/* $OpenBSD: object.c,v 1.5 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: object.c,v 1.4 2001/08/10 18:32:46 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: object.c,v 1.5 2001/08/12 19:52:56 pjanzen Exp $"; #endif #endif /* not lint */ @@ -791,7 +791,7 @@ c_object_for_wizard() } if ((ch != ',') && (ch != ':')) { GIL: - if (get_input_line("which kind?", "", buf, "", 0, 1)) { + if (get_input_line("which kind?", "", buf, sizeof(buf), "", 0, 1)) { wk = get_number(buf); if ((wk >= 0) && (wk <= max)) { obj->which_kind = (unsigned short) wk; diff --git a/games/rogue/pack.c b/games/rogue/pack.c index fbc3f483b5d..592f8cdbe6e 100644 --- a/games/rogue/pack.c +++ b/games/rogue/pack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pack.c,v 1.5 2001/08/10 18:32:46 pjanzen Exp $ */ +/* $OpenBSD: pack.c,v 1.6 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $ */ /* @@ -470,7 +470,8 @@ call_it() } id_table = get_id_table(obj); - if (get_input_line("call it:","",buf,id_table[obj->which_kind].title,1,1)) { + if (get_input_line("call it:", "", buf, sizeof(buf), + id_table[obj->which_kind].title, 1, 1)) { id_table[obj->which_kind].id_status = CALLED; (void) strcpy(id_table[obj->which_kind].title, buf); } diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h index d4713abc3ad..84e43eeac4d 100644 --- a/games/rogue/rogue.h +++ b/games/rogue/rogue.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rogue.h,v 1.5 2001/08/10 18:32:46 pjanzen Exp $ */ +/* $OpenBSD: rogue.h,v 1.6 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: rogue.h,v 1.4 1995/04/24 12:25:04 cgd Exp $ */ /* @@ -525,7 +525,7 @@ char get_dungeon_char __P((short, short)); int get_exp_level __P((long)); void get_food __P((object *, boolean)); int get_hit_chance __P((object *)); -int get_input_line __P((char *, char *, char *, char *, boolean, boolean)); +int get_input_line __P((char *, char *, char *, int, char *, boolean, boolean)); char get_mask_char __P((unsigned short)); int get_number __P((char *)); boolean get_oth_room __P((short, short *, short *)); @@ -587,11 +587,9 @@ void make_room __P((short, short, short, short)); void make_scroll_titles __P((void)); boolean mask_pack __P((object *, unsigned short)); boolean mask_room __P((short, short *, short *, unsigned short)); -void md_cbreak_no_echo_nonl __P((boolean)); boolean md_df __P((char *)); void md_exit __P((int)); void md_gct __P((struct rogue_time *)); -char *md_gdtcf __P((void)); int md_get_file_id __P((char *)); void md_gfmt __P((char *, struct rogue_time *)); int md_gseed __P((void)); @@ -602,7 +600,6 @@ void md_lock __P((boolean)); void md_shell __P((char *)); void md_sleep __P((int)); void md_slurp __P((void)); -void md_tstp __P((void)); void message __P((char *, boolean)); void mix_colors __P((void)); void mix_colors __P((void)); diff --git a/games/rogue/spec_hit.c b/games/rogue/spec_hit.c index b5544c7e2d0..248abcaac57 100644 --- a/games/rogue/spec_hit.c +++ b/games/rogue/spec_hit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_hit.c,v 1.3 1998/08/22 08:55:48 pjanzen Exp $ */ +/* $OpenBSD: spec_hit.c,v 1.4 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: spec_hit.c,v 1.3 1998/08/22 08:55:48 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: spec_hit.c,v 1.4 2001/08/12 19:52:56 pjanzen Exp $"; #endif #endif /* not lint */ @@ -66,32 +66,26 @@ void special_hit(monster) object *monster; { - if ((monster->m_flags & CONFUSED) && rand_percent(66)) { + if ((monster->m_flags & CONFUSED) && rand_percent(66)) return; - } - if (monster->m_flags & RUSTS) { + if (wizard && rand_percent(50)) + return; + if (monster->m_flags & RUSTS) rust(monster); - } - if ((monster->m_flags & HOLDS) && !levitate) { + if ((monster->m_flags & HOLDS) && !levitate) being_held = 1; - } - if (monster->m_flags & FREEZES) { + if (monster->m_flags & FREEZES) freeze(monster); - } - if (monster->m_flags & STINGS) { + if (monster->m_flags & STINGS) sting(monster); - } - if (monster->m_flags & DRAINS_LIFE) { + if (monster->m_flags & DRAINS_LIFE) drain_life(); - } - if (monster->m_flags & DROPS_LEVEL) { + if (monster->m_flags & DROPS_LEVEL) drop_level(); - } - if (monster->m_flags & STEALS_GOLD) { + if (monster->m_flags & STEALS_GOLD) steal_gold(monster); - } else if (monster->m_flags & STEALS_ITEM) { + else if (monster->m_flags & STEALS_ITEM) steal_item(monster); - } } void diff --git a/games/rogue/zap.c b/games/rogue/zap.c index eeb2070d4c3..269f13bb9f3 100644 --- a/games/rogue/zap.c +++ b/games/rogue/zap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zap.c,v 1.3 1998/08/22 08:55:53 pjanzen Exp $ */ +/* $OpenBSD: zap.c,v 1.4 2001/08/12 19:52:56 pjanzen Exp $ */ /* $NetBSD: zap.c,v 1.3 1995/04/22 10:28:41 cgd Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: zap.c,v 1.3 1998/08/22 08:55:53 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: zap.c,v 1.4 2001/08/12 19:52:56 pjanzen Exp $"; #endif #endif /* not lint */ @@ -230,13 +230,14 @@ tele_away(monster) void wizardize() { - char buf[100]; + char buf[10]; if (wizard) { wizard = 0; message("not wizard anymore", 0); } else { - if (get_input_line("wizard's password:", "", buf, "", 0, 0)) { + if (get_input_line("wizard's password:", "", buf, sizeof(buf), + "", 0, 0)) { (void) xxx(1); xxxx(buf, strlen(buf)); if (!strncmp(buf, "\247\104\126\272\115\243\027", 7)) { |