Mercurial > hg > early-roguelike
comparison xrogue/encumb.c @ 225:4f6e056438eb
Merge the GCC5 and build fix branches.
| author | John "Elwin" Edwards |
|---|---|
| date | Wed, 02 Mar 2016 21:28:34 -0500 |
| parents | f54901b9c39b |
| children | 7c1cb43f346e |
comparison
equal
deleted
inserted
replaced
| 224:4d0f53998e8a | 225:4f6e056438eb |
|---|---|
| 13 */ | 13 */ |
| 14 | 14 |
| 15 #include <curses.h> | 15 #include <curses.h> |
| 16 #include "rogue.h" | 16 #include "rogue.h" |
| 17 | 17 |
| 18 int packweight(struct thing *tp); | |
| 19 | |
| 18 /* | 20 /* |
| 19 * updpack: | 21 * updpack: |
| 20 * Update his pack weight and adjust fooduse accordingly | 22 * Update his pack weight and adjust fooduse accordingly |
| 21 */ | 23 */ |
| 22 | 24 |
| 23 updpack(getmax, tp) | 25 void |
| 24 int getmax; | 26 updpack(int getmax, struct thing *tp) |
| 25 struct thing *tp; | |
| 26 { | 27 { |
| 27 | 28 |
| 28 reg int topcarry, curcarry; | 29 reg int topcarry, curcarry; |
| 29 | 30 |
| 30 if (getmax) | 31 if (getmax) |
| 50 /* | 51 /* |
| 51 * packweight: | 52 * packweight: |
| 52 * Get the total weight of the hero's pack | 53 * Get the total weight of the hero's pack |
| 53 */ | 54 */ |
| 54 | 55 |
| 55 packweight(tp) | 56 int |
| 56 register struct thing *tp; | 57 packweight(struct thing *tp) |
| 57 { | 58 { |
| 58 reg struct object *obj; | 59 reg struct object *obj; |
| 59 reg struct linked_list *pc; | 60 reg struct linked_list *pc; |
| 60 reg int weight; | 61 reg int weight; |
| 61 | 62 |
| 87 /* | 88 /* |
| 88 * itemweight: | 89 * itemweight: |
| 89 * Get the weight of an object | 90 * Get the weight of an object |
| 90 */ | 91 */ |
| 91 | 92 |
| 92 itemweight(wh) | 93 int |
| 93 reg struct object *wh; | 94 itemweight(struct object *wh) |
| 94 { | 95 { |
| 95 reg int weight; | 96 reg int weight; |
| 96 reg int ac; | 97 reg int ac; |
| 97 | 98 |
| 98 weight = wh->o_weight; /* get base weight */ | 99 weight = wh->o_weight; /* get base weight */ |
| 118 /* | 119 /* |
| 119 * playenc: | 120 * playenc: |
| 120 * Get hero's carrying ability above norm | 121 * Get hero's carrying ability above norm |
| 121 */ | 122 */ |
| 122 | 123 |
| 123 playenc(tp) | 124 int |
| 124 register struct thing *tp; | 125 playenc(struct thing *tp) |
| 125 { | 126 { |
| 126 register int strength; | 127 register int strength; |
| 127 | 128 |
| 128 if (tp == &player) strength = str_compute(); | 129 if (tp == &player) strength = str_compute(); |
| 129 else strength = tp->t_stats.s_str; | 130 else strength = tp->t_stats.s_str; |
| 134 /* | 135 /* |
| 135 * totalenc: | 136 * totalenc: |
| 136 * Get total weight that the hero can carry | 137 * Get total weight that the hero can carry |
| 137 */ | 138 */ |
| 138 | 139 |
| 139 totalenc(tp) | 140 int |
| 140 register struct thing *tp; | 141 totalenc(struct thing *tp) |
| 141 { | 142 { |
| 142 reg int wtotal; | 143 reg int wtotal; |
| 143 | 144 |
| 144 wtotal = NORMENCB + playenc(tp); | 145 wtotal = NORMENCB + playenc(tp); |
| 145 if (tp == &player) switch(hungry_state) { | 146 if (tp == &player) switch(hungry_state) { |
| 155 /* | 156 /* |
| 156 * whgtchk: | 157 * whgtchk: |
| 157 * See if the hero can carry his pack | 158 * See if the hero can carry his pack |
| 158 */ | 159 */ |
| 159 | 160 |
| 160 wghtchk() | 161 void |
| 162 wghtchk(void) | |
| 161 { | 163 { |
| 162 reg int dropchk, err = TRUE; | 164 reg int dropchk, err = TRUE; |
| 163 reg char ch; | 165 reg char ch; |
| 164 int wghtchk(); | |
| 165 | 166 |
| 166 inwhgt = TRUE; | 167 inwhgt = TRUE; |
| 167 if (pstats.s_pack > pstats.s_carry) { | 168 if (pstats.s_pack > pstats.s_carry) { |
| 168 ch = mvwinch(stdscr, hero.y, hero.x); | 169 ch = mvwinch(stdscr, hero.y, hero.x); |
| 169 if((ch != FLOOR && ch != PASSAGE)) { | 170 if((ch != FLOOR && ch != PASSAGE)) { |
| 193 * This returns a +1 hit for light pack weight | 194 * This returns a +1 hit for light pack weight |
| 194 * 0 hit for medium pack weight | 195 * 0 hit for medium pack weight |
| 195 * -1 hit for heavy pack weight | 196 * -1 hit for heavy pack weight |
| 196 */ | 197 */ |
| 197 | 198 |
| 198 hitweight() | 199 int |
| 200 hitweight(void) | |
| 199 { | 201 { |
| 200 return(2 - foodlev); | 202 return(2 - foodlev); |
| 201 } | 203 } |
| 202 | 204 |
