1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Made gamestate lock static

This commit is contained in:
AlexVinS
2017-06-14 07:59:41 +03:00
parent cf60aa61b0
commit 86f9df5f68
7 changed files with 9 additions and 15 deletions

View File

@ -45,6 +45,8 @@
*
*/
boost::shared_mutex CGameState::mutex;
template <typename T> class CApplyOnGS;
class CBaseForGSApply
@ -65,7 +67,7 @@ public:
{
T *ptr = static_cast<T*>(pack);
boost::unique_lock<boost::shared_mutex> lock(*gs->mx);
boost::unique_lock<boost::shared_mutex> lock(CGameState::mutex);
ptr->applyGs(gs);
}
};
@ -675,7 +677,6 @@ int CGameState::getDate(Date::EDateType mode) const
CGameState::CGameState()
{
gs = this;
mx = new boost::shared_mutex();
applierGs = new CApplier<CBaseForGSApply>;
registerTypesClientPacks1(*applierGs);
registerTypesClientPacks2(*applierGs);
@ -687,7 +688,6 @@ CGameState::CGameState()
CGameState::~CGameState()
{
//delete mx;//TODO: crash on Linux (mutex must be unlocked before destruction)
map.dellNull();
curB.dellNull();
//delete scenarioOps; //TODO: fix for loading ind delete