--- deliantra/server/common/map.C 2006/09/10 16:00:23 1.29 +++ deliantra/server/common/map.C 2006/12/13 02:55:49 1.42 @@ -1,9 +1,3 @@ - -/* - * static char *rcsid_map_c = - * "$Id: map.C,v 1.29 2006/09/10 16:00:23 root Exp $"; - */ - /* CrossFire, A Multiplayer game for X-windows @@ -24,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ @@ -32,24 +26,20 @@ #include #include -#ifndef WIN32 /* ---win32 exclude header */ -# include -#endif /* win32 */ +#include #include "path.h" -extern int nrofallocobjects, nroffreeobjects; - /* - * Returns the mapstruct which has a name matching the given argument. + * Returns the maptile which has a name matching the given argument. * return NULL if no match is found. */ -mapstruct * +maptile * has_been_loaded (const char *name) { - mapstruct *map; + maptile *map; if (!name || !*name) return 0; @@ -167,19 +157,14 @@ { char buf[MAX_BUF]; -#ifndef WIN32 char *endbuf; struct stat statbuf; int mode = 0; -#endif if (prepend_dir) strcpy (buf, create_pathname (name)); else strcpy (buf, name); -#ifdef WIN32 /* ***win32: check this sucker in windows style. */ - return (_access (buf, 0)); -#else /* old method (strchr(buf, '\0')) seemd very odd to me - * this method should be equivalant and is clearer. @@ -202,7 +187,6 @@ mode |= 2; return (mode); -#endif } /* @@ -212,7 +196,7 @@ */ void -dump_map (const mapstruct *m) +dump_map (const maptile *m) { LOG (llevError, "Map %s status: %d.\n", m->path, m->in_memory); LOG (llevError, "Size: %dx%d Start: %d,%d\n", MAP_WIDTH (m), MAP_HEIGHT (m), MAP_ENTER_X (m), MAP_ENTER_Y (m)); @@ -239,7 +223,7 @@ void dump_all_maps (void) { - mapstruct *m; + maptile *m; for (m = first_map; m != NULL; m = m->next) { @@ -258,11 +242,11 @@ * don't expect to insert/remove anything from those spaces. */ int -get_map_flags (mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 * nx, sint16 * ny) +get_map_flags (maptile *oldmap, maptile **newmap, sint16 x, sint16 y, sint16 * nx, sint16 * ny) { sint16 newx, newy; int retval = 0; - mapstruct *mp; + maptile *mp; if (out_of_map (oldmap, x, y)) return P_OUT_OF_MAP; @@ -283,7 +267,6 @@ return retval; } - /* * Returns true if the given coordinate is blocked except by the * object passed is not blocking. This is used with @@ -296,9 +279,8 @@ * the coordinates & map passed in should have been updated for tiling * by the caller. */ - int -blocked_link (object *ob, mapstruct *m, int sx, int sy) +blocked_link (object *ob, maptile *m, int sx, int sy) { object *tmp; int mflags, blocked; @@ -420,11 +402,11 @@ */ int -ob_blocked (const object *ob, mapstruct *m, sint16 x, sint16 y) +ob_blocked (const object *ob, maptile *m, sint16 x, sint16 y) { archetype *tmp; int flag; - mapstruct *m1; + maptile *m1; sint16 sx, sy; if (ob == NULL) @@ -499,7 +481,7 @@ */ static void -link_multipart_objects (mapstruct *m) +link_multipart_objects (maptile *m) { int x, y; object *tmp, *op, *last, *above; @@ -546,13 +528,13 @@ * mapflags is the same as we get with load_original_map */ void -load_objects (mapstruct *m, object_thawer & fp, int mapflags) +load_objects (maptile *m, object_thawer & fp, int mapflags) { int i, j; int unique; object *op, *prev = NULL, *last_more = NULL, *otmp; - op = get_object (); + op = object::create (); op->map = m; /* To handle buttons correctly */ while ((i = load_object (fp, op, mapflags))) @@ -570,29 +552,29 @@ switch (i) { - case LL_NORMAL: - /* if we are loading an overlay, put the floors on the bottom */ - if ((QUERY_FLAG (op, FLAG_IS_FLOOR) || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) - insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY | INS_MAP_LOAD); - else - insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); - - if (op->inv) - sum_weight (op); - - prev = op, last_more = op; - break; - - case LL_MORE: - insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY); - op->head = prev, last_more->more = op, last_more = op; - break; + case LL_NORMAL: + /* if we are loading an overlay, put the floors on the bottom */ + if ((QUERY_FLAG (op, FLAG_IS_FLOOR) || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) + insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY | INS_MAP_LOAD); + else + insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); + + if (op->inv) + sum_weight (op); + + prev = op, last_more = op; + break; + + case LL_MORE: + insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY); + op->head = prev, last_more->more = op, last_more = op; + break; } if (mapflags & MAP_STYLE) remove_from_active_list (op); - op = get_object (); + op = object::create (); op->map = m; } @@ -606,13 +588,14 @@ { if (QUERY_FLAG (otmp, FLAG_UNIQUE) || QUERY_FLAG (otmp, FLAG_OBJ_SAVE_ON_OVL)) unique = 1; + if (!(mapflags & (MAP_OVERLAY | MAP_PLAYER_UNIQUE) || unique)) SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); } } } - free_object (op); + op->destroy (); link_multipart_objects (m); } @@ -622,7 +605,7 @@ * in order to do map tiling properly. */ void -save_objects (mapstruct *m, object_freezer & fp, object_freezer & fp2, int flag) +save_objects (maptile *m, object_freezer & fp, object_freezer & fp2, int flag) { int i, j = 0, unique = 0; object *op; @@ -655,78 +638,83 @@ } /* for this j */ } +maptile::maptile () +{ + in_memory = MAP_SWAPPED; + /* The maps used to pick up default x and y values from the + * map archetype. Mimic that behaviour. + */ + MAP_WIDTH (this) = 16; + MAP_HEIGHT (this) = 16; + MAP_RESET_TIMEOUT (this) = 0; + MAP_TIMEOUT (this) = 300; + MAP_ENTER_X (this) = 0; + MAP_ENTER_Y (this) = 0; + /*set part to -1 indicating conversion to weather map not yet done */ + MAP_WORLDPARTX (this) = -1; + MAP_WORLDPARTY (this) = -1; +} + /* - * Allocates, initialises, and returns a pointer to a mapstruct. + * Allocates, initialises, and returns a pointer to a maptile. * Modified to no longer take a path option which was not being * used anyways. MSW 2001-07-01 */ - -mapstruct * +maptile * get_linked_map (void) { - mapstruct *map = new mapstruct; - mapstruct *mp; + maptile *mp, *map = new maptile; + + for (mp = first_map; mp && mp->next; mp = mp->next); - for (mp = first_map; mp != NULL && mp->next != NULL; mp = mp->next); if (mp == NULL) first_map = map; else mp->next = map; - map->in_memory = MAP_SWAPPED; - /* The maps used to pick up default x and y values from the - * map archetype. Mimic that behaviour. - */ - MAP_WIDTH (map) = 16; - MAP_HEIGHT (map) = 16; - MAP_RESET_TIMEOUT (map) = 0; - MAP_TIMEOUT (map) = 300; - MAP_ENTER_X (map) = 0; - MAP_ENTER_Y (map) = 0; - /*set part to -1 indicating conversion to weather map not yet done */ - MAP_WORLDPARTX (map) = -1; - MAP_WORLDPARTY (map) = -1; return map; } /* - * Allocates the arrays contained in a mapstruct. + * Allocates the arrays contained in a maptile. * This basically allocates the dynamic array of spaces for the * map. */ - void -allocate_map (mapstruct *m) +maptile::allocate () { - m->in_memory = MAP_IN_MEMORY; + in_memory = MAP_IN_MEMORY; + /* Log this condition and free the storage. We could I suppose * realloc, but if the caller is presuming the data will be intact, * that is their poor assumption. */ - if (m->spaces) + if (spaces) { - LOG (llevError, "allocate_map called with already allocated map (%s)\n", m->path); - free (m->spaces); + LOG (llevError, "allocate_map called with already allocated map (%s)\n", path); + free (spaces); } - m->spaces = (MapSpace *) calloc (1, MAP_WIDTH (m) * MAP_HEIGHT (m) * sizeof (MapSpace)); + spaces = (MapSpace *) + calloc (1, width * height * sizeof (MapSpace)); - if (m->spaces == NULL) + if (!spaces) fatal (OUT_OF_MEMORY); } /* Create and returns a map of the specific size. Used * in random map code and the editor. */ -mapstruct * +maptile * get_empty_map (int sizex, int sizey) { - mapstruct *m = get_linked_map (); + maptile *m = get_linked_map (); m->width = sizex; m->height = sizey; m->in_memory = MAP_SWAPPED; - allocate_map (m); + m->allocate (); + return m; } @@ -813,7 +801,7 @@ /* opposite of parse string, this puts the string that was originally fed in to * the map (or something equivilent) into output_string. */ static void -print_shop_string (mapstruct *m, char *output_string) +print_shop_string (maptile *m, char *output_string) { int i; char tmp[MAX_BUF]; @@ -857,37 +845,40 @@ */ static int -load_map_header (object_thawer & fp, mapstruct *m) +load_map_header (object_thawer & fp, maptile *m) { char buf[HUGE_BUF], msgbuf[HUGE_BUF], maplorebuf[HUGE_BUF], *key = NULL, *value, *end; int msgpos = 0; int maplorepos = 0; - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { buf[HUGE_BUF - 1] = 0; key = buf; + while (isspace (*key)) key++; + if (*key == 0) continue; /* empty line */ + value = strchr (key, ' '); + if (!value) { - end = strchr (key, '\n'); - if (end != NULL) - { - *end = 0; - } + if ((end = strchr (key, '\n'))) + *end = 0; } else { *value = 0; value++; end = strchr (value, '\n'); + while (isspace (*value)) { value++; + if (*value == '\0' || value == end) { /* Nothing but spaces. */ @@ -920,7 +911,7 @@ if (!strcmp (key, "msg")) { - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { if (!strcmp (buf, "endmsg\n")) break; @@ -941,7 +932,7 @@ } else if (!strcmp (key, "maplore")) { - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { if (!strcmp (buf, "endmaplore\n")) break; @@ -979,115 +970,65 @@ * what really should be used. */ else if (!strcmp (key, "oid")) - { - fp.get (m, atoi (value)); - } + fp.get (m, atoi (value)); else if (!strcmp (key, "attach")) - { - m->attach = value; - } + m->attach = value; else if (!strcmp (key, "hp") || !strcmp (key, "enter_x")) - { - m->enter_x = atoi (value); - } + m->enter_x = atoi (value); else if (!strcmp (key, "sp") || !strcmp (key, "enter_y")) - { - m->enter_y = atoi (value); - } + m->enter_y = atoi (value); else if (!strcmp (key, "x") || !strcmp (key, "width")) - { - m->width = atoi (value); - } + m->width = atoi (value); else if (!strcmp (key, "y") || !strcmp (key, "height")) - { - m->height = atoi (value); - } + m->height = atoi (value); else if (!strcmp (key, "weight") || !strcmp (key, "reset_timeout")) - { - m->reset_timeout = atoi (value); - } + m->reset_timeout = atoi (value); else if (!strcmp (key, "value") || !strcmp (key, "swap_time")) - { - m->timeout = atoi (value); - } + m->timeout = atoi (value); else if (!strcmp (key, "level") || !strcmp (key, "difficulty")) - { - m->difficulty = atoi (value); - } + m->difficulty = clamp (atoi (value), 1, settings.max_level); else if (!strcmp (key, "invisible") || !strcmp (key, "darkness")) - { - m->darkness = atoi (value); - } + m->darkness = atoi (value); else if (!strcmp (key, "stand_still") || !strcmp (key, "fixed_resettime")) - { - m->fixed_resettime = atoi (value); - } + m->fixed_resettime = atoi (value); else if (!strcmp (key, "unique")) - { - m->unique = atoi (value); - } + m->unique = atoi (value); else if (!strcmp (key, "template")) - { - m->templatemap = atoi (value); - } + m->templatemap = atoi (value); else if (!strcmp (key, "region")) - { - m->region = get_region_by_name (value); - } + m->region = get_region_by_name (value); else if (!strcmp (key, "shopitems")) { *end = 0; m->shopitems = parse_shop_string (value); } else if (!strcmp (key, "shopgreed")) - { - m->shopgreed = atof (value); - } + m->shopgreed = atof (value); else if (!strcmp (key, "shopmin")) - { - m->shopmin = atol (value); - } + m->shopmin = atol (value); else if (!strcmp (key, "shopmax")) - { - m->shopmax = atol (value); - } + m->shopmax = atol (value); else if (!strcmp (key, "shoprace")) { *end = 0; m->shoprace = strdup_local (value); } else if (!strcmp (key, "outdoor")) - { - m->outdoor = atoi (value); - } + m->outdoor = atoi (value); else if (!strcmp (key, "temp")) - { - m->temp = atoi (value); - } + m->temp = atoi (value); else if (!strcmp (key, "pressure")) - { - m->pressure = atoi (value); - } + m->pressure = atoi (value); else if (!strcmp (key, "humid")) - { - m->humid = atoi (value); - } + m->humid = atoi (value); else if (!strcmp (key, "windspeed")) - { - m->windspeed = atoi (value); - } + m->windspeed = atoi (value); else if (!strcmp (key, "winddir")) - { - m->winddir = atoi (value); - } + m->winddir = atoi (value); else if (!strcmp (key, "sky")) - { - m->sky = atoi (value); - } + m->sky = atoi (value); else if (!strcmp (key, "nosmooth")) - { - m->nosmooth = atoi (value); - } + m->nosmooth = atoi (value); else if (!strncmp (key, "tile_path_", 10)) { int tile = atoi (key + 10); @@ -1140,22 +1081,22 @@ } /* end if tile direction (in)valid */ } else - { - LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); - } + LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); } + if (!key || strcmp (key, "end")) { LOG (llevError, "Got premature eof on map header!\n"); return 1; } + return 0; } /* * Opens the file "filename" and reads information about the map * from the given file, and stores it in a newly allocated - * mapstruct. A pointer to this structure is returned, or NULL on failure. + * maptile. A pointer to this structure is returned, or NULL on failure. * flags correspond to those in map.h. Main ones used are * MAP_PLAYER_UNIQUE, in which case we don't do any name changes, and * MAP_BLOCK, in which case we block on this load. This happens in all @@ -1164,10 +1105,10 @@ * managed map list. */ -mapstruct * +maptile * load_original_map (const char *filename, int flags) { - mapstruct *m; + maptile *m; char pathname[MAX_BUF]; if (flags & MAP_PLAYER_UNIQUE) @@ -1194,7 +1135,7 @@ return NULL; } - allocate_map (m); + m->allocate (); m->in_memory = MAP_LOADING; load_objects (m, thawer, flags & (MAP_BLOCK | MAP_STYLE)); @@ -1213,8 +1154,8 @@ * option if we can't find the original map) */ -static mapstruct * -load_temporary_map (mapstruct *m) +static maptile * +load_temporary_map (maptile *m) { char buf[MAX_BUF]; @@ -1250,7 +1191,8 @@ m = load_original_map (m->path, 0); return NULL; } - allocate_map (m); + + m->allocate (); m->in_memory = MAP_LOADING; load_objects (m, thawer, 0); @@ -1266,8 +1208,8 @@ * option if we can't find the original map) */ -mapstruct * -load_overlay_map (const char *filename, mapstruct *m) +maptile * +load_overlay_map (const char *filename, maptile *m) { char pathname[MAX_BUF]; @@ -1285,7 +1227,7 @@ m = load_original_map (m->path, 0); return NULL; } - /*allocate_map(m); */ + /*m->allocate ();*/ m->in_memory = MAP_LOADING; load_objects (m, thawer, MAP_OVERLAY); @@ -1300,7 +1242,7 @@ /* This goes through map 'm' and removed any unique items on the map. */ static void -delete_unique_items (mapstruct *m) +delete_unique_items (maptile *m) { int i, j, unique; object *op, *next; @@ -1309,18 +1251,22 @@ for (j = 0; j < MAP_HEIGHT (m); j++) { unique = 0; + for (op = get_map_ob (m, i, j); op; op = next) { next = op->above; + if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) unique = 1; + if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) { clean_object (op); + if (QUERY_FLAG (op, FLAG_IS_LINKED)) remove_button_link (op); - remove_ob (op); - free_object (op); + + op->destroy (); } } } @@ -1332,7 +1278,7 @@ * m is the map to load unique items into. */ static void -load_unique_objects (mapstruct *m) +load_unique_objects (maptile *m) { int count; char firstname[MAX_BUF]; @@ -1365,13 +1311,13 @@ * Saves a map to file. If flag is set, it is saved into the same * file it was (originally) loaded from. Otherwise a temporary * filename will be genarated, and the file will be stored there. - * The temporary filename will be stored in the mapstructure. + * The temporary filename will be stored in the maptileure. * If the map is unique, we also save to the filename in the map * (this should have been updated when first loaded) */ int -new_save_map (mapstruct *m, int flag) +new_save_map (maptile *m, int flag) { char filename[MAX_BUF], buf[MAX_BUF], shop[MAX_BUF]; int i; @@ -1433,17 +1379,10 @@ } if (m->shopgreed) fprintf (freezer, "shopgreed %f\n", m->shopgreed); -#ifndef WIN32 if (m->shopmin) fprintf (freezer, "shopmin %llu\n", m->shopmin); if (m->shopmax) fprintf (freezer, "shopmax %llu\n", m->shopmax); -#else - if (m->shopmin) - fprintf (freezer, "shopmin %I64u\n", m->shopmin); - if (m->shopmax) - fprintf (freezer, "shopmax %I64u\n", m->shopmax); -#endif if (m->shoprace) fprintf (freezer, "shoprace %s\n", m->shoprace); if (m->darkness) @@ -1532,11 +1471,12 @@ for (tmp = op->inv; tmp; tmp = next) { next = tmp->below; + clean_object (tmp); if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) remove_button_link (tmp); - remove_ob (tmp); - free_object (tmp); + + tmp->destroy (); } } @@ -1545,7 +1485,7 @@ */ void -free_all_objects (mapstruct *m) +free_all_objects (maptile *m) { int i, j; object *op; @@ -1562,7 +1502,9 @@ LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); break; } + previous_obj = op; + if (op->head != NULL) op = op->head; @@ -1571,19 +1513,19 @@ */ if (m->in_memory == MAP_IN_MEMORY) clean_object (op); - remove_ob (op); - free_object (op); + + op->destroy (); } } } /* - * Frees everything allocated by the given mapstructure. + * Frees everything allocated by the given maptileure. * don't free tmpname - our caller is left to do that */ void -free_map (mapstruct *m, int flag) +free_map (maptile *m, int flag) { int i; @@ -1592,6 +1534,10 @@ LOG (llevError, "Trying to free freed map.\n"); return; } + + // TODO: use new/delete +#define FREE_AND_CLEAR(p) { free (p); p = NULL; } + if (flag && m->spaces) free_all_objects (m); if (m->name) @@ -1602,34 +1548,42 @@ FREE_AND_CLEAR (m->msg); if (m->maplore) FREE_AND_CLEAR (m->maplore); - if (m->shopitems) - delete[]m->shopitems; + + delete [] m->shopitems; m->shopitems = 0; + if (m->shoprace) FREE_AND_CLEAR (m->shoprace); + if (m->buttons) free_objectlinkpt (m->buttons); + m->buttons = NULL; + for (i = 0; i < 4; i++) { if (m->tile_path[i]) FREE_AND_CLEAR (m->tile_path[i]); m->tile_map[i] = NULL; } + m->in_memory = MAP_SWAPPED; + +#undef FREE_AND_CLEAR + } /* - * function: vanish mapstruct - * m : pointer to mapstruct, if NULL no action + * function: vanish maptile + * m : pointer to maptile, if NULL no action * this deletes all the data on the map (freeing pointers) * and then removes this map from the global linked list of maps. */ void -delete_map (mapstruct *m) +delete_map (maptile *m) { - mapstruct *tmp, *last; + maptile *tmp, *last; int i; if (!m) @@ -1701,10 +1655,10 @@ * Returns a pointer to the given map. */ -mapstruct * +maptile * ready_map_name (const char *name, int flags) { - mapstruct *m; + maptile *m; if (!name) return (NULL); @@ -1816,7 +1770,7 @@ */ int -calculate_difficulty (mapstruct *m) +calculate_difficulty (maptile *m) { object *op; archetype *at; @@ -1868,7 +1822,7 @@ } void -clean_tmp_map (mapstruct *m) +clean_tmp_map (maptile *m) { if (m->tmpname == NULL) return; @@ -1903,7 +1857,7 @@ */ int -change_map_light (mapstruct *m, int change) +change_map_light (maptile *m, int change) { int new_level = m->darkness + change; @@ -1944,7 +1898,7 @@ * through, etc) */ void -update_position (mapstruct *m, int x, int y) +update_position (maptile *m, int x, int y) { object *tmp, *last = NULL; uint8 flags = 0, oldflags, light = 0, anywhere = 0; @@ -2147,7 +2101,7 @@ void -set_map_reset_time (mapstruct *map) +set_map_reset_time (maptile *map) { int timeout; @@ -2156,7 +2110,7 @@ timeout = MAP_DEFAULTRESET; if (timeout >= MAP_MAXRESET) timeout = MAP_MAXRESET; - MAP_WHEN_RESET (map) = seconds () + timeout; + MAP_WHEN_RESET (map) = time (0) + timeout; } /* this updates the orig_map->tile_map[tile_num] value after loading @@ -2166,8 +2120,8 @@ * so that it is easier for calling functions to verify success. */ -static mapstruct * -load_and_link_tiled_map (mapstruct *orig_map, int tile_num) +static maptile * +load_and_link_tiled_map (maptile *orig_map, int tile_num) { int dest_tile = (tile_num + 2) % 4; char *path = path_combine_and_normalize (orig_map->path, orig_map->tile_path[tile_num]); @@ -2192,7 +2146,7 @@ * */ int -out_of_map (mapstruct *m, int x, int y) +out_of_map (maptile *m, int x, int y) { /* If we get passed a null map, this is obviously the @@ -2257,8 +2211,8 @@ * Using this is more efficient of calling out_of_map * and then figuring out what the real map is */ -mapstruct * -get_map_from_coord (mapstruct *m, sint16 * x, sint16 * y) +maptile * +get_map_from_coord (maptile *m, sint16 * x, sint16 * y) { if (*x < 0) @@ -2314,7 +2268,7 @@ * map1 to map2 in dx/dy. */ static int -adjacent_map (const mapstruct *map1, const mapstruct *map2, int *dx, int *dy) +adjacent_map (const maptile *map1, const maptile *map2, int *dx, int *dy) { if (!map1 || !map2) return 0; @@ -2482,7 +2436,7 @@ */ void -get_rangevector_from_mapcoord (const mapstruct *m, int x, int y, const object *op2, rv_vector * retval, int flags) +get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector * retval, int flags) { if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) {