Exemplo n.º 1
0
void Kingdoms::Init(void)
{
    const Colors colors(Settings::Get().GetPlayers().GetColors());

    clear();

    for(Colors::const_iterator
	it = colors.begin(); it != colors.end(); ++it)
	GetKingdom(*it).Init(*it);
}
Exemplo n.º 2
0
    void Redraw(void) const
    {
	for(Colors::const_iterator
    	    it = colors.begin(); it != colors.end(); ++it)
	{
	    const Rect & pos = positions[std::distance(colors.begin(), it)];

	    AGG::GetICN(ICN::CELLWIN, 43 + Color::GetIndex(*it)).Blit(pos);
	    if(recipients & *it)
		AGG::GetICN(ICN::CELLWIN, 2).Blit(pos.x + 2, pos.y + 2);
	}
    }
Exemplo n.º 3
0
    SelectRecipientsColors(const Point & pos) :
	colors(Settings::Get().GetPlayers().GetColors() & ~Settings::Get().GetPlayers().current_color), recipients(0)
    {
	positions.reserve(colors.size());

	for(Colors::const_iterator
    	    it = colors.begin(); it != colors.end(); ++it)
	{
    	    const u8 current = std::distance(colors.begin(), it);
	    const Sprite & sprite = AGG::GetICN(ICN::CELLWIN, 43);

    	    positions.push_back(Rect(pos.x + Game::GetStep4Player(current, sprite.w() + 15, colors.size()),
									    pos.y, sprite.w(), sprite.h()));
	}
    }
Exemplo n.º 4
0
int getcolorpair(int fg, int bg)
{
  typedef std::map<std::pair<int, int>, int> Colors;
  static Colors c;

  Colors::const_iterator i;
  if ((i = c.find(std::make_pair(fg, bg))) != c.end())
    return i->second;

  if ((int) c.size() >= COLOR_PAIRS) {
    g_warning(_("Color pairs limit exceeded."));
    return 0;
  }

  if (init_pair(c.size() + 1, fg, bg) == ERR)
    return 0;
  int res = COLOR_PAIR(c.size() + 1);
  c[std::make_pair(fg, bg)] = res;
  return res;
}