Sick is overloaded with both fatal illness and food poisoning (via u.usick_type bit mask), but delayed killer can only support one or the other at a time. They should become separate intrinsics.... */
| 134 | u.usick_type bit mask), but delayed killer can only support one or |
| 135 | the other at a time. They should become separate intrinsics.... */ |
| 136 | void |
| 137 | make_sick(long xtime, |
| 138 | const char *cause, /* sickness cause */ |
| 139 | boolean talk, |
| 140 | int type) |
| 141 | { |
| 142 | struct kinfo *kptr; |
| 143 | long old = Sick; |
| 144 | |
| 145 | #if 0 /* tell player even if hero is unconscious */ |
| 146 | if (Unaware) |
| 147 | talk = FALSE; |
| 148 | #endif |
| 149 | if (xtime > 0L) { |
| 150 | if (Sick_resistance) |
| 151 | return; |
| 152 | if (!old) { |
| 153 | /* newly sick */ |
| 154 | You_feel("deathly sick."); |
| 155 | } else { |
| 156 | /* already sick */ |
| 157 | if (talk) |
| 158 | You_feel("%s worse.", xtime <= Sick / 2L ? "much" : "even"); |
| 159 | } |
| 160 | set_itimeout(&Sick, xtime); |
| 161 | u.usick_type |= type; |
| 162 | disp.botl = TRUE; |
| 163 | } else if (old && (type & u.usick_type)) { |
| 164 | /* was sick, now not */ |
| 165 | u.usick_type &= ~type; |
| 166 | if (u.usick_type) { /* only partly cured */ |
| 167 | if (talk) |
| 168 | You_feel("somewhat better."); |
| 169 | set_itimeout(&Sick, Sick * 2); /* approximation */ |
| 170 | } else { |
| 171 | if (talk) |
| 172 | You_feel("cured. What a relief!"); |
| 173 | Sick = 0L; /* set_itimeout(&Sick, 0L) */ |
| 174 | } |
| 175 | disp.botl = TRUE; |
| 176 | } |
| 177 | |
| 178 | kptr = find_delayed_killer(SICK); |
| 179 | if (Sick) { |
| 180 | exercise(A_CON, FALSE); |
| 181 | /* setting delayed_killer used to be unconditional, but that's |
| 182 | not right when make_sick(0) is called to cure food poisoning |
| 183 | if hero was also fatally ill; this is only approximate */ |
| 184 | if (xtime || !old || !kptr) { |
| 185 | int kpfx = ((cause && !strcmp(cause, "#wizintrinsic")) |
| 186 | ? KILLED_BY : KILLED_BY_AN); |
| 187 | |
| 188 | delayed_killer(SICK, kpfx, cause); |
| 189 | } |
| 190 | } else |
| 191 | dealloc_killer(kptr); |
| 192 | } |
| 193 |
no test coverage detected