called when hallucination is toggled */
| 178 | |
| 179 | /* called when hallucination is toggled */ |
| 180 | void |
| 181 | eatmupdate(void) |
| 182 | { |
| 183 | const char *altmsg = 0; |
| 184 | int altapp = 0; /* lint suppression */ |
| 185 | |
| 186 | if (!ge.eatmbuf || gn.nomovemsg != ge.eatmbuf) |
| 187 | return; |
| 188 | |
| 189 | if (is_obj_mappear(&gy.youmonst,ORANGE) && !Hallucination) { |
| 190 | /* revert from hallucinatory to "normal" mimicking */ |
| 191 | altmsg = "You now prefer mimicking yourself."; |
| 192 | altapp = GOLD_PIECE; |
| 193 | } else if (is_obj_mappear(&gy.youmonst,GOLD_PIECE) && Hallucination) { |
| 194 | /* won't happen; anything which might make immobilized |
| 195 | hero begin hallucinating (black light attack, theft |
| 196 | of Grayswandir) will terminate the mimicry first */ |
| 197 | altmsg = "Your rind escaped intact."; |
| 198 | altapp = ORANGE; |
| 199 | } |
| 200 | |
| 201 | if (altmsg) { |
| 202 | /* replace end-of-mimicking message */ |
| 203 | unsigned amlen = Strlen(altmsg); |
| 204 | if (amlen > Strlen(ge.eatmbuf)) { |
| 205 | free((genericptr_t) ge.eatmbuf); |
| 206 | ge.eatmbuf = (char *) alloc(amlen + 1); |
| 207 | } |
| 208 | gn.nomovemsg = strcpy(ge.eatmbuf, altmsg); |
| 209 | /* update current image */ |
| 210 | gy.youmonst.mappearance = altapp; |
| 211 | newsym(u.ux, u.uy); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | /* ``[the(] singular(food, xname) [)]'' */ |
| 216 | staticfn const char * |
no test coverage detected