From dc08ba5e9854a7dce543bc039d0af3a61d30af70 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 3 Nov 2018 13:51:10 +0100 Subject: [PATCH] bug 2510 duplicate region after datafile read --- scripts/eressea/tunnels.lua | 1 + src/kernel/region.c | 5 +---- src/kernel/save.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/eressea/tunnels.lua b/scripts/eressea/tunnels.lua index 4a787a373..b0b3fe2a3 100644 --- a/scripts/eressea/tunnels.lua +++ b/scripts/eressea/tunnels.lua @@ -27,6 +27,7 @@ end local function tunnel_action(b, param) local units = tunnel_travelers(b) local rto = get_target(param) + print("tunnel from " .. tostring(b.region) .. " to " .. tostring(rto)) if rto and units then eressea.log.debug("Tunnel from " .. tostring(b) .. " [" .. param .. "]") for key, u in pairs(units) do diff --git a/src/kernel/region.c b/src/kernel/region.c index f665811d7..bcae52e35 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -775,10 +775,7 @@ region *new_region(int x, int y, struct plane *pl, int uid) region *r; pnormalize(&x, &y, pl); - r = rfindhash(x, y); - if (!r) { - r = region_create(uid); - } + r = region_create(uid); r->x = x; r->y = y; r->age = 1; diff --git a/src/kernel/save.c b/src/kernel/save.c index ceaf78ee1..c2879bf0e 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -614,7 +614,7 @@ static void read_regioninfo(gamedata *data, const region *r, char *info, size_t static region *readregion(gamedata *data, int x, int y) { - region *r = findregion(x, y); + region *r; const terrain_type *terrain; char name[NAMESIZE]; char info[DISPLAYSIZE]; @@ -622,7 +622,7 @@ static region *readregion(gamedata *data, int x, int y) int n; READ_INT(data->store, &uid); - + r = findregionbyid(uid); if (r == NULL) { plane *pl = findplane(x, y); r = new_region(x, y, pl, uid);