--- deliantra/server/common/map.C 2006/09/14 22:33:59 1.30 +++ deliantra/server/common/map.C 2006/09/16 22:24:12 1.31 @@ -36,14 +36,14 @@ 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; @@ -206,7 +206,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)); @@ -233,7 +233,7 @@ void dump_all_maps (void) { - mapstruct *m; + maptile *m; for (m = first_map; m != NULL; m = m->next) { @@ -252,11 +252,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; @@ -292,7 +292,7 @@ */ 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; @@ -414,11 +414,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) @@ -493,7 +493,7 @@ */ static void -link_multipart_objects (mapstruct *m) +link_multipart_objects (maptile *m) { int x, y; object *tmp, *op, *last, *above; @@ -540,7 +540,7 @@ * 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; @@ -616,7 +616,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; @@ -650,16 +650,16 @@ } /* - * 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 *map = new maptile; + maptile *mp; for (mp = first_map; mp != NULL && mp->next != NULL; mp = mp->next); if (mp == NULL) @@ -684,13 +684,13 @@ } /* - * 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) +allocate_map (maptile *m) { m->in_memory = MAP_IN_MEMORY; /* Log this condition and free the storage. We could I suppose @@ -712,10 +712,10 @@ /* 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; @@ -807,7 +807,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]; @@ -851,7 +851,7 @@ */ 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; @@ -1149,7 +1149,7 @@ /* * 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 @@ -1158,10 +1158,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) @@ -1207,8 +1207,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]; @@ -1260,8 +1260,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]; @@ -1294,7 +1294,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; @@ -1326,7 +1326,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]; @@ -1359,13 +1359,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; @@ -1539,7 +1539,7 @@ */ void -free_all_objects (mapstruct *m) +free_all_objects (maptile *m) { int i, j; object *op; @@ -1572,12 +1572,12 @@ } /* - * 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; @@ -1614,16 +1614,16 @@ } /* - * 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) @@ -1695,10 +1695,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); @@ -1810,7 +1810,7 @@ */ int -calculate_difficulty (mapstruct *m) +calculate_difficulty (maptile *m) { object *op; archetype *at; @@ -1862,7 +1862,7 @@ } void -clean_tmp_map (mapstruct *m) +clean_tmp_map (maptile *m) { if (m->tmpname == NULL) return; @@ -1897,7 +1897,7 @@ */ int -change_map_light (mapstruct *m, int change) +change_map_light (maptile *m, int change) { int new_level = m->darkness + change; @@ -1938,7 +1938,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; @@ -2141,7 +2141,7 @@ void -set_map_reset_time (mapstruct *map) +set_map_reset_time (maptile *map) { int timeout; @@ -2160,8 +2160,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]); @@ -2186,7 +2186,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 @@ -2251,8 +2251,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) @@ -2308,7 +2308,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; @@ -2476,7 +2476,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)) {