comparison xrogue/things.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents ce0cf824c192
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
19 #include <curses.h> 19 #include <curses.h>
20 #include <ctype.h> 20 #include <ctype.h>
21 #include <string.h> 21 #include <string.h>
22 #include "rogue.h" 22 #include "rogue.h"
23 23
24 int pick_one(struct magic_item *magic, int nitems);
25 char *blesscurse(int flags);
26 char *p_kind(struct object *obj);
27 int extras(void);
28
24 /* 29 /*
25 * print out the number of charges on a stick 30 * print out the number of charges on a stick
26 */ 31 */
27 32
28 char * 33 char *
29 charge_str(obj) 34 charge_str(struct object *obj)
30 register struct object *obj;
31 { 35 {
32 static char buf[20]; 36 static char buf[20];
33 37
34 if (!(obj->o_flags & ISKNOW)) 38 if (!(obj->o_flags & ISKNOW))
35 buf[0] = '\0'; 39 buf[0] = '\0';
45 * return the name of something as it would appear in an 49 * return the name of something as it would appear in an
46 * inventory. 50 * inventory.
47 */ 51 */
48 52
49 char * 53 char *
50 inv_name(obj, drop) 54 inv_name(struct object *obj, bool drop)
51 register struct object *obj;
52 bool drop;
53 { 55 {
54 register char *pb; 56 register char *pb;
55 57
56 pb = prbuf; 58 pb = prbuf;
57 pb[0] = '\0'; 59 pb[0] = '\0';
329 * weap_name: 331 * weap_name:
330 * Return the name of a weapon. 332 * Return the name of a weapon.
331 */ 333 */
332 334
333 char * 335 char *
334 weap_name(obj) 336 weap_name(struct object *obj)
335 register struct object *obj;
336 { 337 {
337 switch (obj->o_type) { 338 switch (obj->o_type) {
338 case WEAPON: 339 case WEAPON:
339 return(weaps[obj->o_which].w_name); 340 return(weaps[obj->o_which].w_name);
340 when MISSILE: 341 when MISSILE:
363 /* 364 /*
364 * drop: 365 * drop:
365 * put something down 366 * put something down
366 */ 367 */
367 368
368 drop(item) 369 bool
369 struct linked_list *item; 370 drop(struct linked_list *item)
370 { 371 {
371 register char ch = 0; 372 register char ch = 0;
372 register struct linked_list *obj, *nobj; 373 register struct linked_list *obj, *nobj;
373 register struct object *op; 374 register struct object *op;
374 375
471 472
472 /* 473 /*
473 * do special checks for dropping or unweilding|unwearing|unringing 474 * do special checks for dropping or unweilding|unwearing|unringing
474 */ 475 */
475 476
476 dropcheck(op) 477 bool
477 register struct object *op; 478 dropcheck(struct object *op)
478 { 479 {
479 int save_max; 480 int save_max;
480 481
481 if (op == NULL) 482 if (op == NULL)
482 return TRUE; 483 return TRUE;
581 /* 582 /*
582 * return a new thing 583 * return a new thing
583 */ 584 */
584 585
585 struct linked_list * 586 struct linked_list *
586 new_thing(thing_type, allow_curse) 587 new_thing(int thing_type, bool allow_curse)
587 int thing_type;
588 bool allow_curse;
589 { 588 {
590 register struct linked_list *item; 589 register struct linked_list *item;
591 register struct object *cur; 590 register struct object *cur;
592 register int j; 591 register int j;
593 register int blesschance, cursechance; 592 register int blesschance, cursechance;
799 /* 798 /*
800 * provide a new item tailored to specification 799 * provide a new item tailored to specification
801 */ 800 */
802 801
803 struct linked_list * 802 struct linked_list *
804 spec_item(type, which, hit, damage) 803 spec_item(int type, int which, int hit, int damage)
805 int type, which, hit, damage;
806 { 804 {
807 register struct linked_list *item; 805 register struct linked_list *item;
808 register struct object *obj; 806 register struct object *obj;
809 807
810 item = new_item(sizeof *obj); 808 item = new_item(sizeof *obj);
875 873
876 /* 874 /*
877 * pick an item out of a list of nitems possible magic items 875 * pick an item out of a list of nitems possible magic items
878 */ 876 */
879 877
880 pick_one(magic, nitems) 878 int
881 register struct magic_item *magic; 879 pick_one(struct magic_item *magic, int nitems)
882 int nitems;
883 { 880 {
884 register struct magic_item *end; 881 register struct magic_item *end;
885 register int i; 882 register int i;
886 register struct magic_item *start; 883 register struct magic_item *start;
887 884
906 /* blesscurse returns whether, according to the flag, the object is 903 /* blesscurse returns whether, according to the flag, the object is
907 * blessed, cursed, or neither 904 * blessed, cursed, or neither
908 */ 905 */
909 906
910 char * 907 char *
911 blesscurse(flags) 908 blesscurse(int flags)
912 int flags;
913 { 909 {
914 if (flags & ISKNOW) { 910 if (flags & ISKNOW) {
915 if (flags & ISCURSED) return("cursed "); 911 if (flags & ISCURSED) return("cursed ");
916 if (flags & ISBLESSED) return("blessed "); 912 if (flags & ISBLESSED) return("blessed ");
917 return("normal "); 913 return("normal ");
920 } 916 }
921 917
922 /* 918 /*
923 * p_kind returns the type of potion for some types of identified potions; 919 * p_kind returns the type of potion for some types of identified potions;
924 * otherwise, it returns the color. 920 * otherwise, it returns the color.
921 * We assume that obj points to a potion.
925 */ 922 */
926 923
927 char * 924 char *
928 p_kind(obj) 925 p_kind(struct object *obj)
929 struct object *obj; /* We assume that obj points to a potion */
930 { 926 {
931 if (obj->o_which == P_ABIL) return(abilities[obj->o_kind].w_string); 927 if (obj->o_which == P_ABIL) return(abilities[obj->o_kind].w_string);
932 else return(p_colors[obj->o_which]); 928 else return(p_colors[obj->o_which]);
933 } 929 }
934 930
935 /* 931 /*
936 * extras: 932 * extras:
937 * Return the number of extra items to be created 933 * Return the number of extra items to be created
938 */ 934 */
939 935
940 extras() 936 int
937 extras(void)
941 { 938 {
942 reg int i; 939 reg int i;
943 940
944 i = rnd(100); 941 i = rnd(100);
945 if (i < 3) /* 3% for 2 more */ 942 if (i < 3) /* 3% for 2 more */