Use 100 as default for terrain probability as specified in wiki.

This spare a lot of calls to the RNG because c++ code used -1 as 'no
probability'(=100%), but WML macros use 100
This commit is contained in:
Ali El Gariani 2010-09-02 22:24:58 +00:00
parent e7a81c4ef8
commit b60fa998a3
2 changed files with 3 additions and 3 deletions

View file

@ -773,7 +773,7 @@ void terrain_builder::parse_config(const config &cfg, bool local)
pbr.location_constraints =
map_location(br["x"].to_int() - 1, br["y"].to_int() - 1);
pbr.probability = br["probability"].to_int(-1);
pbr.probability = br["probability"].to_int(100);
// Mapping anchor indices to anchor locations.
anchormap anchors;
@ -912,7 +912,7 @@ bool terrain_builder::rule_matches(const terrain_builder::building_rule &rule,
return false;
}
if(rule.probability != -1) {
if(rule.probability != 100) {
unsigned int random = get_noise(loc, rule.get_hash()) % 100;
if(random > static_cast<unsigned int>(rule.probability)) {
return false;

View file

@ -355,7 +355,7 @@ private:
building_rule() :
constraints(),
location_constraints(),
probability(0),
probability(100),
precedence(0),
local(false),
hash_(DUMMY_HASH)