Fix some bugs with the undocumented location-specific terrain rules:

- x and y values were shifted by 1

- other [tile] requirements were ignored
This commit is contained in:
Ali El Gariani 2008-04-28 16:25:23 +00:00
parent 0642efcaf5
commit b9ff50c5cc

View File

@ -681,7 +681,7 @@ void terrain_builder::parse_config(const config &cfg)
// add_images_from_config(pbr.images, **br);
if(!((**br)["x"].empty() || (**br)["y"].empty()))
pbr.location_constraints = gamemap::location(atoi((**br)["x"].c_str()), atoi((**br)["y"].c_str()));
pbr.location_constraints = gamemap::location(atoi((**br)["x"].c_str())-1, atoi((**br)["y"].c_str())-1);
pbr.probability = (**br)["probability"].empty() ? -1 : atoi((**br)["probability"].c_str());
pbr.precedence = (**br)["precedence"].empty() ? 0 : atoi((**br)["precedence"].c_str());
@ -927,11 +927,6 @@ void terrain_builder::build_terrains()
const building_rule& rule = r->second;
if (rule.location_constraints.valid()) {
apply_rule(rule, rule.location_constraints);
continue;
}
// Find the constraint that contains the less terrain of all terrain rules.
// We will keep a track of the matching terrains of this constraint
// and later try to apply the rule only on them