… | |
… | |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <funcpoint.h> |
26 | #include <funcpoint.h> |
27 | |
27 | |
28 | #include <loader.h> |
28 | #include <loader.h> |
29 | #ifndef WIN32 /* ---win32 exclude header */ |
|
|
30 | # include <unistd.h> |
29 | #include <unistd.h> |
31 | #endif /* win32 */ |
|
|
32 | |
30 | |
33 | #include "path.h" |
31 | #include "path.h" |
34 | |
32 | |
35 | |
|
|
36 | extern int nrofallocobjects, nroffreeobjects; |
|
|
37 | |
33 | |
38 | /* |
34 | /* |
39 | * Returns the maptile which has a name matching the given argument. |
35 | * Returns the maptile which has a name matching the given argument. |
40 | * return NULL if no match is found. |
36 | * return NULL if no match is found. |
41 | */ |
37 | */ |
… | |
… | |
159 | int |
155 | int |
160 | check_path (const char *name, int prepend_dir) |
156 | check_path (const char *name, int prepend_dir) |
161 | { |
157 | { |
162 | char buf[MAX_BUF]; |
158 | char buf[MAX_BUF]; |
163 | |
159 | |
164 | #ifndef WIN32 |
|
|
165 | char *endbuf; |
160 | char *endbuf; |
166 | struct stat statbuf; |
161 | struct stat statbuf; |
167 | int mode = 0; |
162 | int mode = 0; |
168 | #endif |
|
|
169 | |
163 | |
170 | if (prepend_dir) |
164 | if (prepend_dir) |
171 | strcpy (buf, create_pathname (name)); |
165 | strcpy (buf, create_pathname (name)); |
172 | else |
166 | else |
173 | strcpy (buf, name); |
167 | strcpy (buf, name); |
174 | #ifdef WIN32 /* ***win32: check this sucker in windows style. */ |
|
|
175 | return (_access (buf, 0)); |
|
|
176 | #else |
|
|
177 | |
168 | |
178 | /* old method (strchr(buf, '\0')) seemd very odd to me - |
169 | /* old method (strchr(buf, '\0')) seemd very odd to me - |
179 | * this method should be equivalant and is clearer. |
170 | * this method should be equivalant and is clearer. |
180 | * Can not use strcat because we need to cycle through |
171 | * Can not use strcat because we need to cycle through |
181 | * all the names. |
172 | * all the names. |
… | |
… | |
194 | if ((statbuf.st_mode & S_IWGRP && getegid () == statbuf.st_gid) || |
185 | if ((statbuf.st_mode & S_IWGRP && getegid () == statbuf.st_gid) || |
195 | (statbuf.st_mode & S_IWUSR && geteuid () == statbuf.st_uid) || (statbuf.st_mode & S_IWOTH)) |
186 | (statbuf.st_mode & S_IWUSR && geteuid () == statbuf.st_uid) || (statbuf.st_mode & S_IWOTH)) |
196 | mode |= 2; |
187 | mode |= 2; |
197 | |
188 | |
198 | return (mode); |
189 | return (mode); |
199 | #endif |
|
|
200 | } |
190 | } |
201 | |
191 | |
202 | /* |
192 | /* |
203 | * Prints out debug-information about a map. |
193 | * Prints out debug-information about a map. |
204 | * Dumping these at llevError doesn't seem right, but is |
194 | * Dumping these at llevError doesn't seem right, but is |
… | |
… | |
275 | retval |= mp->spaces[newx + mp->width * newy].flags; |
265 | retval |= mp->spaces[newx + mp->width * newy].flags; |
276 | |
266 | |
277 | return retval; |
267 | return retval; |
278 | } |
268 | } |
279 | |
269 | |
280 | |
|
|
281 | /* |
270 | /* |
282 | * Returns true if the given coordinate is blocked except by the |
271 | * Returns true if the given coordinate is blocked except by the |
283 | * object passed is not blocking. This is used with |
272 | * object passed is not blocking. This is used with |
284 | * multipart monsters - if we want to see if a 2x2 monster |
273 | * multipart monsters - if we want to see if a 2x2 monster |
285 | * can move 1 space to the left, we don't want its own area |
274 | * can move 1 space to the left, we don't want its own area |
… | |
… | |
288 | * monster. |
277 | * monster. |
289 | * m, x, y are the target map/coordinates - needed for map tiling. |
278 | * m, x, y are the target map/coordinates - needed for map tiling. |
290 | * the coordinates & map passed in should have been updated for tiling |
279 | * the coordinates & map passed in should have been updated for tiling |
291 | * by the caller. |
280 | * by the caller. |
292 | */ |
281 | */ |
293 | |
|
|
294 | int |
282 | int |
295 | blocked_link (object *ob, maptile *m, int sx, int sy) |
283 | blocked_link (object *ob, maptile *m, int sx, int sy) |
296 | { |
284 | { |
297 | object *tmp; |
285 | object *tmp; |
298 | int mflags, blocked; |
286 | int mflags, blocked; |
… | |
… | |
544 | { |
532 | { |
545 | int i, j; |
533 | int i, j; |
546 | int unique; |
534 | int unique; |
547 | object *op, *prev = NULL, *last_more = NULL, *otmp; |
535 | object *op, *prev = NULL, *last_more = NULL, *otmp; |
548 | |
536 | |
549 | op = get_object (); |
537 | op = object::create (); |
550 | op->map = m; /* To handle buttons correctly */ |
538 | op->map = m; /* To handle buttons correctly */ |
551 | |
539 | |
552 | while ((i = load_object (fp, op, mapflags))) |
540 | while ((i = load_object (fp, op, mapflags))) |
553 | { |
541 | { |
554 | /* if the archetype for the object is null, means that we |
542 | /* if the archetype for the object is null, means that we |
… | |
… | |
584 | } |
572 | } |
585 | |
573 | |
586 | if (mapflags & MAP_STYLE) |
574 | if (mapflags & MAP_STYLE) |
587 | remove_from_active_list (op); |
575 | remove_from_active_list (op); |
588 | |
576 | |
589 | op = get_object (); |
577 | op = object::create (); |
590 | op->map = m; |
578 | op->map = m; |
591 | } |
579 | } |
592 | |
580 | |
593 | for (i = 0; i < m->width; i++) |
581 | for (i = 0; i < m->width; i++) |
594 | { |
582 | { |
… | |
… | |
604 | SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); |
592 | SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); |
605 | } |
593 | } |
606 | } |
594 | } |
607 | } |
595 | } |
608 | |
596 | |
609 | free_object (op); |
597 | op->destroy (); |
610 | link_multipart_objects (m); |
598 | link_multipart_objects (m); |
611 | } |
599 | } |
612 | |
600 | |
613 | /* This saves all the objects on the map in a non destructive fashion. |
601 | /* This saves all the objects on the map in a non destructive fashion. |
614 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
602 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
… | |
… | |
647 | |
635 | |
648 | } /* for this space */ |
636 | } /* for this space */ |
649 | } /* for this j */ |
637 | } /* for this j */ |
650 | } |
638 | } |
651 | |
639 | |
|
|
640 | maptile::maptile () |
|
|
641 | { |
|
|
642 | in_memory = MAP_SWAPPED; |
|
|
643 | /* The maps used to pick up default x and y values from the |
|
|
644 | * map archetype. Mimic that behaviour. |
|
|
645 | */ |
|
|
646 | MAP_WIDTH (this) = 16; |
|
|
647 | MAP_HEIGHT (this) = 16; |
|
|
648 | MAP_RESET_TIMEOUT (this) = 0; |
|
|
649 | MAP_TIMEOUT (this) = 300; |
|
|
650 | MAP_ENTER_X (this) = 0; |
|
|
651 | MAP_ENTER_Y (this) = 0; |
|
|
652 | /*set part to -1 indicating conversion to weather map not yet done */ |
|
|
653 | MAP_WORLDPARTX (this) = -1; |
|
|
654 | MAP_WORLDPARTY (this) = -1; |
|
|
655 | } |
|
|
656 | |
652 | /* |
657 | /* |
653 | * Allocates, initialises, and returns a pointer to a maptile. |
658 | * Allocates, initialises, and returns a pointer to a maptile. |
654 | * Modified to no longer take a path option which was not being |
659 | * Modified to no longer take a path option which was not being |
655 | * used anyways. MSW 2001-07-01 |
660 | * used anyways. MSW 2001-07-01 |
656 | */ |
661 | */ |
657 | |
|
|
658 | maptile * |
662 | maptile * |
659 | get_linked_map (void) |
663 | get_linked_map (void) |
660 | { |
664 | { |
661 | maptile *map = new maptile; |
665 | maptile *mp, *map = new maptile; |
662 | maptile *mp; |
|
|
663 | |
666 | |
664 | for (mp = first_map; mp != NULL && mp->next != NULL; mp = mp->next); |
667 | for (mp = first_map; mp && mp->next; mp = mp->next); |
|
|
668 | |
665 | if (mp == NULL) |
669 | if (mp == NULL) |
666 | first_map = map; |
670 | first_map = map; |
667 | else |
671 | else |
668 | mp->next = map; |
672 | mp->next = map; |
669 | |
673 | |
670 | map->in_memory = MAP_SWAPPED; |
|
|
671 | /* The maps used to pick up default x and y values from the |
|
|
672 | * map archetype. Mimic that behaviour. |
|
|
673 | */ |
|
|
674 | MAP_WIDTH (map) = 16; |
|
|
675 | MAP_HEIGHT (map) = 16; |
|
|
676 | MAP_RESET_TIMEOUT (map) = 0; |
|
|
677 | MAP_TIMEOUT (map) = 300; |
|
|
678 | MAP_ENTER_X (map) = 0; |
|
|
679 | MAP_ENTER_Y (map) = 0; |
|
|
680 | /*set part to -1 indicating conversion to weather map not yet done */ |
|
|
681 | MAP_WORLDPARTX (map) = -1; |
|
|
682 | MAP_WORLDPARTY (map) = -1; |
|
|
683 | return map; |
674 | return map; |
684 | } |
675 | } |
685 | |
676 | |
686 | /* |
677 | /* |
687 | * Allocates the arrays contained in a maptile. |
678 | * Allocates the arrays contained in a maptile. |
688 | * This basically allocates the dynamic array of spaces for the |
679 | * This basically allocates the dynamic array of spaces for the |
689 | * map. |
680 | * map. |
690 | */ |
681 | */ |
691 | |
|
|
692 | void |
682 | void |
693 | allocate_map (maptile *m) |
683 | maptile::allocate () |
694 | { |
684 | { |
695 | m->in_memory = MAP_IN_MEMORY; |
685 | in_memory = MAP_IN_MEMORY; |
|
|
686 | |
696 | /* Log this condition and free the storage. We could I suppose |
687 | /* Log this condition and free the storage. We could I suppose |
697 | * realloc, but if the caller is presuming the data will be intact, |
688 | * realloc, but if the caller is presuming the data will be intact, |
698 | * that is their poor assumption. |
689 | * that is their poor assumption. |
699 | */ |
690 | */ |
700 | if (m->spaces) |
691 | if (spaces) |
701 | { |
692 | { |
702 | LOG (llevError, "allocate_map called with already allocated map (%s)\n", m->path); |
693 | LOG (llevError, "allocate_map called with already allocated map (%s)\n", path); |
703 | free (m->spaces); |
694 | free (spaces); |
704 | } |
695 | } |
705 | |
696 | |
706 | m->spaces = (MapSpace *) calloc (1, MAP_WIDTH (m) * MAP_HEIGHT (m) * sizeof (MapSpace)); |
697 | spaces = (MapSpace *) |
|
|
698 | calloc (1, width * height * sizeof (MapSpace)); |
707 | |
699 | |
708 | if (m->spaces == NULL) |
700 | if (!spaces) |
709 | fatal (OUT_OF_MEMORY); |
701 | fatal (OUT_OF_MEMORY); |
710 | } |
702 | } |
711 | |
703 | |
712 | /* Create and returns a map of the specific size. Used |
704 | /* Create and returns a map of the specific size. Used |
713 | * in random map code and the editor. |
705 | * in random map code and the editor. |
… | |
… | |
718 | maptile *m = get_linked_map (); |
710 | maptile *m = get_linked_map (); |
719 | |
711 | |
720 | m->width = sizex; |
712 | m->width = sizex; |
721 | m->height = sizey; |
713 | m->height = sizey; |
722 | m->in_memory = MAP_SWAPPED; |
714 | m->in_memory = MAP_SWAPPED; |
723 | allocate_map (m); |
715 | m->allocate (); |
|
|
716 | |
724 | return m; |
717 | return m; |
725 | } |
718 | } |
726 | |
719 | |
727 | /* Takes a string from a map definition and outputs a pointer to the array of shopitems |
720 | /* Takes a string from a map definition and outputs a pointer to the array of shopitems |
728 | * corresponding to that string. Memory is allocated for this, it must be freed |
721 | * corresponding to that string. Memory is allocated for this, it must be freed |
… | |
… | |
855 | { |
848 | { |
856 | char buf[HUGE_BUF], msgbuf[HUGE_BUF], maplorebuf[HUGE_BUF], *key = NULL, *value, *end; |
849 | char buf[HUGE_BUF], msgbuf[HUGE_BUF], maplorebuf[HUGE_BUF], *key = NULL, *value, *end; |
857 | int msgpos = 0; |
850 | int msgpos = 0; |
858 | int maplorepos = 0; |
851 | int maplorepos = 0; |
859 | |
852 | |
860 | while (fgets (buf, HUGE_BUF - 1, fp) != NULL) |
853 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
861 | { |
854 | { |
862 | buf[HUGE_BUF - 1] = 0; |
855 | buf[HUGE_BUF - 1] = 0; |
863 | key = buf; |
856 | key = buf; |
|
|
857 | |
864 | while (isspace (*key)) |
858 | while (isspace (*key)) |
865 | key++; |
859 | key++; |
|
|
860 | |
866 | if (*key == 0) |
861 | if (*key == 0) |
867 | continue; /* empty line */ |
862 | continue; /* empty line */ |
|
|
863 | |
868 | value = strchr (key, ' '); |
864 | value = strchr (key, ' '); |
|
|
865 | |
869 | if (!value) |
866 | if (!value) |
870 | { |
867 | { |
871 | end = strchr (key, '\n'); |
868 | if ((end = strchr (key, '\n'))) |
872 | if (end != NULL) |
|
|
873 | { |
|
|
874 | *end = 0; |
869 | *end = 0; |
875 | } |
|
|
876 | } |
870 | } |
877 | else |
871 | else |
878 | { |
872 | { |
879 | *value = 0; |
873 | *value = 0; |
880 | value++; |
874 | value++; |
881 | end = strchr (value, '\n'); |
875 | end = strchr (value, '\n'); |
|
|
876 | |
882 | while (isspace (*value)) |
877 | while (isspace (*value)) |
883 | { |
878 | { |
884 | value++; |
879 | value++; |
|
|
880 | |
885 | if (*value == '\0' || value == end) |
881 | if (*value == '\0' || value == end) |
886 | { |
882 | { |
887 | /* Nothing but spaces. */ |
883 | /* Nothing but spaces. */ |
888 | value = NULL; |
884 | value = NULL; |
889 | break; |
885 | break; |
… | |
… | |
912 | * that use the parameter. |
908 | * that use the parameter. |
913 | */ |
909 | */ |
914 | |
910 | |
915 | if (!strcmp (key, "msg")) |
911 | if (!strcmp (key, "msg")) |
916 | { |
912 | { |
917 | while (fgets (buf, HUGE_BUF - 1, fp) != NULL) |
913 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
918 | { |
914 | { |
919 | if (!strcmp (buf, "endmsg\n")) |
915 | if (!strcmp (buf, "endmsg\n")) |
920 | break; |
916 | break; |
921 | else |
917 | else |
922 | { |
918 | { |
… | |
… | |
933 | if (msgpos != 0) |
929 | if (msgpos != 0) |
934 | m->msg = strdup_local (msgbuf); |
930 | m->msg = strdup_local (msgbuf); |
935 | } |
931 | } |
936 | else if (!strcmp (key, "maplore")) |
932 | else if (!strcmp (key, "maplore")) |
937 | { |
933 | { |
938 | while (fgets (buf, HUGE_BUF - 1, fp) != NULL) |
934 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
939 | { |
935 | { |
940 | if (!strcmp (buf, "endmaplore\n")) |
936 | if (!strcmp (buf, "endmaplore\n")) |
941 | break; |
937 | break; |
942 | else |
938 | else |
943 | { |
939 | { |
… | |
… | |
1186 | LOG (llevError, "Error loading map header for %s, flags=%d\n", filename, flags); |
1182 | LOG (llevError, "Error loading map header for %s, flags=%d\n", filename, flags); |
1187 | delete_map (m); |
1183 | delete_map (m); |
1188 | return NULL; |
1184 | return NULL; |
1189 | } |
1185 | } |
1190 | |
1186 | |
1191 | allocate_map (m); |
1187 | m->allocate (); |
1192 | |
1188 | |
1193 | m->in_memory = MAP_LOADING; |
1189 | m->in_memory = MAP_LOADING; |
1194 | load_objects (m, thawer, flags & (MAP_BLOCK | MAP_STYLE)); |
1190 | load_objects (m, thawer, flags & (MAP_BLOCK | MAP_STYLE)); |
1195 | |
1191 | |
1196 | m->in_memory = MAP_IN_MEMORY; |
1192 | m->in_memory = MAP_IN_MEMORY; |
… | |
… | |
1242 | LOG (llevError, "Error loading map header for %s (%s)\n", m->path, m->tmpname); |
1238 | LOG (llevError, "Error loading map header for %s (%s)\n", m->path, m->tmpname); |
1243 | delete_map (m); |
1239 | delete_map (m); |
1244 | m = load_original_map (m->path, 0); |
1240 | m = load_original_map (m->path, 0); |
1245 | return NULL; |
1241 | return NULL; |
1246 | } |
1242 | } |
|
|
1243 | |
1247 | allocate_map (m); |
1244 | m->allocate (); |
1248 | |
1245 | |
1249 | m->in_memory = MAP_LOADING; |
1246 | m->in_memory = MAP_LOADING; |
1250 | load_objects (m, thawer, 0); |
1247 | load_objects (m, thawer, 0); |
1251 | |
1248 | |
1252 | m->in_memory = MAP_IN_MEMORY; |
1249 | m->in_memory = MAP_IN_MEMORY; |
… | |
… | |
1277 | LOG (llevError, "Error loading map header for overlay %s (%s)\n", m->path, pathname); |
1274 | LOG (llevError, "Error loading map header for overlay %s (%s)\n", m->path, pathname); |
1278 | delete_map (m); |
1275 | delete_map (m); |
1279 | m = load_original_map (m->path, 0); |
1276 | m = load_original_map (m->path, 0); |
1280 | return NULL; |
1277 | return NULL; |
1281 | } |
1278 | } |
1282 | /*allocate_map(m); */ |
1279 | /*m->allocate ();*/ |
1283 | |
1280 | |
1284 | m->in_memory = MAP_LOADING; |
1281 | m->in_memory = MAP_LOADING; |
1285 | load_objects (m, thawer, MAP_OVERLAY); |
1282 | load_objects (m, thawer, MAP_OVERLAY); |
1286 | |
1283 | |
1287 | m->in_memory = MAP_IN_MEMORY; |
1284 | m->in_memory = MAP_IN_MEMORY; |
… | |
… | |
1301 | |
1298 | |
1302 | for (i = 0; i < MAP_WIDTH (m); i++) |
1299 | for (i = 0; i < MAP_WIDTH (m); i++) |
1303 | for (j = 0; j < MAP_HEIGHT (m); j++) |
1300 | for (j = 0; j < MAP_HEIGHT (m); j++) |
1304 | { |
1301 | { |
1305 | unique = 0; |
1302 | unique = 0; |
|
|
1303 | |
1306 | for (op = get_map_ob (m, i, j); op; op = next) |
1304 | for (op = get_map_ob (m, i, j); op; op = next) |
1307 | { |
1305 | { |
1308 | next = op->above; |
1306 | next = op->above; |
|
|
1307 | |
1309 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
1308 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
1310 | unique = 1; |
1309 | unique = 1; |
|
|
1310 | |
1311 | if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
1311 | if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
1312 | { |
1312 | { |
1313 | clean_object (op); |
1313 | clean_object (op); |
|
|
1314 | |
1314 | if (QUERY_FLAG (op, FLAG_IS_LINKED)) |
1315 | if (QUERY_FLAG (op, FLAG_IS_LINKED)) |
1315 | remove_button_link (op); |
1316 | remove_button_link (op); |
1316 | remove_ob (op); |
1317 | |
1317 | free_object (op); |
1318 | op->destroy (); |
1318 | } |
1319 | } |
1319 | } |
1320 | } |
1320 | } |
1321 | } |
1321 | } |
1322 | } |
1322 | |
1323 | |
… | |
… | |
1425 | print_shop_string (m, shop); |
1426 | print_shop_string (m, shop); |
1426 | fprintf (freezer, "shopitems %s\n", shop); |
1427 | fprintf (freezer, "shopitems %s\n", shop); |
1427 | } |
1428 | } |
1428 | if (m->shopgreed) |
1429 | if (m->shopgreed) |
1429 | fprintf (freezer, "shopgreed %f\n", m->shopgreed); |
1430 | fprintf (freezer, "shopgreed %f\n", m->shopgreed); |
1430 | #ifndef WIN32 |
|
|
1431 | if (m->shopmin) |
1431 | if (m->shopmin) |
1432 | fprintf (freezer, "shopmin %llu\n", m->shopmin); |
1432 | fprintf (freezer, "shopmin %llu\n", m->shopmin); |
1433 | if (m->shopmax) |
1433 | if (m->shopmax) |
1434 | fprintf (freezer, "shopmax %llu\n", m->shopmax); |
1434 | fprintf (freezer, "shopmax %llu\n", m->shopmax); |
1435 | #else |
|
|
1436 | if (m->shopmin) |
|
|
1437 | fprintf (freezer, "shopmin %I64u\n", m->shopmin); |
|
|
1438 | if (m->shopmax) |
|
|
1439 | fprintf (freezer, "shopmax %I64u\n", m->shopmax); |
|
|
1440 | #endif |
|
|
1441 | if (m->shoprace) |
1435 | if (m->shoprace) |
1442 | fprintf (freezer, "shoprace %s\n", m->shoprace); |
1436 | fprintf (freezer, "shoprace %s\n", m->shoprace); |
1443 | if (m->darkness) |
1437 | if (m->darkness) |
1444 | fprintf (freezer, "darkness %d\n", m->darkness); |
1438 | fprintf (freezer, "darkness %d\n", m->darkness); |
1445 | if (m->width) |
1439 | if (m->width) |
… | |
… | |
1524 | object *tmp, *next; |
1518 | object *tmp, *next; |
1525 | |
1519 | |
1526 | for (tmp = op->inv; tmp; tmp = next) |
1520 | for (tmp = op->inv; tmp; tmp = next) |
1527 | { |
1521 | { |
1528 | next = tmp->below; |
1522 | next = tmp->below; |
|
|
1523 | |
1529 | clean_object (tmp); |
1524 | clean_object (tmp); |
1530 | if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) |
1525 | if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) |
1531 | remove_button_link (tmp); |
1526 | remove_button_link (tmp); |
1532 | remove_ob (tmp); |
1527 | |
1533 | free_object (tmp); |
1528 | tmp->destroy (); |
1534 | } |
1529 | } |
1535 | } |
1530 | } |
1536 | |
1531 | |
1537 | /* |
1532 | /* |
1538 | * Remove and free all objects in the given map. |
1533 | * Remove and free all objects in the given map. |
… | |
… | |
1554 | if (op == previous_obj) |
1549 | if (op == previous_obj) |
1555 | { |
1550 | { |
1556 | LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); |
1551 | LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); |
1557 | break; |
1552 | break; |
1558 | } |
1553 | } |
|
|
1554 | |
1559 | previous_obj = op; |
1555 | previous_obj = op; |
|
|
1556 | |
1560 | if (op->head != NULL) |
1557 | if (op->head != NULL) |
1561 | op = op->head; |
1558 | op = op->head; |
1562 | |
1559 | |
1563 | /* If the map isn't in memory, free_object will remove and |
1560 | /* If the map isn't in memory, free_object will remove and |
1564 | * free objects in op's inventory. So let it do the job. |
1561 | * free objects in op's inventory. So let it do the job. |
1565 | */ |
1562 | */ |
1566 | if (m->in_memory == MAP_IN_MEMORY) |
1563 | if (m->in_memory == MAP_IN_MEMORY) |
1567 | clean_object (op); |
1564 | clean_object (op); |
1568 | remove_ob (op); |
1565 | |
1569 | free_object (op); |
1566 | op->destroy (); |
1570 | } |
1567 | } |
1571 | } |
1568 | } |
1572 | } |
1569 | } |
1573 | |
1570 | |
1574 | /* |
1571 | /* |