Fix some issues found with fuzz testing

Mostly to do with relocating monsters when the level is already full,
and unsticking a monster if it gets relocated.
This commit is contained in:
Pasi Kallinen
2016-12-07 17:53:03 +02:00
parent daff7653f8
commit b8d8556eff
5 changed files with 34 additions and 10 deletions

View File

@@ -430,9 +430,10 @@ boolean with_you;
mtmp->mx = 0; /*(already is 0)*/
mtmp->my = xyflags;
if (xlocale)
(void) mnearto(mtmp, xlocale, ylocale, FALSE);
else {
if (xlocale) {
if (!mnearto(mtmp, xlocale, ylocale, FALSE))
goto fail_mon_placement;
} else {
if (!rloc(mtmp, TRUE)) {
/*
* Failed to place migrating monster,
@@ -440,6 +441,7 @@ boolean with_you;
* Dump the monster's cargo and leave the monster dead.
*/
struct obj *obj;
fail_mon_placement:
while ((obj = mtmp->minvent) != 0) {
obj_extract_self(obj);
obj_no_longer_held(obj);