1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

Reverted r731

This commit is contained in:
Michał W. Urbańczyk
2009-02-14 14:37:13 +00:00
parent 96a7e1600b
commit 9dbe9bd277
10 changed files with 888 additions and 866 deletions

View File

@ -1947,7 +1947,6 @@ void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, int pskill, std:
showingDialog->cond.wait(un);
}
boost::unique_lock<boost::recursive_mutex> un(*pim);
LOCPLINT->showingDialog->setn(true);
CLevelWindow *lw = new CLevelWindow(hero,pskill,skills,callback);
curint->deactivate();
lw->activate();
@ -2101,6 +2100,7 @@ void CPlayerInterface::actionStarted(const BattleAction* action)
battleInt->defendingHero->setPhase(4);
else
battleInt->attackingHero->setPhase(4);
return;
}
if(!stack)
{
@ -3582,18 +3582,17 @@ void CLevelWindow::close()
}
delete this;
LOCPLINT->curint->activate();
LOCPLINT->showingDialog->setn(false);
}
CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback)
{
LOCPLINT->showingDialog->setn(true);
heroType = hero->subID;
cb = callback;
for(int i=0;i<skills.size();i++)
comps.push_back(new CSelectableComponent(SComponent::secskill44,skills[i],hero->getSecSkillLevel(skills[i])+1,boost::bind(&CLevelWindow::selectionChanged,this,i)));
if(comps.size())
{
comps[0]->assignedKeys.insert(SDLK_1);
if(comps.size() > 1)
comps[1]->assignedKeys.insert(SDLK_2);
comps.push_back(new CSelectableComponent(SComponent::secskill44,skills[i],hero->getSecSkillLevel(skills[i])+1,boost::bind(&CLevelWindow::selectionChanged,this,i)));
comps.back()->assignedKeys.insert(SDLK_1 + i);
}
bitmap = BitmapHandler::loadBitmap("LVLUPBKG.bmp");
graphics->blueToPlayersAdv(bitmap,hero->tempOwner);
@ -3603,7 +3602,6 @@ CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<u
pos.w = bitmap->w;
pos.h = bitmap->h;
ok = new AdventureMapButton("","",boost::bind(&CLevelWindow::close,this),pos.x+297,pos.y+413,"IOKAY.DEF",SDLK_RETURN);
ok->block(true);
//draw window
char buf[100], buf2[100];
strcpy(buf2,CGI->generaltexth->allTexts[444].c_str()); //%s has gained a level.
@ -3631,6 +3629,16 @@ CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<u
curx += ort->w + 18;
}
}
if(comps.size() > 1)
{
ok->block(true);
}
else if(comps.size() == 1)
{
comps[0]->select(true);
}
SDL_FreeSurface(ort);
}