1
0
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:
Ivan Savenko
2024-05-18 12:15:48 +00:00
parent 9bfe000724
commit d502850054
10 changed files with 36 additions and 8 deletions

View File

@@ -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);