Pārlūkot izejas kodu

Fixed CID 1197516

AlexVinS 9 gadi atpakaļ
vecāks
revīzija
abe4beebc6

+ 1 - 1
client/CPlayerInterface.cpp

@@ -87,7 +87,7 @@ CPlayerInterface * LOCPLINT;
 CBattleInterface * CPlayerInterface::battleInt;
 
 enum  EMoveState {STOP_MOVE, WAITING_MOVE, CONTINUE_MOVE, DURING_MOVE};
-CondSh<EMoveState> stillMoveHero; //used during hero movement
+CondSh<EMoveState> stillMoveHero(STOP_MOVE); //used during hero movement
 
 int CPlayerInterface::howManyPeople = 0;
 

+ 1 - 1
client/battle/CBattleInterface.cpp

@@ -46,7 +46,7 @@
  *
  */
 
-CondSh<bool> CBattleInterface::animsAreDisplayed;
+CondSh<bool> CBattleInterface::animsAreDisplayed(false);
 
 static void onAnimationFinished(const CStack *stack, CCreatureAnimation *anim)
 {

+ 1 - 1
client/gui/CGuiHandler.cpp

@@ -16,7 +16,7 @@
 extern std::queue<SDL_Event> events;
 extern boost::mutex eventsM;
 
-CondSh<bool> CGuiHandler::terminate_cond;
+CondSh<bool> CGuiHandler::terminate_cond(false);
 boost::thread_specific_ptr<bool> inGuiThread;
 
 SObjectConstruction::SObjectConstruction(CIntObject *obj)

+ 3 - 4
lib/CondSh.h

@@ -17,15 +17,14 @@ template <typename T> struct CondSh
 	boost::condition_variable cond;
 	boost::mutex mx;
 
-	CondSh() {}
 	CondSh(T t) : data(t) {}
 
 	// set data
 	void set(T t)
 	{
-		boost::unique_lock<boost::mutex> lock(mx); 
+		boost::unique_lock<boost::mutex> lock(mx);
 		data = t;
-	} 
+	}
 
 	// set data and notify
 	void setn(T t)
@@ -37,7 +36,7 @@ template <typename T> struct CondSh
 	// get stored value
 	T get()
 	{
-		boost::unique_lock<boost::mutex> lock(mx); 
+		boost::unique_lock<boost::mutex> lock(mx);
 		return data;
 	}
 

+ 1 - 1
server/CGameHandler.cpp

@@ -75,7 +75,7 @@ private:
 	mutable CGameHandler * gh;
 };
 
-CondSh<bool> battleMadeAction;
+CondSh<bool> battleMadeAction(false);
 CondSh<BattleResult *> battleResult(nullptr);
 template <typename T> class CApplyOnGH;