mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Add network thread termination logic for adventure map animations
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/TerrainHandler.h"
|
||||
#include "../../lib/UnlockGuard.h"
|
||||
#include "../../lib/mapObjectConstructors/CObjectClassesHandler.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../../lib/mapObjects/ObjectTemplate.h"
|
||||
@@ -36,13 +35,19 @@ bool CMapHandler::hasOngoingAnimations()
|
||||
|
||||
void CMapHandler::waitForOngoingAnimations()
|
||||
{
|
||||
while(CGI->mh->hasOngoingAnimations())
|
||||
for(auto * observer : observers)
|
||||
{
|
||||
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
|
||||
if (observer->hasOngoingAnimations())
|
||||
observer->waitForOngoingAnimations();
|
||||
}
|
||||
}
|
||||
|
||||
void CMapHandler::endNetwork()
|
||||
{
|
||||
for(auto * observer : observers)
|
||||
observer->endNetwork();
|
||||
}
|
||||
|
||||
std::string CMapHandler::getTerrainDescr(const int3 & pos, bool rightClick) const
|
||||
{
|
||||
const TerrainTile & t = map->getTile(pos);
|
||||
|
||||
Reference in New Issue
Block a user