Take a single bite from a piece of food, checking for choking and * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise. */
| 3130 | * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise. |
| 3131 | */ |
| 3132 | staticfn int |
| 3133 | bite(void) |
| 3134 | { |
| 3135 | /* hack to pacify static analyzer incorporated into gcc 12.2 */ |
| 3136 | sa_victual(&svc.context.victual); |
| 3137 | |
| 3138 | if (svc.context.victual.canchoke && u.uhunger >= 2000) { |
| 3139 | choke(svc.context.victual.piece); |
| 3140 | return 1; |
| 3141 | } |
| 3142 | if (svc.context.victual.doreset) { |
| 3143 | do_reset_eat(); |
| 3144 | return 0; |
| 3145 | } |
| 3146 | gf.force_save_hs = TRUE; |
| 3147 | if (svc.context.victual.nmod < 0) { |
| 3148 | lesshungry(adj_victual_nutrition(/*-svc.context.victual.nmod*/)); |
| 3149 | consume_oeaten(svc.context.victual.piece, |
| 3150 | svc.context.victual.nmod); /* -= -nmod */ |
| 3151 | } else if (svc.context.victual.nmod > 0 |
| 3152 | && (svc.context.victual.usedtime % svc.context.victual.nmod)) { |
| 3153 | lesshungry(1); |
| 3154 | consume_oeaten(svc.context.victual.piece, -1); /* -= 1 */ |
| 3155 | } |
| 3156 | gf.force_save_hs = FALSE; |
| 3157 | recalc_wt(); |
| 3158 | return 0; |
| 3159 | } |
| 3160 | |
| 3161 | /* as time goes by - called by moveloop(every move) & domove(melee attack) */ |
| 3162 | void |
no test coverage detected