Fixed object loading issue for houses.

This commit is contained in:
Vatiken 2012-08-11 03:03:58 +00:00
parent e37c9708dd
commit 60a2f0ff7b

View file

@ -1005,7 +1005,8 @@ obj_save_data *objsave_parse_objects(FILE *fl)
while (tempsave) { while (tempsave) {
if (tempsave->next == current) if (tempsave->next == current)
tempsave->next = NULL; tempsave->next = NULL;
tempsave = tempsave->next; } tempsave = tempsave->next;
}
free(current); free(current);
} }
} }
@ -1025,10 +1026,15 @@ obj_save_data *objsave_parse_objects(FILE *fl)
if (*line == '#') { if (*line == '#') {
/* check for false alarm. */ /* check for false alarm. */
if (sscanf(line, "#%d", &nr) == 1) { if (sscanf(line, "#%d", &nr) == 1) {
if (real_object(nr) == NOTHING) { //object does not exist /* I'm currently unaware as to why the following IF skips on the
* loop when an object is returned NOTHING due to the fact that "NOTHING"
* is handled in below in such an instance. Unless someone knows why
* this was written as such, it's now obsolete.
* -Vatiken
if (real_object(nr) == NOTHING) {
log("SYSERR: Protection: deleting object %d.", nr); log("SYSERR: Protection: deleting object %d.", nr);
continue; continue;
} } */
if (temp) { if (temp) {
current->obj = temp; current->obj = temp;
CREATE(current->next, obj_save_data, 1); CREATE(current->next, obj_save_data, 1);
@ -1037,9 +1043,9 @@ obj_save_data *objsave_parse_objects(FILE *fl)
current->locate = 0; current->locate = 0;
temp = NULL; temp = NULL;
} }
} } else
else
continue; continue;
/* we have the number, check it, load obj. */ /* we have the number, check it, load obj. */
if (nr == NOTHING) { /* then it is unique */ if (nr == NOTHING) { /* then it is unique */
temp = create_obj(); temp = create_obj();
@ -1058,6 +1064,13 @@ obj_save_data *objsave_parse_objects(FILE *fl)
continue; continue;
} }
/* Should never get here, but since we did in the past, I'll put
* a safety check in. */
if (temp == NULL) {
log("SYSERR: Attempting to parse obj_save_data on NULL object.");
abort();
}
tag_argument(line, tag); tag_argument(line, tag);
num = atoi(line); num = atoi(line);