mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Removed optional locking in waitWhileDialog method
This commit is contained in:
parent
d6b9fa8fbd
commit
0dcfd6e65c
@ -1331,7 +1331,7 @@ void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, const C
|
||||
GH.windows().createAndPushWindow<CRecruitmentWindow>(dwelling, level, dst, recruitCb);
|
||||
}
|
||||
|
||||
void CPlayerInterface::waitWhileDialog(bool unlockPim)
|
||||
void CPlayerInterface::waitWhileDialog()
|
||||
{
|
||||
if (GH.amIGuiThread())
|
||||
{
|
||||
@ -1339,7 +1339,7 @@ void CPlayerInterface::waitWhileDialog(bool unlockPim)
|
||||
return;
|
||||
}
|
||||
|
||||
auto unlock = vstd::makeUnlockGuardIf(GH.interfaceMutex, unlockPim);
|
||||
auto unlock = vstd::makeUnlockGuard(GH.interfaceMutex);
|
||||
boost::unique_lock<boost::mutex> un(showingDialog->mx);
|
||||
while(showingDialog->data)
|
||||
showingDialog->cond.wait(un);
|
||||
@ -1811,14 +1811,14 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
||||
artWin->artifactDisassembled(al);
|
||||
}
|
||||
|
||||
void CPlayerInterface::waitForAllDialogs(bool unlockPim)
|
||||
void CPlayerInterface::waitForAllDialogs()
|
||||
{
|
||||
while(!dialogs.empty())
|
||||
{
|
||||
auto unlock = vstd::makeUnlockGuardIf(GH.interfaceMutex, unlockPim);
|
||||
auto unlock = vstd::makeUnlockGuard(GH.interfaceMutex);
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(5));
|
||||
}
|
||||
waitWhileDialog(unlockPim);
|
||||
waitWhileDialog();
|
||||
}
|
||||
|
||||
void CPlayerInterface::proposeLoadingGame()
|
||||
|
@ -184,8 +184,8 @@ public: // public interface for use by client via LOCPLINT access
|
||||
|
||||
void showHeroExchange(ObjectInstanceID hero1, ObjectInstanceID hero2);
|
||||
void showArtifactAssemblyDialog(const Artifact * artifact, const Artifact * assembledArtifact, CFunctionList<void()> onYes);
|
||||
void waitWhileDialog(bool unlockPim = true);
|
||||
void waitForAllDialogs(bool unlockPim = true);
|
||||
void waitWhileDialog();
|
||||
void waitForAllDialogs();
|
||||
void openTownWindow(const CGTownInstance * town); //shows townscreen
|
||||
void openHeroWindow(const CGHeroInstance * hero); //shows hero window with given hero
|
||||
|
||||
|
@ -287,6 +287,7 @@ bool ArtifactUtilsClient::askToAssemble(const CGHeroInstance * hero, const Artif
|
||||
{
|
||||
auto askThread = new boost::thread([hero, art, slot, assemblyPossibilities]() -> void
|
||||
{
|
||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||
for(const auto combinedArt : assemblyPossibilities)
|
||||
{
|
||||
bool assembleConfirmed = false;
|
||||
@ -294,7 +295,7 @@ bool ArtifactUtilsClient::askToAssemble(const CGHeroInstance * hero, const Artif
|
||||
onYesHandlers += std::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), hero, slot, true, combinedArt->getId());
|
||||
|
||||
LOCPLINT->showArtifactAssemblyDialog(art->artType, combinedArt, onYesHandlers);
|
||||
LOCPLINT->waitWhileDialog(false);
|
||||
LOCPLINT->waitWhileDialog();
|
||||
if(assembleConfirmed)
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user