diff --git a/src/kernel/connection.c b/src/kernel/connection.c index 428ee5136..6ae173271 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -606,7 +606,7 @@ int read_borders(gamedata *data) { struct storage *store = data->store; for (;;) { - int bid = 0; + int fid, tid, bid; char zText[32]; region *from, *to; border_type *type; @@ -621,22 +621,10 @@ int read_borders(gamedata *data) } READ_INT(store, &bid); - if (data->version < UIDHASH_VERSION) { - int fx, fy, tx, ty; - READ_INT(store, &fx); - READ_INT(store, &fy); - READ_INT(store, &tx); - READ_INT(store, &ty); - from = findregion(fx, fy); - to = findregion(tx, ty); - } - else { - int fid, tid; - READ_INT(store, &fid); - READ_INT(store, &tid); - from = findregionbyid(fid); - to = findregionbyid(tid); - } + READ_INT(store, &fid); + READ_INT(store, &tid); + from = findregionbyid(fid); + to = findregionbyid(tid); if (!to || !from) { log_error("%s connection %d has missing regions", zText, bid); if (type->read) { diff --git a/src/kernel/region.c b/src/kernel/region.c index ee0eaa781..fa2a68464 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -1255,24 +1255,11 @@ int production(const region * r) return p; } -void * resolve_region_coor(int id, void **address) -{ - int x = (id >> 16); - int y = id & 0xFFFF; - return *(region **)address = findregion(x, y); -} - -#define RESOLVE_REGION_ID (TYP_REGION << 24) -#define RESOLVE_REGION_XY ((TYP_REGION|0x10) << 24) +#define RESOLVE_REGION (TYP_REGION << 24) void resolve_region(region *r) { - short x = (short)r->x; - short y = (short)r->y; - int id = x << 16 | (y & 0xFFFF); - - resolve(RESOLVE_REGION_XY | id, r); - resolve(RESOLVE_REGION_ID | r->uid, r); + resolve(RESOLVE_REGION | r->uid, r); } int read_region_reference(gamedata * data, void **rp, resolve_fun fun) @@ -1280,26 +1267,10 @@ int read_region_reference(gamedata * data, void **rp, resolve_fun fun) struct storage * store = data->store; int id = 0; - if (data->version >= UIDHASH_VERSION) { - READ_INT(store, &id); - *rp = findregionbyid(id); - if (*rp == NULL) { - ur_add(RESOLVE_REGION_ID | id, rp, fun); - } - } - else { - int n; - short x, y; - READ_INT(store, &n); - x = (short)n; - READ_INT(store, &n); - y = (short)n; - *rp = findregion(x, y); - if (*rp == NULL) { - id = x << 16 | (y & 0xFFFF); - ur_add(RESOLVE_REGION_XY | id, rp, resolve_region_coor); - } - + READ_INT(store, &id); + *rp = findregionbyid(id); + if (*rp == NULL) { + ur_add(RESOLVE_REGION | id, rp, fun); } return id; } diff --git a/src/wormhole.c b/src/wormhole.c index 030c33c06..e12a053b8 100644 --- a/src/wormhole.c +++ b/src/wormhole.c @@ -96,16 +96,6 @@ static void wormhole_write(const struct attrib *a, const void *owner, struct sto write_region_reference(exit, store); } -/** conversion code, turn 573, 2008-05-23 */ -static void * resolve_exit(int id, void *data) -{ - building *b = (building *)data; - if (b) { - return b->region; - } - return NULL; -} - static int wormhole_read(struct attrib *a, void *owner, struct gamedata *data) { int id; @@ -113,12 +103,7 @@ static int wormhole_read(struct attrib *a, void *owner, struct gamedata *data) if (data->version < ATTRIBOWNER_VERSION) { READ_INT(data->store, NULL); } - if (data->version < UIDHASH_VERSION) { - id = read_building_reference(data, &a->data.v, resolve_exit); - } - else { - id = read_region_reference(data, &a->data.v, NULL); - } + id = read_region_reference(data, &a->data.v, NULL); return (id <= 0) ? AT_READ_FAIL : AT_READ_OK; }