… | |
… | |
1473 | } |
1473 | } |
1474 | } |
1474 | } |
1475 | |
1475 | |
1476 | retval->part = best; |
1476 | retval->part = best; |
1477 | retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); |
1477 | retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); |
1478 | retval->direction = find_dir_2 (-retval->distance_x, -retval->distance_y); |
1478 | retval->direction = find_dir_2 (retval->distance_x, retval->distance_y); |
1479 | } |
1479 | } |
1480 | } |
1480 | } |
1481 | |
1481 | |
1482 | /* this is basically the same as get_rangevector above, but instead of |
1482 | /* this is basically the same as get_rangevector above, but instead of |
1483 | * the first parameter being an object, it instead is the map |
1483 | * the first parameter being an object, it instead is the map |
… | |
… | |
1493 | get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags) |
1493 | get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags) |
1494 | { |
1494 | { |
1495 | if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) |
1495 | if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) |
1496 | { |
1496 | { |
1497 | /* be conservative and fill in _some_ data */ |
1497 | /* be conservative and fill in _some_ data */ |
1498 | retval->distance = 100000; |
1498 | retval->distance = 100000; |
1499 | retval->distance_x = 32767; |
1499 | retval->distance_x = 32767; |
1500 | retval->distance_y = 32767; |
1500 | retval->distance_y = 32767; |
1501 | retval->direction = 0; |
1501 | retval->direction = 0; |
1502 | retval->part = 0; |
1502 | retval->part = 0; |
1503 | } |
1503 | } |
1504 | else |
1504 | else |
1505 | { |
1505 | { |
1506 | retval->distance_x += op2->x - x; |
1506 | retval->distance_x += op2->x - x; |
1507 | retval->distance_y += op2->y - y; |
1507 | retval->distance_y += op2->y - y; |
1508 | |
1508 | |
1509 | retval->part = 0; |
1509 | retval->part = 0; |
1510 | retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); |
1510 | retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); |
1511 | retval->direction = find_dir_2 (-retval->distance_x, -retval->distance_y); |
1511 | retval->direction = find_dir_2 (retval->distance_x, retval->distance_y); |
1512 | } |
1512 | } |
1513 | } |
1513 | } |
1514 | |
1514 | |
1515 | /* Returns true of op1 and op2 are effectively on the same map |
1515 | /* Returns true of op1 and op2 are effectively on the same map |
1516 | * (as related to map tiling). Note that this looks for a path from |
1516 | * (as related to map tiling). Note that this looks for a path from |