comparison srogue/init.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 3aa87373c908
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
216:b24545357d2e 217:94a0d9dd5ce1
16 16
17 #include <ctype.h> 17 #include <ctype.h>
18 #include <string.h> 18 #include <string.h>
19 #include "rogue.h" 19 #include "rogue.h"
20 #include "rogue.ext" 20 #include "rogue.ext"
21
22 int pinit(void);
23 void badcheck(char *name, struct magic_item *magic);
21 24
22 char *rainbow[NCOLORS] = { 25 char *rainbow[NCOLORS] = {
23 "Red", "Blue", "Green", "Yellow", 26 "Red", "Blue", "Green", "Yellow",
24 "Black", "Brown", "Orange", "Pink", 27 "Black", "Brown", "Orange", "Pink",
25 "Purple", "Grey", "White", "Silver", 28 "Purple", "Grey", "White", "Silver",
80 "Magnesium", "Pewter", "Platinum", "Steel", 83 "Magnesium", "Pewter", "Platinum", "Steel",
81 "Tin", "Titanium", "Zinc", 84 "Tin", "Titanium", "Zinc",
82 }; 85 };
83 86
84 /* 87 /*
85 * init_everything:
86 * Set up all important stuff.
87 */
88 init_everything()
89 {
90 init_player(); /* Roll up the rogue */
91 init_things(); /* Set up probabilities */
92 init_names(); /* Set up names of scrolls */
93 init_colors(); /* Set up colors of potions */
94 init_stones(); /* Set up stones in rings */
95 init_materials(); /* Set up materials of wands */
96 }
97
98 /*
99 * init_things: 88 * init_things:
100 * Initialize the probabilities for types of things 89 * Initialize the probabilities for types of things
101 */ 90 */
102 init_things() 91 void
92 init_things(void)
103 { 93 {
104 struct magic_item *mi; 94 struct magic_item *mi;
105 95
106 /* 96 /*
107 * init general things 97 * init general things
126 116
127 /* 117 /*
128 * init_colors: 118 * init_colors:
129 * Initialize the potion color scheme for this time 119 * Initialize the potion color scheme for this time
130 */ 120 */
131 init_colors() 121 void
122 init_colors(void)
132 { 123 {
133 reg int i, j; 124 reg int i, j;
134 reg char *str; 125 reg char *str;
135 bool used[NCOLORS]; 126 bool used[NCOLORS];
136 127
153 144
154 /* 145 /*
155 * init_names: 146 * init_names:
156 * Generate the names of the various scrolls 147 * Generate the names of the various scrolls
157 */ 148 */
158 init_names() 149 void
150 init_names(void)
159 { 151 {
160 reg int nsyl; 152 reg int nsyl;
161 reg char *cp, *sp; 153 reg char *cp, *sp;
162 reg int i, nwords; 154 reg int i, nwords;
163 155
187 /* 179 /*
188 * init_stones: 180 * init_stones:
189 * Initialize the ring stone setting scheme for this time 181 * Initialize the ring stone setting scheme for this time
190 */ 182 */
191 183
192 init_stones() 184 void
185 init_stones(void)
193 { 186 {
194 reg int i, j; 187 reg int i, j;
195 reg char *str; 188 reg char *str;
196 bool used[NSTONES]; 189 bool used[NSTONES];
197 190
215 /* 208 /*
216 * init_materials: 209 * init_materials:
217 * Initialize the construction materials for wands and staffs 210 * Initialize the construction materials for wands and staffs
218 */ 211 */
219 212
220 init_materials() 213 void
214 init_materials(void)
221 { 215 {
222 int i, j; 216 int i, j;
223 char *str; 217 char *str;
224 struct rod *rd; 218 struct rod *rd;
225 bool metused[NMETAL], woodused[NWOOD]; 219 bool metused[NMETAL], woodused[NWOOD];
262 ws_magic[i].mi_prob += ws_magic[i-1].mi_prob; 256 ws_magic[i].mi_prob += ws_magic[i-1].mi_prob;
263 } 257 }
264 badcheck("sticks", ws_magic); 258 badcheck("sticks", ws_magic);
265 } 259 }
266 260
267 badcheck(name, magic) 261 void
268 char *name; 262 badcheck(char *name, struct magic_item *magic)
269 struct magic_item *magic;
270 { 263 {
271 struct magic_item *mg; 264 struct magic_item *mg;
272 265
273 for (mg = magic; mg->mi_name != NULL; mg++) 266 for (mg = magic; mg->mi_name != NULL; mg++)
274 ; 267 ;
287 /* 280 /*
288 * init_player: 281 * init_player:
289 * roll up the rogue 282 * roll up the rogue
290 */ 283 */
291 284
292 init_player() 285 void
286 init_player(void)
293 { 287 {
294 player.t_nomove = 0; 288 player.t_nomove = 0;
295 player.t_nocmd = 0; 289 player.t_nocmd = 0;
296 him = &player.t_stats; 290 him = &player.t_stats;
297 him->s_lvl = 1; 291 him->s_lvl = 1;
313 307
314 /* 308 /*
315 * pinit: 309 * pinit:
316 * Returns the best 3 of 4 on a 6-sided die 310 * Returns the best 3 of 4 on a 6-sided die
317 */ 311 */
318 pinit() 312 int
313 pinit(void)
319 { 314 {
320 int best[4]; 315 int best[4];
321 reg int i, min, minind, dicetot; 316 reg int i, min, minind, dicetot;
322 317
323 for (i = 0 ; i < 4 ; i++) 318 for (i = 0 ; i < 4 ; i++)
335 if (i != minind) /* if not minimum, then add it */ 330 if (i != minind) /* if not minimum, then add it */
336 dicetot += best[i]; 331 dicetot += best[i];
337 } 332 }
338 return(dicetot); 333 return(dicetot);
339 } 334 }
335
336 /*
337 * init_everything:
338 * Set up all important stuff.
339 */
340 void
341 init_everything(void)
342 {
343 init_player(); /* Roll up the rogue */
344 init_things(); /* Set up probabilities */
345 init_names(); /* Set up names of scrolls */
346 init_colors(); /* Set up colors of potions */
347 init_stones(); /* Set up stones in rings */
348 init_materials(); /* Set up materials of wands */
349 }