comparison rogue4/misc.c @ 225:4f6e056438eb

Merge the GCC5 and build fix branches.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:28:34 -0500
parents 1b73a8641b37
children 0990adf580ee
comparison
equal deleted inserted replaced
224:4d0f53998e8a 225:4f6e056438eb
19 /* 19 /*
20 * tr_name: 20 * tr_name:
21 * Print the name of a trap 21 * Print the name of a trap
22 */ 22 */
23 char * 23 char *
24 tr_name(type) 24 tr_name(char type)
25 char type;
26 { 25 {
27 switch (type) 26 switch (type)
28 { 27 {
29 case T_DOOR: 28 case T_DOOR:
30 return terse ? "a trapdoor" : "you found a trapdoor"; 29 return terse ? "a trapdoor" : "you found a trapdoor";
45 44
46 /* 45 /*
47 * look: 46 * look:
48 * A quick glance all around the player 47 * A quick glance all around the player
49 */ 48 */
50 look(wakeup) 49 void
51 bool wakeup; 50 look(bool wakeup)
52 { 51 {
53 register int x, y; 52 register int x, y;
54 register unsigned char ch; 53 register unsigned char ch;
55 register int index; 54 register int index;
56 register THING *tp; 55 register THING *tp;
202 /* 201 /*
203 * find_obj: 202 * find_obj:
204 * Find the unclaimed object at y, x 203 * Find the unclaimed object at y, x
205 */ 204 */
206 THING * 205 THING *
207 find_obj(y, x) 206 find_obj(int y, int x)
208 register int y, x;
209 { 207 {
210 register THING *op; 208 register THING *op;
211 209
212 for (op = lvl_obj; op != NULL; op = next(op)) 210 for (op = lvl_obj; op != NULL; op = next(op))
213 { 211 {
223 221
224 /* 222 /*
225 * eat: 223 * eat:
226 * She wants to eat something, so let her try 224 * She wants to eat something, so let her try
227 */ 225 */
228 eat() 226 void
227 eat(void)
229 { 228 {
230 register THING *obj; 229 register THING *obj;
231 230
232 if ((obj = get_item("eat", FOOD)) == NULL) 231 if ((obj = get_item("eat", FOOD)) == NULL)
233 return; 232 return;
270 /* 269 /*
271 * chg_str: 270 * chg_str:
272 * Used to modify the playes strength. It keeps track of the 271 * Used to modify the playes strength. It keeps track of the
273 * highest it has been, just in case 272 * highest it has been, just in case
274 */ 273 */
275 chg_str(amt) 274 void
276 register int amt; 275 chg_str(int amt)
277 { 276 {
278 str_t comp; 277 str_t comp;
279 278
280 if (amt == 0) 279 if (amt == 0)
281 return; 280 return;
291 290
292 /* 291 /*
293 * add_str: 292 * add_str:
294 * Perform the actual add, checking upper and lower bound limits 293 * Perform the actual add, checking upper and lower bound limits
295 */ 294 */
296 add_str(sp, amt) 295 void
297 register str_t *sp; 296 add_str(str_t *sp, int amt)
298 int amt;
299 { 297 {
300 if ((*sp += amt) < 3) 298 if ((*sp += amt) < 3)
301 *sp = 3; 299 *sp = 3;
302 else if (*sp > 31) 300 else if (*sp > 31)
303 *sp = 31; 301 *sp = 31;
305 303
306 /* 304 /*
307 * add_haste: 305 * add_haste:
308 * Add a haste to the player 306 * Add a haste to the player
309 */ 307 */
310 add_haste(potion) 308 bool
311 bool potion; 309 add_haste(bool potion)
312 { 310 {
313 if (on(player, ISHASTE)) 311 if (on(player, ISHASTE))
314 { 312 {
315 no_command += rnd(8); 313 no_command += rnd(8);
316 player.t_flags &= ~ISRUN; 314 player.t_flags &= ~ISRUN;
330 328
331 /* 329 /*
332 * aggravate: 330 * aggravate:
333 * Aggravate all the monsters on this level 331 * Aggravate all the monsters on this level
334 */ 332 */
335 aggravate() 333 void
334 aggravate(void)
336 { 335 {
337 register THING *mi; 336 register THING *mi;
338 337
339 for (mi = mlist; mi != NULL; mi = next(mi)) 338 for (mi = mlist; mi != NULL; mi = next(mi))
340 runto(&mi->t_pos, &hero); 339 runto(&mi->t_pos, &hero);
344 * vowelstr: 343 * vowelstr:
345 * For printfs: if string starts with a vowel, return "n" for an 344 * For printfs: if string starts with a vowel, return "n" for an
346 * "an". 345 * "an".
347 */ 346 */
348 char * 347 char *
349 vowelstr(str) 348 vowelstr(char *str)
350 register char *str;
351 { 349 {
352 switch (*str) 350 switch (*str)
353 { 351 {
354 case 'a': case 'A': 352 case 'a': case 'A':
355 case 'e': case 'E': 353 case 'e': case 'E':
364 362
365 /* 363 /*
366 * is_current: 364 * is_current:
367 * See if the object is one of the currently used items 365 * See if the object is one of the currently used items
368 */ 366 */
369 is_current(obj) 367 bool
370 register THING *obj; 368 is_current(THING *obj)
371 { 369 {
372 if (obj == NULL) 370 if (obj == NULL)
373 return FALSE; 371 return FALSE;
374 if (obj == cur_armor || obj == cur_weapon || obj == cur_ring[LEFT] 372 if (obj == cur_armor || obj == cur_weapon || obj == cur_ring[LEFT]
375 || obj == cur_ring[RIGHT]) 373 || obj == cur_ring[RIGHT])
385 /* 383 /*
386 * get_dir: 384 * get_dir:
387 * Set up the direction co_ordinate for use in varios "prefix" 385 * Set up the direction co_ordinate for use in varios "prefix"
388 * commands 386 * commands
389 */ 387 */
390 get_dir() 388 bool
389 get_dir(void)
391 { 390 {
392 register char *prompt; 391 register char *prompt;
393 register bool gotit; 392 register bool gotit;
394 393
395 if (!terse) 394 if (!terse)
428 427
429 /* 428 /*
430 * sign: 429 * sign:
431 * Return the sign of the number 430 * Return the sign of the number
432 */ 431 */
433 sign(nm) 432 int
434 register int nm; 433 sign(int nm)
435 { 434 {
436 if (nm < 0) 435 if (nm < 0)
437 return -1; 436 return -1;
438 else 437 else
439 return (nm > 0); 438 return (nm > 0);
441 440
442 /* 441 /*
443 * spread: 442 * spread:
444 * Give a spread around a given number (+/- 10%) 443 * Give a spread around a given number (+/- 10%)
445 */ 444 */
446 spread(nm) 445 int
447 register int nm; 446 spread(int nm)
448 { 447 {
449 return nm - nm / 10 + rnd(nm / 5); 448 return nm - nm / 10 + rnd(nm / 5);
450 } 449 }
451 450
452 /* 451 /*
453 * call_it: 452 * call_it:
454 * Call an object something after use. 453 * Call an object something after use.
455 */ 454 */
456 call_it(know, guess) 455 void
457 register bool know; 456 call_it(bool know, char **guess)
458 register char **guess;
459 { 457 {
460 if (know && *guess) 458 if (know && *guess)
461 { 459 {
462 free(*guess); 460 free(*guess);
463 *guess = NULL; 461 *guess = NULL;