1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Fixed fighting guardians of Dwellings (and other objs as well).

Most of creature generators should work fine.
This commit is contained in:
Michał W. Urbańczyk
2009-07-20 23:34:06 +00:00
parent ec3b254c83
commit 9206a13390
8 changed files with 79 additions and 59 deletions

View File

@@ -1025,12 +1025,7 @@ void CPlayerInterface::receivedResource(int type, int val)
void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16>& skills, boost::function<void(ui32)> &callback)
{
{
boost::unique_lock<boost::mutex> un(showingDialog->mx);
while(showingDialog->data)
showingDialog->cond.wait(un);
}
waitWhileDialog();
CGI->soundh->playSound(soundBase::heroNewLevel);
boost::unique_lock<boost::recursive_mutex> un(*pim);
@@ -1378,12 +1373,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector<SComponent*> & components, int soundID)
{
{
boost::unique_lock<boost::mutex> un(showingDialog->mx);
while(showingDialog->data)
showingDialog->cond.wait(un);
}
waitWhileDialog();
boost::unique_lock<boost::recursive_mutex> un(*pim);
if(stillMoveHero.get() == DURING_MOVE)//if we are in the middle of hero movement
@@ -1424,6 +1414,7 @@ void CPlayerInterface::showYesNoDialog(const std::string &text, const std::vecto
void CPlayerInterface::showBlockingDialog( const std::string &text, const std::vector<Component> &components, ui32 askID, int soundID, bool selection, bool cancel )
{
waitWhileDialog();
boost::unique_lock<boost::recursive_mutex> un(*pim);
CGI->soundh->playSound(static_cast<soundBase::soundID>(soundID));
@@ -1734,6 +1725,7 @@ const CGHeroInstance * CPlayerInterface::getWHero( int pos )
void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, int level)
{
waitWhileDialog();
std::vector<std::pair<int,int> > cres;
for(int i = 0; i < dwelling->creatures.size(); i++)
{
@@ -1745,6 +1737,13 @@ void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, int lev
pushInt(cr);
}
void CPlayerInterface::waitWhileDialog()
{
boost::unique_lock<boost::mutex> un(showingDialog->mx);
while(showingDialog->data)
showingDialog->cond.wait(un);
}
void SystemOptions::setMusicVolume( int newVolume )
{
musicVolume = newVolume;