mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-20 17:20:12 +01:00
Fixed object loading issue for houses.
This commit is contained in:
parent
e37c9708dd
commit
60a2f0ff7b
1 changed files with 29 additions and 16 deletions
|
|
@ -995,17 +995,18 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
|
|
||||||
/* if the file is done, wrap it all up */
|
/* if the file is done, wrap it all up */
|
||||||
if(get_line(fl, line) == FALSE || (*line == '$' && line[1] == '~')) {
|
if(get_line(fl, line) == FALSE || (*line == '$' && line[1] == '~')) {
|
||||||
if (temp == NULL && current->obj == NULL) {
|
if (temp == NULL && current->obj == NULL) {
|
||||||
/* Remove current from list. */
|
/* Remove current from list. */
|
||||||
tempsave = head;
|
tempsave = head;
|
||||||
if (tempsave == current) {
|
if (tempsave == current) {
|
||||||
free(current);
|
free(current);
|
||||||
head = NULL;
|
head = NULL;
|
||||||
} else {
|
} else {
|
||||||
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,21 +1026,26 @@ 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
|
||||||
log("SYSERR: Protection: deleting object %d.", nr);
|
* 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);
|
||||||
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);
|
||||||
current=current->next;
|
current=current->next;
|
||||||
|
|
||||||
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,14 +1064,21 @@ 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);
|
||||||
|
|
||||||
switch(*tag) {
|
switch(*tag) {
|
||||||
case 'A':
|
case 'A':
|
||||||
if (!strcmp(tag, "ADes")) {
|
if (!strcmp(tag, "ADes")) {
|
||||||
char error[40];
|
char error[40];
|
||||||
snprintf(error, sizeof(error)-1, "rent(Ades):%s", temp->name);
|
snprintf(error, sizeof(error)-1, "rent(Ades):%s", temp->name);
|
||||||
temp->action_description = fread_string(fl, error);
|
temp->action_description = fread_string(fl, error);
|
||||||
} else if (!strcmp(tag, "Aff ")) {
|
} else if (!strcmp(tag, "Aff ")) {
|
||||||
sscanf(line, "%d %d %d", &t[0], &t[1], &t[2]);
|
sscanf(line, "%d %d %d", &t[0], &t[1], &t[2]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue