forked from github/server
refactor new_border's relationship to nextborder.
loading a connection was unnecessarily changing nextborder.
This commit is contained in:
parent
e9baa06a63
commit
740f4a568b
|
@ -106,7 +106,7 @@ connection *get_borders(const region * r1, const region * r2)
|
|||
return *bp;
|
||||
}
|
||||
|
||||
connection *new_border(border_type * type, region * from, region * to)
|
||||
connection *new_border(border_type * type, region * from, region * to, int id)
|
||||
{
|
||||
connection *b, **bp;
|
||||
|
||||
|
@ -120,10 +120,11 @@ connection *new_border(border_type * type, region * from, region * to)
|
|||
b->type = type;
|
||||
b->from = from;
|
||||
b->to = to;
|
||||
b->id = ++nextborder;
|
||||
b->id = (id > 0) ? id : ++nextborder;
|
||||
|
||||
if (type->init)
|
||||
if (type->init) {
|
||||
type->init(b);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -612,9 +613,7 @@ int read_borders(gamedata *data)
|
|||
}
|
||||
}
|
||||
if (b == NULL) {
|
||||
b = new_border(type, from, to);
|
||||
nextborder--; /* new_border erhoeht den Wert */
|
||||
b->id = bid;
|
||||
b = new_border(type, from, to, bid);
|
||||
assert(bid <= nextborder);
|
||||
}
|
||||
type->read(b, data);
|
||||
|
|
|
@ -86,8 +86,7 @@ extern "C" {
|
|||
connection *get_borders(const struct region *r1,
|
||||
const struct region *r2);
|
||||
/* returns the list of borders between r1 and r2 or r2 and r1 */
|
||||
connection *new_border(border_type * type, struct region *from,
|
||||
struct region *to);
|
||||
connection *new_border(border_type *type, struct region *from, struct region *to, int id);
|
||||
/* creates a connection of the specified type */
|
||||
void erase_border(connection * b);
|
||||
/* remove the connection from memory */
|
||||
|
|
|
@ -539,7 +539,7 @@ void rsetroad(region * r, direction_t d, int val)
|
|||
}
|
||||
if (!b) {
|
||||
if (!val) return;
|
||||
b = new_border(&bt_road, r, r2);
|
||||
b = new_border(&bt_road, r, r2, 0);
|
||||
}
|
||||
if (r == b->from) {
|
||||
b->data.sa[0] = (short)val;
|
||||
|
|
|
@ -2657,7 +2657,7 @@ static int sp_firewall(castorder * co)
|
|||
b = b->next;
|
||||
}
|
||||
if (b == NULL) {
|
||||
b = new_border(&bt_firewall, r, r2);
|
||||
b = new_border(&bt_firewall, r, r2, 0);
|
||||
fd = (wall_data *)b->data.v;
|
||||
fd->force = (int)(force / 2 + 0.5);
|
||||
fd->mage = caster;
|
||||
|
@ -3094,7 +3094,7 @@ static int sp_chaossuction(castorder * co)
|
|||
/* TODO: implement with a building */
|
||||
create_special_direction(r, rt, 2, "vortex_desc", "vortex", false);
|
||||
create_special_direction(rt, r, 2, "vortex_desc", "vortex", false);
|
||||
new_border(&bt_chaosgate, r, rt);
|
||||
new_border(&bt_chaosgate, r, rt, 0);
|
||||
|
||||
ADDMSG(&r->msgs, msg_message("chaosgate_effect_1", "mage", caster));
|
||||
ADDMSG(&rt->msgs, msg_message("chaosgate_effect_2", ""));
|
||||
|
|
Loading…
Reference in New Issue