… | |
… | |
653 | maptile::unlink () |
653 | maptile::unlink () |
654 | { |
654 | { |
655 | if (first_map == this) |
655 | if (first_map == this) |
656 | first_map = next; |
656 | first_map = next; |
657 | else |
657 | else |
|
|
658 | { |
658 | for_all_maps (m) |
659 | for_all_maps (m) |
659 | if (m->next = this) |
660 | if (m->next = this) |
660 | { |
661 | { |
661 | m->next = next; |
662 | m->next = next; |
662 | break; |
663 | return; |
663 | } |
664 | } |
|
|
665 | |
|
|
666 | LOG (llevError, "maptile::unlink() map not on list: %s\n", path); |
|
|
667 | } |
664 | } |
668 | } |
665 | |
669 | |
666 | /* |
670 | /* |
667 | * Allocates, initialises, and returns a pointer to a maptile. |
671 | * Allocates, initialises, and returns a pointer to a maptile. |
668 | * Modified to no longer take a path option which was not being |
672 | * Modified to no longer take a path option which was not being |
… | |
… | |
705 | maptile * |
709 | maptile * |
706 | get_empty_map (int sizex, int sizey) |
710 | get_empty_map (int sizex, int sizey) |
707 | { |
711 | { |
708 | maptile *m = get_linked_map (); |
712 | maptile *m = get_linked_map (); |
709 | |
713 | |
710 | m->width = sizex; |
714 | m->width = sizex; |
711 | m->height = sizey; |
715 | m->height = sizey; |
712 | m->in_memory = MAP_SWAPPED; |
716 | m->in_memory = MAP_SWAPPED; |
|
|
717 | |
713 | m->allocate (); |
718 | m->allocate (); |
714 | |
719 | |
715 | return m; |
720 | return m; |
716 | } |
721 | } |
717 | |
722 | |
718 | /* Takes a string from a map definition and outputs a pointer to the array of shopitems |
723 | /* Takes a string from a map definition and outputs a pointer to the array of shopitems |
719 | * corresponding to that string. Memory is allocated for this, it must be freed |
724 | * corresponding to that string. Memory is allocated for this, it must be freed |
720 | * at a later date. |
725 | * at a later date. |
721 | * Called by parse_map_headers below. |
726 | * Called by parse_map_headers below. |
722 | */ |
727 | */ |
723 | |
|
|
724 | static shopitems * |
728 | static shopitems * |
725 | parse_shop_string (const char *input_string) |
729 | parse_shop_string (const char *input_string) |
726 | { |
730 | { |
727 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
731 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
728 | shopitems *items = NULL; |
732 | shopitems *items = NULL; |
… | |
… | |
1959 | } |
1963 | } |
1960 | |
1964 | |
1961 | void |
1965 | void |
1962 | set_map_reset_time (maptile *map) |
1966 | set_map_reset_time (maptile *map) |
1963 | { |
1967 | { |
1964 | int timeout; |
|
|
1965 | |
|
|
1966 | timeout = map->reset_timeout; |
1968 | int timeout = map->reset_timeout; |
|
|
1969 | |
1967 | if (timeout <= 0) |
1970 | if (timeout <= 0) |
1968 | timeout = MAP_DEFAULTRESET; |
1971 | timeout = MAP_DEFAULTRESET; |
1969 | if (timeout >= MAP_MAXRESET) |
1972 | if (timeout >= MAP_MAXRESET) |
1970 | timeout = MAP_MAXRESET; |
1973 | timeout = MAP_MAXRESET; |
|
|
1974 | |
1971 | map->reset_time = time (0) + timeout; |
1975 | map->reset_time = time (0) + timeout; |
1972 | } |
1976 | } |
1973 | |
1977 | |
1974 | /* this updates the orig_map->tile_map[tile_num] value after loading |
1978 | /* this updates the orig_map->tile_map[tile_num] value after loading |
1975 | * the map. It also takes care of linking back the freshly loaded |
1979 | * the map. It also takes care of linking back the freshly loaded |