mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 13:03:54 +00:00
made it so flags are overlayed on top of villages properly
This commit is contained in:
parent
ec575167cb
commit
e6de57e79a
@ -68,7 +68,7 @@ green=200
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=flag
|
||||
image=flag-neutral
|
||||
name=village
|
||||
char=t
|
||||
red=200
|
||||
@ -80,7 +80,7 @@ no_overlay=true
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=flag-cave
|
||||
image=flag-cave-neutral
|
||||
name=underground village
|
||||
char=D
|
||||
aliasof=t
|
||||
|
@ -918,7 +918,13 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image,
|
||||
std::vector<SDL_Surface*> overlaps;
|
||||
|
||||
if(!is_shrouded) {
|
||||
overlaps = getAdjacentTerrain(x,y,image_type);
|
||||
SDL_Surface* const flag = getFlag(terrain,x,y);
|
||||
if(flag != NULL)
|
||||
overlaps.push_back(flag);
|
||||
|
||||
const std::vector<SDL_Surface*>& adj = getAdjacentTerrain(x,y,image_type);
|
||||
|
||||
overlaps.insert(overlaps.end(),adj.begin(),adj.end());
|
||||
|
||||
typedef std::multimap<gamemap::location,std::string>::const_iterator
|
||||
Itor;
|
||||
@ -1430,23 +1436,6 @@ SDL_Surface* display::getTerrain(gamemap::TERRAIN terrain,image::TYPE image_type
|
||||
map_.get_terrain_info(terrain).image(x,y) :
|
||||
map_.get_terrain_info(terrain).default_image());
|
||||
|
||||
if(tower) {
|
||||
|
||||
size_t i;
|
||||
for(i = 0; i != teams_.size(); ++i) {
|
||||
if(teams_[i].owns_tower(gamemap::location(x,y)) && (!fogged(x,y) || i == currentTeam_)) {
|
||||
char buf[50];
|
||||
sprintf(buf,"-team%d",i+1);
|
||||
image += buf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(i == teams_.size()) {
|
||||
image += "-neutral";
|
||||
}
|
||||
}
|
||||
|
||||
if(terrain == gamemap::CASTLE &&
|
||||
map_.is_starting_position(gamemap::location(x,y))) {
|
||||
image = "terrain/keep";
|
||||
@ -1473,6 +1462,25 @@ SDL_Surface* display::getTerrain(gamemap::TERRAIN terrain,image::TYPE image_type
|
||||
return im;
|
||||
}
|
||||
|
||||
SDL_Surface* display::getFlag(gamemap::TERRAIN terrain, int x, int y)
|
||||
{
|
||||
const bool village = (map_.underlying_terrain(terrain) == gamemap::TOWER);
|
||||
if(!village)
|
||||
return NULL;
|
||||
|
||||
const gamemap::location loc(x,y);
|
||||
|
||||
for(size_t i = 0; i != teams_.size(); ++i) {
|
||||
if(teams_[i].owns_tower(loc) && (!fogged(x,y) || i == currentTeam_)) {
|
||||
char buf[50];
|
||||
sprintf(buf,"terrain/flag-team%d.png",i+1);
|
||||
return image::get_image(buf);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void display::blit_surface(int x, int y, SDL_Surface* surface)
|
||||
{
|
||||
SDL_Surface* const target = video().getSurface();
|
||||
|
@ -276,6 +276,8 @@ private:
|
||||
SDL_Surface* getTerrain(gamemap::TERRAIN, image::TYPE type,
|
||||
int x, int y, const std::string& dir="");
|
||||
|
||||
SDL_Surface* getFlag(gamemap::TERRAIN, int x, int y);
|
||||
|
||||
SDL_Surface* getMinimap(int w, int h);
|
||||
|
||||
void clearImageCache();
|
||||
|
Loading…
x
Reference in New Issue
Block a user