forked from github/server
wormhole:
- ageing happens to early, must do it in two steps - set the size of the wormhole on creation
This commit is contained in:
parent
552e58d3a2
commit
90ac737d60
1 changed files with 22 additions and 15 deletions
|
@ -73,9 +73,13 @@ static int
|
|||
wormhole_age(struct attrib * a)
|
||||
{
|
||||
wormhole_data * data = (wormhole_data*)a->data.v;
|
||||
int maxtransport = data->entry->size;
|
||||
|
||||
if (data->entry->size==0) {
|
||||
destroy_building(data->entry);
|
||||
} else {
|
||||
region * r = data->entry->region;
|
||||
unit * u = r->units;
|
||||
int maxtransport = 4;
|
||||
|
||||
for (;u!=NULL && maxtransport!=0;u=u->next) {
|
||||
message * m;
|
||||
|
@ -90,8 +94,9 @@ wormhole_age(struct attrib * a)
|
|||
add_message(&u->faction->msgs, m);
|
||||
msg_release(m);
|
||||
}
|
||||
data->entry->size = 0;
|
||||
}
|
||||
|
||||
destroy_building(data->entry);
|
||||
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
|
||||
return -1;
|
||||
}
|
||||
|
@ -136,6 +141,8 @@ make_wormhole(region * r1, region * r2)
|
|||
wormhole_data * d2 = (wormhole_data*)a2->data.v;
|
||||
d1->entry = d2->exit = b1;
|
||||
d2->entry = d1->exit = b2;
|
||||
b1->size = bt_wormhole.maxsize;
|
||||
b2->size = bt_wormhole.maxsize;
|
||||
ADDMSG(&r1->msgs, msg_message("wormhole_appear", "region", r1));
|
||||
ADDMSG(&r2->msgs, msg_message("wormhole_appear", "region", r2));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue