forked from github/server
add a safety check against accidentally drowning units in terraforming.
This commit is contained in:
parent
f4e56d1512
commit
a7b7162c56
|
@ -170,12 +170,6 @@ static int potion_luck(unit *u, region *r, attrib_type *atype, int amount) {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int potion_truth(unit *u) {
|
|
||||||
UNUSED_ARG(u);
|
|
||||||
/* TODO: this potion does nothing! */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int potion_power(unit *u, int amount) {
|
static int potion_power(unit *u, int amount) {
|
||||||
int use = u->number / 10;
|
int use = u->number / 10;
|
||||||
if (use < amount) {
|
if (use < amount) {
|
||||||
|
@ -201,9 +195,6 @@ static int do_potion(unit * u, region *r, const potion_type * ptype, int amount)
|
||||||
else if (ptype == oldpotiontype[P_HORSE]) {
|
else if (ptype == oldpotiontype[P_HORSE]) {
|
||||||
return potion_luck(u, r, &at_horseluck, amount);
|
return potion_luck(u, r, &at_horseluck, amount);
|
||||||
}
|
}
|
||||||
else if (ptype == oldpotiontype[P_WAHRHEIT]) {
|
|
||||||
return potion_truth(u);
|
|
||||||
}
|
|
||||||
else if (ptype == oldpotiontype[P_MACHT]) {
|
else if (ptype == oldpotiontype[P_MACHT]) {
|
||||||
return potion_power(u, amount);
|
return potion_power(u, amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1060,7 +1060,10 @@ void terraform_region(region * r, const terrain_type * terrain)
|
||||||
rawmaterial **lrm = &r->resources;
|
rawmaterial **lrm = &r->resources;
|
||||||
|
|
||||||
assert(terrain);
|
assert(terrain);
|
||||||
|
if (r->units && fval(r->terrain, LAND_REGION) && !fval(terrain, LAND_REGION)) {
|
||||||
|
log_error("region %s contains units, not terraforming it to %s.", regionname(r, NULL), terrain->_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (*lrm) {
|
while (*lrm) {
|
||||||
rawmaterial *rm = *lrm;
|
rawmaterial *rm = *lrm;
|
||||||
const resource_type *rtype = NULL;
|
const resource_type *rtype = NULL;
|
||||||
|
|
Loading…
Reference in New Issue