1 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #include "playerlist.h"
23 #include "stacklist.h"
25 #include "GraphicsCache.h"
34 void ArmyMap::draw_stacks()
36 GraphicsCache *gc = GraphicsCache::getInstance();
38 // Draw stacks as tiny shields
39 for (Playerlist::iterator pit = Playerlist::getInstance()->begin();
40 pit != Playerlist::getInstance()->end(); pit++)
42 Stacklist* mylist = (*pit)->getStacklist();
43 Gdk::Color cross_color = (*pit)->getColor();
45 for (Stacklist::iterator it= mylist->begin(); it != mylist->end(); it++)
47 Vector<int> pos = (*it)->getPos();
49 // don't draw stacks in cities, they could hardly be identified
50 Maptile* mytile = GameMap::getInstance()->getTile(pos.x, pos.y);
51 if (mytile->getBuilding() == Maptile::CITY)
54 // don't draw stacks on tiles we can't see
55 if (Playerlist::getViewingplayer()->getFogMap()->isFogged (pos) == true)
58 PixMask *tmp = gc->getShieldPic(1, (*it)->getOwner());
60 PixMask::scale(tmp, tmp->get_width()/2, tmp->get_height()/2);
62 pos = mapToSurface(pos);
63 tmp->blit_centered(surface, pos);
69 void ArmyMap::after_draw()
74 map_changed.emit(surface);