bug 2510 duplicate region after datafile read

This commit is contained in:
Enno Rehling 2018-11-03 13:51:10 +01:00
parent c981bfb766
commit dc08ba5e98
3 changed files with 4 additions and 6 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);