perform movement for a single monster. meant to be used with iter_mons_safe. */
| 1211 | /* perform movement for a single monster. |
| 1212 | meant to be used with iter_mons_safe. */ |
| 1213 | boolean |
| 1214 | movemon_singlemon(struct monst *mtmp) |
| 1215 | { |
| 1216 | /* end monster movement early if hero is flagged to leave the level */ |
| 1217 | if (u.utotype |
| 1218 | #ifdef SAFERHANGUP |
| 1219 | /* or if the program has lost contact with the user */ |
| 1220 | || program_state.done_hup |
| 1221 | #endif |
| 1222 | ) { |
| 1223 | gs.somebody_can_move = FALSE; |
| 1224 | return TRUE; |
| 1225 | } |
| 1226 | |
| 1227 | /* one dead monster needs to perform a move after death: vault |
| 1228 | guard whose temporary corridor is still on the map; live |
| 1229 | guards who have led the hero back to civilization get moved |
| 1230 | off the map too; gd_move() decides whether the temporary |
| 1231 | corridor can be removed and guard discarded (via clearing |
| 1232 | mon->isgd flag so that dmonsfree() will get rid of mon) */ |
| 1233 | if (mtmp->isgd && !mtmp->mx && !(mtmp->mstate & MON_MIGRATING)) { |
| 1234 | /* parked at <0,0>; eventually isgd should get set to false */ |
| 1235 | if (svm.moves > mtmp->mlstmv) { |
| 1236 | (void) gd_move(mtmp); |
| 1237 | mtmp->mlstmv = svm.moves; |
| 1238 | } |
| 1239 | return FALSE; |
| 1240 | } |
| 1241 | if (DEADMONSTER(mtmp)) |
| 1242 | return FALSE; |
| 1243 | |
| 1244 | /* monster isn't on this map anymore */ |
| 1245 | if (mon_offmap(mtmp)) |
| 1246 | return FALSE; |
| 1247 | |
| 1248 | m_everyturn_effect(mtmp); |
| 1249 | |
| 1250 | /* Find a monster that we have not treated yet. */ |
| 1251 | if (mtmp->movement < NORMAL_SPEED) |
| 1252 | return FALSE; |
| 1253 | |
| 1254 | mtmp->movement -= NORMAL_SPEED; |
| 1255 | if (mtmp->movement >= NORMAL_SPEED) |
| 1256 | gs.somebody_can_move = TRUE; |
| 1257 | |
| 1258 | if (gv.vision_full_recalc) |
| 1259 | vision_recalc(0); /* vision! */ |
| 1260 | |
| 1261 | /* reset obj bypasses before next monster moves */ |
| 1262 | if (svc.context.bypasses) |
| 1263 | clear_bypasses(); |
| 1264 | clear_splitobjs(); |
| 1265 | if (minliquid(mtmp)) |
| 1266 | return FALSE; |
| 1267 | |
| 1268 | /* after losing equipment, try to put on replacement */ |
| 1269 | if (mtmp->misc_worn_check & I_SPECIAL) { |
| 1270 | long oldworn; |
nothing calls this directly
no test coverage detected