CitySelectDlg::CitySelectDlg(QString str1,QString str2,QString str3):ZPopup()
{
    setTitle(str1);
    listBox = new ZListBox("%I%M",this);
    
    // insert menu items with images from SysRegistry
    ZConfig config ( getAppDir() + "cities.ini", false );
    QStringList grouplist;
    config.getGroupsKeyList ( grouplist );
    QString cityCode = "";
    
    for ( QStringList::Iterator it = grouplist.begin(); it != grouplist.end(); ++it ) 
    {
        cityCode = config.readEntry(*it, "Code", "");
        City *city = new City(listBox);
        qDebug(*it);
        qDebug(cityCode);
        city->setName(*it);
        city->setCode(cityCode);
        
        listBox->insertItem(city);
        city->appendSubItem(1,ctr(city->getName()));
        
    }
    
    insertChild(listBox);
    setSoftkeyText(str2,str3);
    connect(this,SIGNAL(leftSoftkeyClicked()),this,SLOT(slotSelected()));
    connect(listBox,SIGNAL(returnPressed(ZSettingItem *)),this,SLOT(slotItemClicked(ZSettingItem *)));
    
}
Exemple #2
0
int City::operator == (const City& city){

	if(name == city.getName() && country == city.getCountry())
	{
		return 1;
	}
	else
	{
		return 0;
		
	}
}
Exemple #3
0
void MagicView::draw()
{
  Gfx::draw(background, 0, 0);
  
  //draw gems of enemy wizards
  s16 c = 0;
  for (auto r : *player->getRelations())
  {
    if (r.second->isDiscovered())
    {
      if (r.first->isAlive())
      {
        const auto& wizardGfx = GfxData::wizardGfxSpec(r.first->wizard.ident);
        Gfx::draw(wizardGfx.getGemmedPortrait(r.first->color), 24+77*c, 4);
      }
      else
        Gfx::draw(gem_shattered, 24+77*c, 4);
    }
    else
      Gfx::draw(gem_undiscovered, 24+77*c, 4);
    
    ++c;
  }
  
  while (c < 4)
    Gfx::draw(gem_undiscovered, 24+77*c++, 4);

  // draw global spells
  s16 yy = 60;
  for (auto cast : player->getSpells())
  {
    Fonts::drawString(i18n::s(cast.spell->name), FontFaces::Medium::BLACK, 169, yy, ALIGN_LEFT);
    yy += 8;
  }
  
  // draw mana wands
  const s16 wand_x[] = { 29, 28+47, 28+47*2 };
  const s16 wand_head_adjust[][2] = {{-2,-2},{-1,-4},{-1,-2}};
  for (int i = 0; i < 3; ++i)
  {
    s16 sx = wand_x[i], sy = 83 + 70;
    float percent = dests[i].v;
    
    Gfx::draw(wands[i][0], sx, sy - wands[i][0].sh());
    
    if (dests[i].locked)
      Gfx::draw(wands[i][2], sx + wand_head_adjust[i][0], sy + wand_head_adjust[i][1] - wands[i][0].sh());
    
    s16 max = 51;
    s16 emptyPixels = (int)(max*(1-percent));
    s16 fullPixels = max-emptyPixels;
    Gfx::drawClipped(wands[i][1], sx+4 - (i == 0 ? 1 : 0), sy-fullPixels, 0, emptyPixels, 6, fullPixels);
  }
  
  // draw ratio values
  // TODO: check if alignment is correct from right
  Fonts::setFace(FontFaces::Medium::BLUE_MAGIC);
  
  s16 baseX = 55;
  
  Fonts::drawString("MP", baseX, 159, ALIGN_RIGHT);
  Fonts::drawString(to_string(player->manaRatio(0)), baseX-14, 159, ALIGN_RIGHT);
  
  if (player->book()->getCurrentResearch())
  {
    Fonts::drawString(to_string(player->researchPoints()), baseX+47-14, 159, ALIGN_RIGHT);
    Fonts::drawString("RP", baseX+47, 159, ALIGN_RIGHT);
  }
  else
    Fonts::drawString("No Spell", baseX+47-3, 159, ALIGN_RIGHT);
  
  Fonts::drawString("SP", baseX+47*2, 159, ALIGN_RIGHT);
  Fonts::drawString(to_string(player->manaRatio(2)), baseX+47*2-14, 159, ALIGN_RIGHT);
  
  // draw misc text info on lower left
  // TODO: font is slightly different: some pixels on edges are missing
  baseX = 91;
  
  Fonts::setFace(FontFaces::Small::BLUE_MAGIC);
  Fonts::setHorSpace(1);
  Fonts::drawString("Casting Skill:", 4, 176, ALIGN_LEFT);
  Fonts::drawString(Fonts::format("%d(%d)", player->castingSkill(), player->castingSkillBase()), baseX, 176, ALIGN_RIGHT);
  
  Fonts::drawString("Magic Reserve:", 4, 176+8, ALIGN_LEFT);
  Fonts::drawString(to_string(player->totalManaPool()), baseX, 176+8, ALIGN_RIGHT);
  
  Fonts::drawString("Power Base:", 4, 176+8*2, ALIGN_LEFT);
  Fonts::drawString(to_string(player->getManaGain()), baseX, 176+8*2, ALIGN_RIGHT);
  
  Fonts::drawString("Casting:", 99, 176, ALIGN_LEFT);
  Fonts::drawString("None", 155, 176, ALIGN_LEFT);
  
  Fonts::drawString("Researching:", 99, 176+8, ALIGN_LEFT);
  const Spell* spell = player->book()->getCurrentResearch();
  Fonts::drawString(spell ? i18n::s(spell->name) : "None", 155, 176+8, ALIGN_LEFT);
  
  Fonts::drawString("Summon To:", 99, 176+8*2, ALIGN_LEFT);
  City* summonCity = player->cityWithSummoningCircle();
  Fonts::drawString(summonCity ? summonCity->getName() : "None", 155, 176+8*2, ALIGN_LEFT);
}