fixed warnings and errors under VC++

This commit is contained in:
Dave White 2004-05-15 16:34:53 +00:00
parent f8226791d9
commit 23b1d427b5
4 changed files with 29 additions and 19 deletions

View file

@ -183,6 +183,11 @@ Defeat
y={Y}
type=Orcish Grunt
[/unit]
[print]
id=ambushed
red,green,blue=255,0,0
size=32
[/print]
[/event]
#enddef
@ -218,6 +223,11 @@ Defeat
y={Y}
type=Orcish Archer
[/unit]
[print]
id=ambushed
red,green,blue=255,0,0
size=16
[/print]
[/event]
#enddef

View file

@ -329,15 +329,14 @@ bool terrain_builder::rule_matches(const terrain_builder::building_rule &rule, c
if(!map_.get_terrain_info(tloc).matches(cons->second.terrain_types))
return false;
for(std::vector<std::string>::const_iterator itor = cons->second.no_flag.begin();
itor != cons->second.no_flag.end(); itor++) {
std::vector<std::string>::const_iterator itor;
for(itor = cons->second.no_flag.begin(); itor != cons->second.no_flag.end(); ++itor) {
//If a flag listed in "no_flag" is present, the rule does not match
if(btile.flags.find(*itor) != btile.flags.end())
return false;
}
for(std::vector<std::string>::const_iterator itor = cons->second.has_flag.begin();
itor != cons->second.has_flag.end(); itor++) {
for(itor = cons->second.has_flag.begin(); itor != cons->second.has_flag.end(); ++itor) {
//If a flag listed in "has_flag" is not present, this rule does not match
if(btile.flags.find(*itor) == btile.flags.end())
@ -384,8 +383,8 @@ void terrain_builder::build_terrains()
{
std::cerr << "Built terrain rules: \n";
for(building_ruleset::const_iterator rule = building_rules_.begin();
rule != building_rules_.end(); ++rule) {
building_ruleset::const_iterator rule;
for(rule = building_rules_.begin(); rule != building_rules_.end(); ++rule) {
std::cerr << ">> New rule: image_background = " << rule->image_background << " , image_foreground = "<< rule->image_foreground << "\n";
for(building_rule::constraint_set::const_iterator constraint = rule->constraints.begin();
constraint != rule->constraints.end(); ++constraint) {
@ -417,8 +416,7 @@ void terrain_builder::build_terrains()
}
}
for(building_ruleset::const_iterator rule = building_rules_.begin();
rule != building_rules_.end(); ++rule) {
for(rule = building_rules_.begin(); rule != building_rules_.end(); ++rule) {
//find a constraint that contains an unique terrain type on the current
//rule

View file

@ -37,7 +37,6 @@ public:
// regenerate the generated content at the given location.
void rebuild_terrain(const gamemap::location &loc);
private:
struct terrain_constraint
{
terrain_constraint() : loc() {};
@ -51,6 +50,8 @@ private:
std::vector<std::string> has_flag;
};
private:
struct building_rule
{
typedef std::map<gamemap::location, terrain_constraint> constraint_set;

View file

@ -132,29 +132,30 @@ namespace image {
bool locator::operator==(const locator& a) const
{
if(a.type != type)
if(a.type != type) {
return false;
if(type == FILE)
} else if(type == FILE) {
return filename == a.filename;
if(type == SUB_FILE)
} else if(type == SUB_FILE) {
return filename == a.filename && loc == a.loc;
} else {
return false;
}
}
bool locator::operator<(const locator &a) const
{
if(type != a.type)
if(type != a.type) {
return type < a.type;
if(type == FILE)
} else if(type == FILE) {
return filename < a.filename;
if(type == SUB_FILE) {
} else if(type == SUB_FILE) {
if(filename != a.filename)
return filename < a.filename;
return loc < a.loc;
} else {
return false;
}
}