Skip to content

Commit

Permalink
accidentally broke roads in last commit.
Browse files Browse the repository at this point in the history
Fixed an alchemy bug that made turn 572 crash
  • Loading branch information
ennorehling committed Jan 3, 2025
1 parent 5d02b0b commit 045ccaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/alchemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void scale_effects(unit* u, int n)
else if (u->number > 0) {
uint64_t scale = (uint64_t)data->value * n / u->number;
assert(scale <= INT_MAX);
assert(scale > 0);
assert(scale >= 0);
data->value = (int) scale;
}
}
Expand Down
21 changes: 11 additions & 10 deletions src/kernel/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,18 @@ static bool b_rvisibleroad(const connection * b, const region * r)
}

border_type bt_road = {
"road", VAR_NONE, LAND_REGION,
NULL,
"road", VAR_INT, LAND_REGION,
b_transparent,
NULL, /* init */
NULL, /* destroy */
b_readroad, /* read */
b_writeroad, /* write */
b_blocknone, /* block */
b_nameroad, /* name */
b_rvisibleroad, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
b_validroad /* valid */
};

void write_borders(struct storage *store)
Expand Down Expand Up @@ -580,16 +587,10 @@ int read_borders(gamedata *data)
}
}
if (b == NULL) {
if (type == &bt_road) {
/* delete old bt_road instances */
b = &dummy;
}
else {
b = create_border(type, from, to);
}
b = create_border(type, from, to);
}
type->read(b, data);
if (type->datatype != VAR_NONE && !type->write) {
if (!type->write) {
log_warning("invalid border '%s' between '%s' and '%s'\n", zText, regionname(from, 0), regionname(to, 0));
}
}
Expand Down

0 comments on commit 045ccaf

Please sign in to comment.