… | |
… | |
739 | { |
739 | { |
740 | keyword kw = thawer.get_kv (); |
740 | keyword kw = thawer.get_kv (); |
741 | |
741 | |
742 | switch (kw) |
742 | switch (kw) |
743 | { |
743 | { |
744 | case KW_EOF: |
|
|
745 | LOG (llevError, "%s: end of file while reading map header, aborting header load.\n", &path); |
|
|
746 | return false; |
|
|
747 | |
|
|
748 | case KW_end: |
|
|
749 | return true; |
|
|
750 | |
|
|
751 | default: |
|
|
752 | case KW_ERROR: |
|
|
753 | LOG (llevError, "%s: skipping errornous line (%s) while reading map header.\n", &path, thawer.last_keyword); |
|
|
754 | break; |
|
|
755 | |
|
|
756 | case KW_msg: |
744 | case KW_msg: |
757 | thawer.get_ml (KW_endmsg, msg); |
745 | thawer.get_ml (KW_endmsg, msg); |
758 | break; |
746 | break; |
759 | |
747 | |
760 | case KW_lore: // CF+ extension |
748 | case KW_lore: // CF+ extension |
… | |
… | |
810 | |
798 | |
811 | case KW_tile_path_1: thawer.get (tile_path [0]); break; |
799 | case KW_tile_path_1: thawer.get (tile_path [0]); break; |
812 | case KW_tile_path_2: thawer.get (tile_path [1]); break; |
800 | case KW_tile_path_2: thawer.get (tile_path [1]); break; |
813 | case KW_tile_path_3: thawer.get (tile_path [2]); break; |
801 | case KW_tile_path_3: thawer.get (tile_path [2]); break; |
814 | case KW_tile_path_4: thawer.get (tile_path [3]); break; |
802 | case KW_tile_path_4: thawer.get (tile_path [3]); break; |
|
|
803 | |
|
|
804 | case KW_end: |
|
|
805 | return true; |
|
|
806 | |
|
|
807 | default: |
|
|
808 | if (!thawer.parse_error (kw, "map", 0)) |
|
|
809 | return false; |
|
|
810 | break; |
815 | } |
811 | } |
816 | } |
812 | } |
817 | |
813 | |
818 | abort (); |
814 | abort (); |
819 | } |
815 | } |
… | |
… | |
1452 | |
1448 | |
1453 | /** |
1449 | /** |
1454 | * Return whether map2 is adjacent to map1. If so, store the distance from |
1450 | * Return whether map2 is adjacent to map1. If so, store the distance from |
1455 | * map1 to map2 in dx/dy. |
1451 | * map1 to map2 in dx/dy. |
1456 | */ |
1452 | */ |
1457 | static int |
1453 | int |
1458 | adjacent_map (const maptile *map1, const maptile *map2, int *dx, int *dy) |
1454 | adjacent_map (const maptile *map1, const maptile *map2, int *dx, int *dy) |
1459 | { |
1455 | { |
1460 | if (!map1 || !map2) |
1456 | if (!map1 || !map2) |
1461 | return 0; |
1457 | return 0; |
1462 | |
1458 | |
… | |
… | |
1634 | * flags has no meaning for this function at this time - I kept it in to |
1630 | * flags has no meaning for this function at this time - I kept it in to |
1635 | * be more consistant with the above function and also in case they are needed |
1631 | * be more consistant with the above function and also in case they are needed |
1636 | * for something in the future. Also, since no object is pasted, the best |
1632 | * for something in the future. Also, since no object is pasted, the best |
1637 | * field of the rv_vector is set to NULL. |
1633 | * field of the rv_vector is set to NULL. |
1638 | */ |
1634 | */ |
1639 | |
|
|
1640 | void |
1635 | void |
1641 | get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector * retval, int flags) |
1636 | get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags) |
1642 | { |
1637 | { |
1643 | if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) |
1638 | if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) |
1644 | { |
1639 | { |
1645 | /* be conservative and fill in _some_ data */ |
1640 | /* be conservative and fill in _some_ data */ |
1646 | retval->distance = 100000; |
1641 | retval->distance = 100000; |