From 43422a06194e9b4344af350fb596cc4c3caef5d8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 26 Apr 2008 16:45:39 +0000 Subject: [PATCH] fix for duplicate astral plane --- src/common/kernel/save.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 98d344fce..db8143b51 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1609,8 +1609,14 @@ readgame(const char * filename, int mode, int backup) planes = NULL; n = store->r_int(store); while(--n >= 0) { - plane *pl = calloc(1, sizeof(plane)); - pl->id = store->r_int(store); + int id = store->r_int(store); + plane *pl = getplanebyid(id); + if (pl==NULL) { + calloc(1, sizeof(plane)); + } else { + log_warning(("the plane with id=%d already exists.\n", id)); + } + pl->id = id; pl->name = store->r_str(store); pl->minx = (short)store->r_int(store); pl->maxx = (short)store->r_int(store);