mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
* Probably fixed #655.
* Fixed #736, #737. * Fixed crash on loss/victory. * Fixed crash on loading some AB maps. * Fixed crash on loading map where victory/loss condition objective hero was placed inside the town. * Fixed crash on loading map when neutral Dungeon has built Portal of Summoning. * Mutex protecting GS will be used to prevent changes in GS when GUI might read it. * Little more securities around moving hero and ending turn, still needed more.
This commit is contained in:
@ -81,8 +81,9 @@ public:
|
||||
void applyOnGS(CGameState *gs, void *pack) const
|
||||
{
|
||||
T *ptr = static_cast<T*>(pack);
|
||||
while(!gs->mx->try_lock())
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(50)); //give other threads time to finish
|
||||
gs->mx->lock();
|
||||
// while(!gs->mx->try_lock())
|
||||
// boost::this_thread::sleep(boost::posix_time::milliseconds(1)); //give other threads time to finish
|
||||
ptr->applyGs(gs);
|
||||
gs->mx->unlock();
|
||||
}
|
||||
@ -1577,6 +1578,9 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
map->checkForObjectives(); //needs to be run when all objects are properly placed
|
||||
}
|
||||
|
||||
int CGameState::battleGetBattlefieldType(int3 tile)
|
||||
@ -2002,7 +2006,6 @@ bool CGameState::getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath
|
||||
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int3 src, int movement)
|
||||
{
|
||||
assert(hero);
|
||||
boost::shared_lock<boost::shared_mutex> lock(*mx);
|
||||
if(src.x < 0)
|
||||
src = hero->getPosition(false);
|
||||
if(movement < 0)
|
||||
|
Reference in New Issue
Block a user