annotate xrogue/options.c @ 304:e52a8a7ad4c5

Fix many compiler warnings. There should only be two changes in behavior: arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly applied to characters who are not monks instead of monks who are not empty-handed. urogue/fight.c: fixed an interaction with the "debug" macro that could cause the wrong message to be displayed.
author John "Elwin" Edwards
date Wed, 14 Apr 2021 18:55:33 -0400
parents e940e6c00751
children 827441d05b3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
2 options.c - This file has all the code for the option command
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
3
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
4 XRogue: Expeditions into the Dungeons of Doom
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
5 Copyright (C) 1991 Robert Pietkivitch
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
6 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
7
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
8 Based on "Advanced Rogue"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
10 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
11
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
12 Based on "Rogue: Exploring the Dungeons of Doom"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
14 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
15
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
16 See the file LICENSE.TXT for full copyright and licensing information.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
17 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
18
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
19 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
20 * I would rather this command were not necessary, but
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
21 * it is the only way to keep the wolves off of my back.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
22 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
23
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
24 #include <curses.h>
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
25 #include <ctype.h>
135
ce0cf824c192 xrogue: add missing includes.
John "Elwin" Edwards
parents: 133
diff changeset
26 #include <string.h>
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
27 #include "rogue.h"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
28
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
29 #define NUM_OPTS (sizeof optlist / sizeof (OPTION))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
30
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
31 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
32 * description of an option and what to do with it
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
33 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
34 struct optstruct {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
35 char *o_name; /* option name */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
36 char *o_prompt; /* prompt for interactive entry */
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
37 void *o_opt; /* pointer to thing to set */
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
38 void (*o_putfunc)(); /* function to print value */
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
39 int (*o_getfunc)(); /* function to get value interactively */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
40 };
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
41
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
42 typedef struct optstruct OPTION;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
43
220
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
44 int get_ro(WINDOW *win, int oy, int ox);
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
45 void put_bool(bool *b, WINDOW *win);
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
46 int get_bool(bool *bp, WINDOW *win);
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
47 void put_str(char *str, WINDOW *win);
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
48 int get_str(char *opt, WINDOW *win);
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
49 void put_abil(int *ability, WINDOW *win);
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
50 int get_abil(int *abil, WINDOW *win);
220
f54901b9c39b XRogue: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 145
diff changeset
51 void put_quest(int *quest, WINDOW *win);
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
52 int get_quest(int *quest, WINDOW *win);
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
53 int get_default(bool *bp, WINDOW *win);
137
443c8bd3e290 xrogue: restrict changes to the save file location.
John "Elwin" Edwards
parents: 135
diff changeset
54 int get_str_prot(char *opt, WINDOW *win);
145
aac28331e71d Advanced Rogue family: fix the "score" option.
John "Elwin" Edwards
parents: 137
diff changeset
55 int get_score(char *opt, WINDOW *win);
137
443c8bd3e290 xrogue: restrict changes to the save file location.
John "Elwin" Edwards
parents: 135
diff changeset
56 bool allowchange(OPTION *op);
443c8bd3e290 xrogue: restrict changes to the save file location.
John "Elwin" Edwards
parents: 135
diff changeset
57
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
58 OPTION optlist[] = {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
59 {"terse", "Terse output: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
60 (void *) &terse, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
61 {"flush", "Flush typeahead during battle: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
62 (void *) &fight_flush, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
63 {"jump", "Show position only at end of run: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
64 (void *) &jump, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
65 {"step", "Do inventories one line at a time: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
66 (void *) &slow_invent, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
67 {"askme", "Ask me about unidentified things: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
68 (void *) &askme, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
69 {"pickup", "Pick things up automatically: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
70 (void *) &auto_pickup, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
71 {"overlay", "Overlay menu: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
72 (void *) &menu_overlay, put_bool, get_bool },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
73 {"name", "Name: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
74 (void *) whoami, put_str, get_str_prot },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
75 {"file", "Save file: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
76 (void *) file_name, put_str, get_str_prot },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
77 {"score", "Score file: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
78 (void *) score_file, put_str, get_score },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
79 {"class", "Character type: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
80 (void *) &char_type, put_abil, get_abil },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
81 {"quest", "Quest item: ",
229
50b89f165a34 Use uniform return types for functions related to options.
John "Elwin" Edwards
parents: 220
diff changeset
82 (void *) &quest_item, put_quest, get_quest },
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
83 {"default", "Default Attributes: ",