comparison arogue5/things.c @ 225:4f6e056438eb

Merge the GCC5 and build fix branches.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:28:34 -0500
parents 56e748983fa8
children
comparison
equal deleted inserted replaced
224:4d0f53998e8a 225:4f6e056438eb
16 #include "curses.h" 16 #include "curses.h"
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 20
21 int extras(void);
22
21 /* 23 /*
22 * print out the number of charges on a stick 24 * print out the number of charges on a stick
23 */ 25 */
24 char * 26 char *
25 charge_str(obj) 27 charge_str(struct object *obj)
26 register struct object *obj;
27 { 28 {
28 static char buf[20]; 29 static char buf[20];
29 30
30 if (!(obj->o_flags & ISKNOW)) 31 if (!(obj->o_flags & ISKNOW))
31 buf[0] = '\0'; 32 buf[0] = '\0';
39 * inv_name: 40 * inv_name:
40 * return the name of something as it would appear in an 41 * return the name of something as it would appear in an
41 * inventory. 42 * inventory.
42 */ 43 */
43 char * 44 char *
44 inv_name(obj, drop) 45 inv_name(struct object *obj, bool drop)
45 register struct object *obj;
46 bool drop;
47 { 46 {
48 register char *pb; 47 register char *pb;
49 48
50 pb = prbuf; 49 pb = prbuf;
51 pb[0] = '\0'; 50 pb[0] = '\0';
294 /* 293 /*
295 * weap_name: 294 * weap_name:
296 * Return the name of a weapon. 295 * Return the name of a weapon.
297 */ 296 */
298 char * 297 char *
299 weap_name(obj) 298 weap_name(struct object *obj)
300 register struct object *obj;
301 { 299 {
302 switch (obj->o_type) { 300 switch (obj->o_type) {
303 case WEAPON: 301 case WEAPON:
304 return(weaps[obj->o_which].w_name); 302 return(weaps[obj->o_which].w_name);
305 when RELIC: 303 when RELIC:
323 321
324 /* 322 /*
325 * drop: 323 * drop:
326 * put something down 324 * put something down
327 */ 325 */
328 drop(item) 326 bool
329 struct linked_list *item; 327 drop(struct linked_list *item)
330 { 328 {
331 register char ch = 0; 329 register char ch = 0;
332 register struct linked_list *obj, *nobj; 330 register struct linked_list *obj, *nobj;
333 register struct object *op; 331 register struct object *op;
334 332
411 } 409 }
412 410
413 /* 411 /*
414 * do special checks for dropping or unweilding|unwearing|unringing 412 * do special checks for dropping or unweilding|unwearing|unringing
415 */ 413 */
416 dropcheck(op) 414 bool
417 register struct object *op; 415 dropcheck(struct object *op)
418 { 416 {
419 int save_max; 417 int save_max;
420 418
421 if (op == NULL) 419 if (op == NULL)
422 return TRUE; 420 return TRUE;
512 510
513 /* 511 /*
514 * return a new thing 512 * return a new thing
515 */ 513 */
516 struct linked_list * 514 struct linked_list *
517 new_thing(thing_type) 515 new_thing(int thing_type)
518 int thing_type;
519 { 516 {
520 register struct linked_list *item; 517 register struct linked_list *item;
521 register struct object *cur; 518 register struct object *cur;
522 register int j, k; 519 register int j, k;
523 register int blesschance, cursechance; 520 register int blesschance, cursechance;
708 705
709 /* 706 /*
710 * provide a new item tailored to specification 707 * provide a new item tailored to specification
711 */ 708 */
712 struct linked_list * 709 struct linked_list *
713 spec_item(type, which, hit, damage) 710 spec_item(int type, int which, int hit, int damage)
714 int type, which, hit, damage;
715 { 711 {
716 register struct linked_list *item; 712 register struct linked_list *item;
717 register struct object *obj; 713 register struct object *obj;
718 714
719 item = new_item(sizeof *obj); 715 item = new_item(sizeof *obj);
785 } 781 }
786 782
787 /* 783 /*
788 * pick an item out of a list of nitems possible magic items 784 * pick an item out of a list of nitems possible magic items
789 */ 785 */
790 pick_one(magic, nitems) 786 int
791 register struct magic_item *magic; 787 pick_one(struct magic_item *magic, int nitems)
792 int nitems;
793 { 788 {
794 register struct magic_item *end; 789 register struct magic_item *end;
795 register int i; 790 register int i;
796 register struct magic_item *start; 791 register struct magic_item *start;
797 792
819 /* blesscurse returns whether, according to the flag, the object is 814 /* blesscurse returns whether, according to the flag, the object is
820 * blessed, cursed, or neither 815 * blessed, cursed, or neither
821 */ 816 */
822 817
823 char * 818 char *
824 blesscurse(flags) 819 blesscurse(int flags)
825 int flags;
826 { 820 {
827 if (flags & ISKNOW) { 821 if (flags & ISKNOW) {
828 if (flags & ISCURSED) return("cursed "); 822 if (flags & ISCURSED) return("cursed ");
829 if (flags & ISBLESSED) return("blessed "); 823 if (flags & ISBLESSED) return("blessed ");
830 return("normal "); 824 return("normal ");
834 828
835 /* 829 /*
836 * extras: 830 * extras:
837 * Return the number of extra items to be created 831 * Return the number of extra items to be created
838 */ 832 */
839 extras() 833 int
834 extras(void)
840 { 835 {
841 reg int i; 836 reg int i;
842 837
843 i = rnd(100); 838 i = rnd(100);
844 if (i < 4) /* 4% for 2 more */ 839 if (i < 4) /* 4% for 2 more */