comparison arogue7/encumb.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents adfa37e67084
children e1cd27c5464f
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
18 */ 18 */
19 19
20 #include "curses.h" 20 #include "curses.h"
21 #include "rogue.h" 21 #include "rogue.h"
22 22
23 int packweight(struct thing *tp);
24
23 /* 25 /*
24 * updpack: 26 * updpack:
25 * Update his pack weight and adjust fooduse accordingly 27 * Update his pack weight and adjust fooduse accordingly
26 */ 28 */
27 updpack(getmax, tp) 29 void
28 int getmax; 30 updpack(int getmax, struct thing *tp)
29 struct thing *tp;
30 { 31 {
31 32
32 reg int topcarry, curcarry; 33 reg int topcarry, curcarry;
33 34
34 if (getmax) 35 if (getmax)
53 54
54 /* 55 /*
55 * packweight: 56 * packweight:
56 * Get the total weight of the hero's pack 57 * Get the total weight of the hero's pack
57 */ 58 */
58 packweight(tp) 59 int
59 register struct thing *tp; 60 packweight(struct thing *tp)
60 { 61 {
61 reg struct object *obj; 62 reg struct object *obj;
62 reg struct linked_list *pc; 63 reg struct linked_list *pc;
63 reg int weight; 64 reg int weight;
64 65
90 91
91 /* 92 /*
92 * itemweight: 93 * itemweight:
93 * Get the weight of an object 94 * Get the weight of an object
94 */ 95 */
95 itemweight(wh) 96 int
96 reg struct object *wh; 97 itemweight(struct object *wh)
97 { 98 {
98 reg int weight; 99 reg int weight;
99 reg int ac; 100 reg int ac;
100 101
101 weight = wh->o_weight; /* get base weight */ 102 weight = wh->o_weight; /* get base weight */
121 122
122 /* 123 /*
123 * playenc: 124 * playenc:
124 * Get hero's carrying ability above norm 125 * Get hero's carrying ability above norm
125 */ 126 */
126 playenc(tp) 127 int
127 register struct thing *tp; 128 playenc(struct thing *tp)
128 { 129 {
129 register int strength; 130 register int strength;
130 131
131 if (tp == &player) strength = str_compute(); 132 if (tp == &player) strength = str_compute();
132 else strength = tp->t_stats.s_str; 133 else strength = tp->t_stats.s_str;
137 138
138 /* 139 /*
139 * totalenc: 140 * totalenc:
140 * Get total weight that the hero can carry 141 * Get total weight that the hero can carry
141 */ 142 */
142 totalenc(tp) 143 int
143 register struct thing *tp; 144 totalenc(struct thing *tp)
144 { 145 {
145 reg int wtotal; 146 reg int wtotal;
146 147
147 wtotal = NORMENCB + playenc(tp); 148 wtotal = NORMENCB + playenc(tp);
148 if (tp == &player) switch(hungry_state) { 149 if (tp == &player) switch(hungry_state) {
160 /* 161 /*
161 * whgtchk: 162 * whgtchk:
162 * See if the hero can carry his pack 163 * See if the hero can carry his pack
163 */ 164 */
164 165
165 wghtchk() 166 void
167 wghtchk(void)
166 { 168 {
167 reg int dropchk, err = TRUE; 169 reg int dropchk, err = TRUE;
168 reg char ch; 170 reg char ch;
169 int wghtchk();
170 171
171 inwhgt = TRUE; 172 inwhgt = TRUE;
172 if (pstats.s_pack > pstats.s_carry) { 173 if (pstats.s_pack > pstats.s_carry) {
173 ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) ); 174 ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) );
174 if((ch != FLOOR && ch != PASSAGE)) { 175 if((ch != FLOOR && ch != PASSAGE)) {
199 * This returns a +1 hit for light pack weight 200 * This returns a +1 hit for light pack weight
200 * 0 hit for medium pack weight 201 * 0 hit for medium pack weight
201 * -1 hit for heavy pack weight 202 * -1 hit for heavy pack weight
202 */ 203 */
203 204
204 hitweight() 205 int
206 hitweight(void)
205 { 207 {
206 return(2 - foodlev); 208 return(2 - foodlev);
207 } 209 }