Merge pull request #440 from ennorehling/feature/bug-2176-reduceproduction

bug 2176, reduceproduction message im CR
This commit is contained in:
Enno Rehling 2015-12-17 13:17:00 +01:00
commit 18c0c235db
29 changed files with 129 additions and 128 deletions

View File

@ -7511,11 +7511,6 @@
</namespace>
<string name="nr_reduced_production">
<text locale="de">Die Region ist verwüstet, der Boden karg.</text>
<text locale="en">The region is ravaged, the ground infertile.</text>
</string>
<string name="par_unit">
<text locale="de">Einheit-Nr</text>
<text locale="en">unitid</text>

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<messages>
<message name="reduced_production">
<text locale="de">Die Region ist verwüstet, der Boden karg.</text>
<text locale="en">The region is ravaged, the ground infertile.</text>
</message>
<message name="force_leave_ship" section="events">
<type>
<arg name="unit" type="unit"/>

View File

@ -238,9 +238,10 @@ static void free_potiondelay(attrib * a)
free(a->data.v);
}
static int age_potiondelay(attrib * a)
static int age_potiondelay(attrib * a, void *owner)
{
potiondelay *pd = (potiondelay *)a->data.v;
unused_arg(owner);
pd->amount = do_potion(pd->u, pd->r, pd->ptype, pd->amount);
return AT_AGE_REMOVE;
}

View File

@ -28,8 +28,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <storage.h>
static int verify_hate(attrib * a)
static int verify_hate(attrib * a, void *owner)
{
unused_arg(owner);
if (a->data.v == NULL) {
return 0;
}

View File

@ -24,8 +24,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <storage.h>
static int age_moved(attrib * a)
static int age_moved(attrib * a, void *owner)
{
unused_arg(owner);
--a->data.i;
return a->data.i > 0;
}

View File

@ -65,8 +65,9 @@ void set_movement(attrib ** alist, int type)
a->data.i |= type;
}
static int age_speedup(attrib * a)
static int age_speedup(attrib * a, void *owner)
{
unused_arg(owner);
if (a->data.sa[0] > 0) {
assert(a->data.sa[0] - a->data.sa[1] >= SHRT_MIN);
assert(a->data.sa[0] - a->data.sa[1] <= SHRT_MAX);

View File

@ -20,15 +20,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <kernel/config.h>
#include "reduceproduction.h"
#include <kernel/save.h>
#include <kernel/region.h>
#include <kernel/messages.h>
#include <util/message.h>
#include <util/attrib.h>
#include <assert.h>
static int age_reduceproduction(attrib * a)
static int age_reduceproduction(attrib * a, void *owner)
{
region * r = (region *)owner;
int reduce = 100 - (5 * --a->data.sa[1]);
if (reduce < 10)
assert(r);
if (reduce < 10) {
reduce = 10;
}
a->data.sa[0] = (short)reduce;
return (a->data.sa[1] > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
if (a->data.sa[1] > 0) {
ADDMSG(&r->msgs, msg_message("reduced_production", ""));
return AT_AGE_KEEP;
}
return AT_AGE_REMOVE;
}
attrib_type at_reduceproduction = {

View File

@ -28,17 +28,16 @@ without prior permission by the authors of Eressea.
#include <string.h>
typedef struct building_action {
struct building *b;
char *fname;
char *param;
} building_action;
static int lc_age(struct attrib *a)
static int lc_age(struct attrib *a, void *owner)
{
building_action *data = (building_action *)a->data.v;
const char *fname = data->fname;
const char *fparam = data->param;
building *b = data->b;
building *b = (building *)owner;
int result = -1;
assert(b != NULL);
@ -93,9 +92,8 @@ lc_write(const struct attrib *a, const void *owner, struct storage *store)
building_action *data = (building_action *)a->data.v;
const char *fname = data->fname;
const char *fparam = data->param;
building *b = data->b;
write_building_reference(b, store);
unused_arg(owner);
WRITE_TOK(store, fname);
WRITE_TOK(store, fparam ? fparam : NULLSTRING);
}
@ -104,13 +102,17 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
{
char name[NAMESIZE];
building_action *data = (building_action *)a->data.v;
int result =
read_reference(&data->b, store, read_building_reference, resolve_building);
building *b = (building *)owner;
int result = 0;
if (global.data_version < ATTRIBOWNER_VERSION) {
result = read_reference(&b, store, read_building_reference, resolve_building);
assert(b == owner);
}
READ_TOK(store, name, sizeof(name));
if (strcmp(name, "tunnel_action") == 0) {
/* E2: Weltentor has a new module, doesn't need this any longer */
result = 0;
data->b = 0;
b = 0;
}
else {
data->fname = _strdup(name);
@ -119,14 +121,14 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
if (strcmp(name, "tnnL") == 0) {
/* tunnel_action was the old Weltentore, their code has changed. ignore this object */
result = 0;
data->b = 0;
b = 0;
}
if (strcmp(name, NULLSTRING) == 0)
data->param = 0;
else {
data->param = _strdup(name);
}
if (result == 0 && !data->b) {
if (result == 0 && !b) {
return AT_READ_FAIL;
}
return AT_READ_OK;
@ -143,7 +145,6 @@ void building_addaction(building * b, const char *fname, const char *param)
{
attrib *a = a_add(&b->attribs, a_new(&at_building_action));
building_action *data = (building_action *)a->data.v;
data->b = b;
data->fname = _strdup(fname);
if (param) {
data->param = _strdup(param);

View File

@ -45,8 +45,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define HORNDURATION 3
#define HORNIMMUNITY 30
static int age_peaceimmune(attrib * a)
static int age_peaceimmune(attrib * a, void *owner)
{
unused_arg(owner);
return (--a->data.i > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
}

View File

@ -112,11 +112,12 @@ void curse_init(attrib * a)
a->data.v = calloc(1, sizeof(curse));
}
int curse_age(attrib * a)
int curse_age(attrib * a, void *owner)
{
curse *c = (curse *)a->data.v;
int result = 0;
unused_arg(owner);
c_clearflag(c, CURSE_ISNEW);
if (c_flags(c) & CURSE_NOAGE) {

View File

@ -291,7 +291,7 @@ extern "C" {
void curse_init(struct attrib *a);
void curse_done(struct attrib *a);
int curse_age(struct attrib *a);
int curse_age(struct attrib *a, void *owner);
double destr_curse(struct curse *c, int cast_level, double force);

View File

@ -742,10 +742,11 @@ void set_level(unit * u, skill_t sk, int value)
sk_set(add_skill(u, sk), value);
}
static int leftship_age(struct attrib *a)
static int leftship_age(struct attrib *a, void *owner)
{
/* must be aged, so it doesn't affect report generation (cansee) */
unused_arg(a);
unused_arg(owner);
return AT_AGE_REMOVE; /* remove me */
}

View File

@ -331,12 +331,12 @@ static void test_age_familiar(CuTest *tc) {
CuAssertIntEquals(tc, true, create_newfamiliar(mag, fam));
CuAssertPtrEquals(tc, fam, get_familiar(mag));
CuAssertPtrEquals(tc, mag, get_familiar_mage(fam));
a_age(&fam->attribs);
a_age(&mag->attribs);
a_age(&fam->attribs, fam);
a_age(&mag->attribs, mag);
CuAssertPtrEquals(tc, fam, get_familiar(mag));
CuAssertPtrEquals(tc, mag, get_familiar_mage(fam));
set_number(fam, 0);
a_age(&mag->attribs);
a_age(&mag->attribs, mag);
CuAssertPtrEquals(tc, 0, get_familiar(mag));
test_cleanup();
}

View File

@ -32,8 +32,9 @@
#define EXPLICIT_CURSE_ISNEW_VERSION 347 /* CURSE_ISNEW is not reset in read/write, but in age() */
#define SPELL_LEVEL_VERSION 348 /* f->max_spelllevel gets stored, not calculated */
#define OWNER_3_VERSION 349 /* regions store last owner, not last alliance */
#define ATTRIBOWNER_VERSION 350 /* all attrib_type functions know who owns the attribute */
#define RELEASE_VERSION OWNER_3_VERSION /* current datafile */
#define RELEASE_VERSION ATTRIBOWNER_VERSION /* current datafile */
#define MIN_VERSION INTPAK_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 */

View File

@ -3087,7 +3087,7 @@ static building *age_building(building * b)
}
}
a_age(&b->attribs);
a_age(&b->attribs, b);
handle_event(b->attribs, "timer", b);
if (b->type->age) {
@ -3099,7 +3099,7 @@ static building *age_building(building * b)
static void age_region(region * r)
{
a_age(&r->attribs);
a_age(&r->attribs, r);
handle_event(r->attribs, "timer", r);
if (!r->land)
@ -3144,7 +3144,7 @@ static void ageing(void)
/* Factions */
for (f = factions; f; f = f->next) {
a_age(&f->attribs);
a_age(&f->attribs, f);
handle_event(f->attribs, "timer", f);
}
@ -3159,7 +3159,7 @@ static void ageing(void)
/* Einheiten */
for (up = &r->units; *up;) {
unit *u = *up;
a_age(&u->attribs);
a_age(&u->attribs, u);
if (u == *up)
handle_event(u->attribs, "timer", u);
if (u == *up)
@ -3169,7 +3169,7 @@ static void ageing(void)
/* Schiffe */
for (sp = &r->ships; *sp;) {
ship *s = *sp;
a_age(&s->attribs);
a_age(&s->attribs, s);
if (s == *sp)
handle_event(s->attribs, "timer", s);
if (s == *sp)

View File

@ -124,19 +124,20 @@ static double MagicPower(double force)
return 0;
}
typedef struct icastle_data {
const struct building_type *type;
int time;
} icastle_data;
static int a_readicastle(attrib * a, void *owner, struct storage *store)
{
icastle_data *data = (icastle_data *)a->data.v;
variant bno;
char token[32];
READ_TOK(store, token, sizeof(token));
READ_INT(store, &bno.i);
READ_INT(store, &data->time);
data->building = findbuilding(bno.i);
if (!data->building) {
/* this shouldn't happen, but just in case it does: */
ur_add(bno, &data->building, resolve_building);
if (global.data_version < ATTRIBOWNER_VERSION) {
READ_INT(store, NULL);
}
READ_INT(store, &data->time);
data->type = bt_find(token);
return AT_READ_OK;
}
@ -145,17 +146,18 @@ static void
a_writeicastle(const attrib * a, const void *owner, struct storage *store)
{
icastle_data *data = (icastle_data *)a->data.v;
unused_arg(owner);
WRITE_TOK(store, data->type->_name);
WRITE_INT(store, data->building->no);
WRITE_INT(store, data->time);
}
static int a_ageicastle(struct attrib *a)
static int a_ageicastle(struct attrib *a, void *owner)
{
icastle_data *data = (icastle_data *)a->data.v;
if (data->time <= 0) {
building *b = data->building;
building *b = (building *)owner;
region *r = b->region;
assert(owner == b);
ADDMSG(&r->msgs, msg_message("icastle_dissolve", "building", b));
/* remove_building lets units leave the building */
remove_building(&r->buildings, b);
@ -185,6 +187,17 @@ attrib_type at_icastle = {
a_readicastle
};
void make_icastle(building *b, const building_type *btype, int timeout) {
attrib *a = a_add(&b->attribs, a_new(&at_icastle));
icastle_data *data = (icastle_data *)a->data.v;
data->type = btype;
data->time = timeout;
}
const building_type *icastle_type(const struct attrib *a) {
icastle_data *icastle = (icastle_data *)a->data.v;
return icastle->type;
}
/* ------------------------------------------------------------- */
extern int dice(int count, int value);
@ -2384,10 +2397,11 @@ static int read_magician(attrib * a, void *owner, struct storage *store)
return AT_READ_OK;
}
static int age_unit(attrib * a)
static int age_unit(attrib * a, void *owner)
/* if unit is gone or dead, remove the attribute */
{
unit *u = (unit *)a->data.v;
unused_arg(owner);
return (u != NULL && u->number > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
}

View File

@ -206,11 +206,8 @@ extern "C" {
extern struct attrib_type at_reportspell;
extern struct attrib_type at_icastle;
typedef struct icastle_data {
const struct building_type *type;
struct building *building; /* reverse pointer to dissolve the object */
int time;
} icastle_data;
void make_icastle(struct building *b, const struct building_type *btype, int timeout);
const struct building_type *icastle_type(const struct attrib *a);
/* ------------------------------------------------------------- */
/* Kommentare:

View File

@ -212,11 +212,12 @@ order * ord)
/**
* Tempel der Schreie, Demo-Gebäude **/
static int age_hurting(attrib * a)
static int age_hurting(attrib * a, void *owner)
{
building *b = (building *)a->data.v;
unit *u;
int active = 0;
assert(owner == b);
if (b == NULL)
return AT_AGE_REMOVE;
for (u = b->region->units; u; u = u->next) {

View File

@ -145,9 +145,10 @@ static void shiptrail_finalize(attrib * a)
free(a->data.v);
}
static int shiptrail_age(attrib * a)
static int shiptrail_age(attrib * a, void *owner)
{
traveldir *t = (traveldir *)(a->data.v);
unused_arg(owner);
t->age--;
return (t->age > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;

View File

@ -271,9 +271,9 @@ static void test_age_trails(CuTest *tc) {
move_ship(sh, r1, r2, route);
CuAssertPtrNotNull(tc, r1->attribs);
a_age(&r1->attribs);
a_age(&r1->attribs, r1);
CuAssertPtrNotNull(tc, r1->attribs);
a_age(&r1->attribs);
a_age(&r1->attribs, r1);
CuAssertPtrEquals(tc, 0, r1->attribs);
free_regionlist(route);
test_cleanup();

View File

@ -1235,13 +1235,6 @@ static void describe(stream *out, const seen_region * sr, faction * f)
nr_curses(out, 0, f, TYP_REGION, r);
n = 0;
/* Produktionsreduktion */
a = a_find(r->attribs, &at_reduceproduction);
if (a) {
const char *str = LOC(f->locale, "nr_reduced_production");
paragraph(out, str, 0, 0, 0);
}
if (edges)
newline(out);
for (e = edges; e; e = e->next) {
@ -1268,6 +1261,7 @@ static void describe(stream *out, const seen_region * sr, faction * f)
first = false;
}
// TODO name is localized? Works for roads anyway...
// TODO: creating messages during reporting makes them not show up in CR?
msg = msg_message("nr_borderlist_postfix", "transparent object",
e->transparent, e->name);
bytes = (int)nr_render(msg, f->locale, bufp, size, f);

View File

@ -356,8 +356,7 @@ const char **illusion)
if (bt_illusion && b->type == bt_illusion) {
const attrib *a = a_findc(b->attribs, &at_icastle);
if (a != NULL) {
icastle_data *icastle = (icastle_data *)a->data.v;
*illusion = buildingtype(icastle->type, b, b->size);
*illusion = buildingtype(icastle_type(a), b, b->size);
}
}
}

View File

@ -4477,13 +4477,11 @@ int sp_icastle(castorder * co)
{
building *b;
const building_type *type;
attrib *a;
region *r = co_get_region(co);
unit *mage = co->magician.u;
int cast_level = co->level;
double power = co->force;
spellparameter *pa = co->par;
icastle_data *data;
const char *bname;
message *msg;
const building_type *bt_illusion = bt_find("illusioncastle");
@ -4519,12 +4517,7 @@ int sp_icastle(castorder * co)
building_setname(b, bname);
/* TODO: Auf timeout und action_destroy umstellen */
a = a_add(&b->attribs, a_new(&at_icastle));
data = (icastle_data *)a->data.v;
data->type = type;
data->building = b;
data->time =
2 + (rng_int() % (int)(power)+1) * (rng_int() % (int)(power)+1);
make_icastle(b, type, 2 + (rng_int() % (int)(power)+1) * (rng_int() % (int)(power)+1));
if (mage->region == r) {
if (leave(mage, false)) {

View File

@ -42,7 +42,7 @@ static void test_good_dreams(CuTest *tc) {
CuAssertTrue(tc, curse && curse->duration > 1);
CuAssertTrue(tc, curse->effect == 1);
a_age(&r->attribs);
a_age(&r->attribs, r);
CuAssertIntEquals_Msg(tc, "good dreams give +1 to allies", 1, get_modifier(u1, SK_MELEE, 11, r, false));
CuAssertIntEquals_Msg(tc, "good dreams have no effect on non-allies", 0, get_modifier(u2, SK_MELEE, 11, r, false));
free_castorder(&co);
@ -67,7 +67,7 @@ static void test_dreams(CuTest *tc) {
sp_gooddreams(&co);
sp_baddreams(&co);
a_age(&r->attribs);
a_age(&r->attribs, r);
CuAssertIntEquals_Msg(tc, "good dreams in same region as bad dreams", 1, get_modifier(u1, SK_MELEE, 11, r, false));
CuAssertIntEquals_Msg(tc, "bad dreams in same region as good dreams", -1, get_modifier(u2, SK_MELEE, 11, r, false));
@ -98,7 +98,7 @@ static void test_bad_dreams(CuTest *tc) {
CuAssertTrue(tc, curse && curse->duration > 1);
CuAssertTrue(tc, curse->effect == -1);
a_age(&r->attribs);
a_age(&r->attribs, r);
CuAssertIntEquals_Msg(tc, "bad dreams have no effect on allies", 0, get_modifier(u1, SK_MELEE, 11, r, false));
CuAssertIntEquals_Msg(tc, "bad dreams give -1 to non-allies", -1, get_modifier(u2, SK_MELEE, 11, r, false));

View File

@ -46,7 +46,7 @@ extern const char *directions[];
typedef struct alp_data {
unit *mage;
unit *target;
unit *target; // TODO: remove, use attribute-owner?
} alp_data;
static void alp_init(attrib * a)
@ -59,9 +59,10 @@ static void alp_done(attrib * a)
free(a->data.v);
}
static int alp_verify(attrib * a)
static int alp_verify(attrib * a, void *owner)
{
alp_data *ad = (alp_data *)a->data.v;
unused_arg(owner);
if (ad->mage && ad->target)
return 1;
return 0; /* remove the attribute */

View File

@ -252,7 +252,7 @@ attrib *a_new(const attrib_type * at)
return a;
}
int a_age(attrib ** p)
int a_age(attrib ** p, void *owner)
{
attrib **ap = p;
/* Attribute altern, und die Entfernung (age()==0) eines Attributs
@ -260,7 +260,7 @@ int a_age(attrib ** p)
while (*ap) {
attrib *a = *ap;
if (a->type->age) {
int result = a->type->age(a);
int result = a->type->age(a, owner);
assert(result >= 0 || !"age() returned a negative value");
if (result == AT_AGE_REMOVE) {
a_remove(p, a);

View File

@ -52,7 +52,7 @@ extern "C" {
const char *name;
void(*initialize) (struct attrib *);
void(*finalize) (struct attrib *);
int(*age) (struct attrib *);
int(*age) (struct attrib *, void *owner);
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
void(*write) (const struct attrib *, const void *owner, struct storage *);
int(*read) (struct attrib *, void *owner, struct storage *); /* return AT_READ_OK on success, AT_READ_FAIL if attrib needs removal */
@ -74,7 +74,7 @@ extern "C" {
extern void a_removeall(attrib ** a, const attrib_type * at);
extern attrib *a_new(const attrib_type * at);
extern int a_age(attrib ** attribs);
extern int a_age(attrib ** attribs, void *owner);
extern int a_read(struct storage *store, attrib ** attribs, void *owner);
extern void a_write(struct storage *store, const attrib * attribs,
const void *owner);

View File

@ -66,9 +66,10 @@ static void a_freedirection(attrib * a)
free(d);
}
static int a_agedirection(attrib * a)
static int a_agedirection(attrib * a, void *owner)
{
spec_direction *d = (spec_direction *)(a->data.v);
unused_arg(owner);
--d->duration;
return (d->duration > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
}
@ -78,7 +79,7 @@ static int a_readdirection(attrib * a, void *owner, struct storage *store)
spec_direction *d = (spec_direction *)(a->data.v);
char lbuf[32];
(void)owner;
unused_arg(owner);
READ_INT(store, &d->x);
READ_INT(store, &d->y);
READ_INT(store, &d->duration);
@ -95,7 +96,7 @@ a_writedirection(const attrib * a, const void *owner, struct storage *store)
{
spec_direction *d = (spec_direction *)(a->data.v);
(void)owner;
unused_arg(owner);
WRITE_INT(store, d->x);
WRITE_INT(store, d->y);
WRITE_INT(store, d->duration);

View File

@ -55,39 +55,26 @@ static int cmp_age(const void *v1, const void *v2)
return 0;
}
typedef struct wormhole_data {
building *entry;
region *exit;
} wormhole_data;
static void wormhole_init(struct attrib *a)
static int wormhole_age(struct attrib *a, void *owner)
{
a->data.v = calloc(1, sizeof(wormhole_data));
}
static void wormhole_done(struct attrib *a)
{
free(a->data.v);
}
static int wormhole_age(struct attrib *a)
{
wormhole_data *data = (wormhole_data *)a->data.v;
int maxtransport = data->entry->size;
region *r = data->entry->region;
building *entry = (building *)owner;
region *exit = (region *)a->data.v;
int maxtransport = entry->size;
region *r = entry->region;
unit *u = r->units;
unused_arg(owner);
for (; u != NULL && maxtransport != 0; u = u->next) {
if (u->building == data->entry) {
if (u->building == entry) {
message *m = NULL;
if (u->number > maxtransport || has_limited_skills(u)) {
m = msg_message("wormhole_requirements", "unit region", u, u->region);
}
else if (data->exit != NULL) {
move_unit(u, data->exit, NULL);
else if (exit != NULL) {
move_unit(u, exit, NULL);
maxtransport -= u->number;
m = msg_message("wormhole_exit", "unit region", u, data->exit);
add_message(&data->exit->msgs, m);
m = msg_message("wormhole_exit", "unit region", u, exit);
add_message(&exit->msgs, m);
}
if (m != NULL) {
add_message(&u->faction->msgs, m);
@ -96,7 +83,7 @@ static int wormhole_age(struct attrib *a)
}
}
remove_building(&r->buildings, data->entry);
remove_building(&r->buildings, entry);
ADDMSG(&r->msgs, msg_message("wormhole_dissolve", "region", r));
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
@ -105,9 +92,8 @@ static int wormhole_age(struct attrib *a)
static void wormhole_write(const struct attrib *a, const void *owner, struct storage *store)
{
wormhole_data *data = (wormhole_data *)a->data.v;
write_building_reference(data->entry, store);
write_region_reference(data->exit, store);
region *exit = (region *)a->data.v;
write_region_reference(exit, store);
}
/** conversion code, turn 573, 2008-05-23 */
@ -125,18 +111,16 @@ static int resolve_exit(variant id, void *address)
static int wormhole_read(struct attrib *a, void *owner, struct storage *store)
{
wormhole_data *data = (wormhole_data *)a->data.v;
resolve_fun resolver = (global.data_version < UIDHASH_VERSION)
? resolve_exit : resolve_region_id;
read_fun reader = (global.data_version < UIDHASH_VERSION)
? read_building_reference : read_region_reference;
int rb =
read_reference(&data->entry, store, read_building_reference,
resolve_building);
int rr = read_reference(&data->exit, store, reader, resolver);
if (rb == 0 && rr == 0) {
if (!data->exit || !data->entry) {
if (global.data_version < ATTRIBOWNER_VERSION) {
READ_INT(store, NULL);
}
if (read_reference(&a->data.v, store, reader, resolver) == 0) {
if (!a->data.v) {
return AT_READ_FAIL;
}
}
@ -145,8 +129,8 @@ static int wormhole_read(struct attrib *a, void *owner, struct storage *store)
static attrib_type at_wormhole = {
"wormhole",
wormhole_init,
wormhole_done,
NULL,
NULL,
wormhole_age,
wormhole_write,
wormhole_read,
@ -160,12 +144,8 @@ make_wormhole(const building_type * bt_wormhole, region * r1, region * r2)
building *b2 = new_building(bt_wormhole, r2, default_locale);
attrib *a1 = a_add(&b1->attribs, a_new(&at_wormhole));
attrib *a2 = a_add(&b2->attribs, a_new(&at_wormhole));
wormhole_data *d1 = (wormhole_data *)a1->data.v;
wormhole_data *d2 = (wormhole_data *)a2->data.v;
d1->entry = b1;
d2->entry = b2;
d1->exit = b2->region;
d2->exit = b1->region;
a1->data.v = b2->region;
a2->data.v = b1->region;
b1->size = bt_wormhole->maxsize;
b2->size = bt_wormhole->maxsize;
ADDMSG(&r1->msgs, msg_message("wormhole_appear", "region", r1));