diff --git a/src/kernel/connection.c b/src/kernel/connection.c index a41b2e1ca..3572dff6e 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -349,7 +349,7 @@ static const char *b_namewall(const connection * b, const region * r, } border_type bt_wall = { - "wall", VAR_INT, + "wall", VAR_INT, LAND_REGION, b_opaque, NULL, /* init */ NULL, /* destroy */ @@ -363,7 +363,7 @@ border_type bt_wall = { }; border_type bt_noway = { - "noway", VAR_INT, + "noway", VAR_INT, 0, b_transparent, NULL, /* init */ NULL, /* destroy */ @@ -400,7 +400,7 @@ b_blockfogwall(const connection * b, const unit * u, const region * r) /** Legacy type used in old Eressea games, no longer in use. */ border_type bt_fogwall = { - "fogwall", VAR_INT, + "fogwall", VAR_INT, 0, b_transparent, /* transparent */ NULL, /* init */ NULL, /* destroy */ @@ -430,7 +430,7 @@ static const char *b_nameillusionwall(const connection * b, const region * r, } border_type bt_illusionwall = { - "illusionwall", VAR_INT, + "illusionwall", VAR_INT, 0, b_opaque, NULL, /* init */ NULL, /* destroy */ @@ -522,7 +522,7 @@ static bool b_rvisibleroad(const connection * b, const region * r) } border_type bt_road = { - "road", VAR_INT, + "road", VAR_INT, LAND_REGION, b_transparent, NULL, /* init */ NULL, /* destroy */ @@ -568,6 +568,7 @@ int read_borders(gamedata *data) char zText[32]; region *from, *to; border_type *type; + connection dummy; READ_TOK(store, zText, sizeof(zText)); if (!strcmp(zText, "end")) { @@ -588,7 +589,6 @@ int read_borders(gamedata *data) log_error("%s connection %d has missing regions", zText, bid); if (type->read) { /* skip ahead */ - connection dummy; type->read(&dummy, data); } continue; @@ -602,10 +602,21 @@ int read_borders(gamedata *data) to = r; } if (type->read) { - connection *b = new_border(type, from, to); - nextborder--; /* new_border erhoeht den Wert */ - b->id = bid; - assert(bid <= nextborder); + connection *b = NULL; + + if (data->version < FIX_SEAROADS_VERSION) { + /* bug 2694: eliminate roads in oceans */ + if (type->terrain_flags != 0 && type->terrain_flags != fval(from->terrain, type->terrain_flags)) { + log_info("ignoring %s connection in %s", type->_name, from->terrain->_name); + b = &dummy; + } + } + if (b == NULL) { + b = new_border(type, from, to); + nextborder--; /* new_border erhoeht den Wert */ + b->id = bid; + assert(bid <= nextborder); + } type->read(b, data); if (!type->write) { log_warning("invalid border '%s' between '%s' and '%s'\n", zText, regionname(from, 0), regionname(to, 0)); diff --git a/src/kernel/connection.h b/src/kernel/connection.h index 06e238243..f5cc9fc9c 100644 --- a/src/kernel/connection.h +++ b/src/kernel/connection.h @@ -29,6 +29,7 @@ extern "C" { typedef struct border_type { const char *_name; /* internal use only */ variant_type datatype; + int terrain_flags; bool(*transparent) (const connection *, const struct faction *); /* is it possible to see through this? */ void(*init) (connection *); diff --git a/src/kernel/gamedata.h b/src/kernel/gamedata.h index 0830d11c9..4e553fa43 100644 --- a/src/kernel/gamedata.h +++ b/src/kernel/gamedata.h @@ -46,9 +46,10 @@ #define FIX_CLONES_VERSION 368 /* dissolve clones */ #define FIX_MIGRANT_AURA_VERSION 369 /* bug 2585, migrants with aura */ #define SHIP_NUMBER_VERSION 370 /* ships have a number */ -#define FIX_SHAPESHIFT_VERSION 371 /* ships have a number */ +#define FIX_SHAPESHIFT_VERSION 371 /* shapeshifting demons */ +#define FIX_SEAROADS_VERSION 372 /* removing roads in ocean regions */ -#define RELEASE_VERSION FIX_SHAPESHIFT_VERSION /* current datafile */ +#define RELEASE_VERSION FIX_SEAROADS_VERSION /* current datafile */ #define MIN_VERSION UIDHASH_VERSION /* minimal datafile we support */ #define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */ diff --git a/src/modules/museum.c b/src/modules/museum.c index 2ac4b9b95..8f8350655 100644 --- a/src/modules/museum.c +++ b/src/modules/museum.c @@ -253,7 +253,7 @@ static const char *b_namequestportal(const connection * b, const region * r, } border_type bt_questportal = { - "questportal", VAR_INT, + "questportal", VAR_INT, 0, b_opaque, NULL, /* init */ NULL, /* destroy */ diff --git a/src/spells/borders.c b/src/spells/borders.c index 067ff6114..73476620c 100644 --- a/src/spells/borders.c +++ b/src/spells/borders.c @@ -157,7 +157,7 @@ static const char *b_namefirewall(const connection * b, const region * r, } border_type bt_firewall = { - "firewall", VAR_VOIDPTR, + "firewall", VAR_VOIDPTR, 0, b_transparent, /* transparent */ wall_init, /* init */ wall_destroy, /* destroy */ @@ -185,7 +185,7 @@ void convert_firewall_timeouts(connection * b, attrib * a) } border_type bt_wisps = { /* only here for reading old data */ - "wisps", VAR_VOIDPTR, + "wisps", VAR_VOIDPTR, 0, b_transparent, /* transparent */ 0, /* init */ wall_destroy, /* destroy */ @@ -225,7 +225,7 @@ static struct region *chaosgate_move(const connection * b, struct unit *u, } border_type bt_chaosgate = { - "chaosgate", VAR_NONE, + "chaosgate", VAR_NONE, 0, b_transparent, /* transparent */ NULL, /* init */ NULL, /* destroy */