Overlays are properly drawn at the top row (eg forrest) (bug #10238).

Mountains no longer have a hill as base.
This commit is contained in:
Mark de Wever 2008-01-01 15:07:47 +00:00
parent 5acad317a9
commit bcf51e964e
4 changed files with 22 additions and 13 deletions

View file

@ -3,6 +3,9 @@ Version 1.3.13+svn:
* The Hammer of Thursagan:
* 'Invaders' if there weren't enough free tiles to spawn all indigs the
game would enter an infinite loop (bug #10621)
* graphics:
* overlays are properly drawn at the top row (eg forrest) (bug #10238)
* mountains no longer have a hill as base
* language and i18n:
* updated translations: Chinese, Italian, Lithuanian
* multiplayer:

View file

@ -596,11 +596,6 @@
#{TERRAIN_BASE ~ fog}
#This one is to fill the "gaps" at the map edges. There are no
#non-multihex mountains so hills fit better
{TERRAIN_BASE Mm hills-variation1}
#{CANYON X canyon}
#added ruins

View file

@ -118,24 +118,26 @@ void terrain_builder::tilemap::reset()
bool terrain_builder::tilemap::on_map(const gamemap::location &loc) const
{
if(loc.x < -1 || loc.y < -1 || loc.x > x_ || loc.y > y_)
if(loc.x < -2 || loc.y < -2 || loc.x > (x_ + 1) || loc.y > (y_ + 1)) {
return false;
}
return true;
}
terrain_builder::tile& terrain_builder::tilemap::operator[](const gamemap::location &loc)
{
assert(on_map(loc));
return map_[(loc.x+1) + (loc.y+1)*(x_+2)];
return map_[(loc.x + 2) + (loc.y + 2) * (x_ + 4)];
}
const terrain_builder::tile& terrain_builder::tilemap::operator[] (const gamemap::location &loc) const
{
assert(on_map(loc));
return map_[(loc.x+1) + (loc.y+1)*(x_+2)];
return map_[(loc.x + 2) + (loc.y + 2) * (x_ + 4)];
}
terrain_builder::terrain_builder(const config& cfg, const config& level,
@ -751,7 +753,11 @@ void terrain_builder::parse_config(const config &cfg)
building_ruleset::const_iterator rule;
for(rule = building_rules_.begin(); rule != building_rules_.end(); ++rule) {
std::cerr << ">> New rule: image_background = " /* << rule->second.image_background << " , image_foreground = "<< rule->second.image_foreground */ << "\n";
std::cerr << ">> New rule: image_background = "
<< "\n>> Location " << rule->second.location_constraints
<< "\n>> Probability " << rule->second.probability
<< "\n>> Precedence " << rule->second.precedence << '\n';
for(constraint_set::const_iterator constraint = rule->second.constraints.begin();
constraint != rule->second.constraints.end(); ++constraint) {
@ -868,8 +874,9 @@ void terrain_builder::apply_rule(const terrain_builder::building_rule &rule, con
rule_imagelist::const_iterator img;
const gamemap::location tloc = loc + constraint->second.loc;
if(!tile_map_.on_map(tloc))
if(!tile_map_.on_map(tloc)) {
return;
}
tile& btile = tile_map_[tloc];
@ -895,8 +902,8 @@ void terrain_builder::build_terrains()
log_scope("terrain_builder::build_terrains");
// Builds the terrain_by_type_ cache
for(int x = -1; x <= map_.w(); ++x) {
for(int y = -1; y <= map_.h(); ++y) {
for(int x = -2; x <= map_.w(); ++x) {
for(int y = -2; y <= map_.h(); ++y) {
const gamemap::location loc(x,y);
const t_translation::t_letter t = map_.get_terrain(loc);

View file

@ -341,7 +341,11 @@ private:
/**
* Constructs a tilemap of dimensions x * y
*/
tilemap(int x, int y) : map_((x+2)*(y+2)), x_(x), y_(y) {}
tilemap(int x, int y) :
map_((x + 4) * (y + 4)),
x_(x),
y_(y)
{}
/**
* Returns a reference to the tile which is at the position