… | |
… | |
393 | return 0; |
393 | return 0; |
394 | |
394 | |
395 | while (diff > 1 && max > 0) |
395 | while (diff > 1 && max > 0) |
396 | { |
396 | { |
397 | mapxy lastpos = pos; |
397 | mapxy lastpos = pos; |
|
|
398 | |
398 | pos.move (dir); |
399 | pos.move (dir); |
399 | |
400 | |
400 | MoveType blocked; |
|
|
401 | bool blocksview; |
|
|
402 | |
|
|
403 | if (pos.normalise ()) |
|
|
404 | { |
|
|
405 | mapspace &ms = *pos; |
|
|
406 | |
|
|
407 | blocksview = ms.flags () & P_BLOCKSVIEW; |
|
|
408 | blocked = ms.move_block; |
|
|
409 | } |
|
|
410 | else |
|
|
411 | { |
|
|
412 | blocksview = true; |
|
|
413 | blocked = MOVE_ALL; |
|
|
414 | } |
|
|
415 | |
|
|
416 | /* Space is blocked - try changing direction a little */ |
401 | /* Space is blocked - try changing direction a little */ |
417 | if ((blocksview || OB_TYPE_MOVE_BLOCK (mon, blocked)) |
402 | if (!pos.normalise () |
|
|
403 | || (((pos->flags () & P_BLOCKSVIEW) || OB_TYPE_MOVE_BLOCK (mon, pos->move_block)) |
418 | && (blocked_link (mon, pos.m, pos.x, pos.y))) |
404 | && blocked_link (mon, pos.m, pos.x, pos.y))) |
419 | { |
405 | { |
420 | /* recalculate direction from last good location. Possible |
406 | /* recalculate direction from last good location. Possible |
421 | * we were not traversing ideal location before. |
407 | * we were not traversing ideal location before. |
422 | */ |
408 | */ |
423 | get_rangevector_from_mapcoord (lastpos.m, lastpos.x, lastpos.y, pl, &rv, 0); |
409 | get_rangevector_from_mapcoord (lastpos.m, lastpos.x, lastpos.y, pl, &rv, 0); |