瀏覽代碼

Fixed #728.
Fixed issue with game loading.
Minor fixes.

Michał W. Urbańczyk 14 年之前
父節點
當前提交
072bb5884b
共有 5 個文件被更改,包括 15 次插入5 次删除
  1. 9 3
      client/CBattleInterface.cpp
  2. 1 0
      client/CBattleInterface.h
  3. 1 1
      lib/CObjectHandler.cpp
  4. 2 1
      lib/ERMInterpreter.cpp
  5. 2 0
      lib/IGameCallback.cpp

+ 9 - 3
client/CBattleInterface.cpp

@@ -1108,8 +1108,14 @@ CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSe
 	pos = myRect;
 	strongInterest = true;
 	givenCommand = new CondSh<BattleAction *>(NULL);
-	tacticsMode = curInt->cb->battleGetTacticDist();
-	
+
+	if(attackerInt && attackerInt->cb->battleGetTacticDist()) //hotseat -> check tactics for both players (defender may be local human)
+		tacticianInterface = attackerInt;
+	else if(defenderInt && defenderInt->cb->battleGetTacticDist()) 
+		tacticianInterface = defenderInt;
+
+	tacticsMode = tacticianInterface;  //if we found interface of player with tactics, then enter tactics mode
+
 	//create stack queue
 	bool embedQueue = screen->h < 700;
 	queue = new CStackQueue(embedQueue, this);
@@ -3748,7 +3754,7 @@ static bool immobile(const CStack *s)
 
 void CBattleInterface::bTacticNextStack()
 {
-	TStacks stacksOfMine = curInt->cb->battleGetStacks(CBattleCallback::ONLY_MINE);
+	TStacks stacksOfMine = tacticianInterface->cb->battleGetStacks(CBattleCallback::ONLY_MINE);
 	stacksOfMine.erase(std::remove_if(stacksOfMine.begin(), stacksOfMine.end(), &immobile), stacksOfMine.end());
 	TStacks::iterator it = vstd::find(stacksOfMine, activeStack);
 	if(it != stacksOfMine.end() && ++it != stacksOfMine.end())

+ 1 - 0
client/CBattleInterface.h

@@ -422,6 +422,7 @@ private:
 	float getAnimSpeedMultiplier() const; //returns multiplier for number of frames in a group
 	std::map<int, int> standingFrame; //number of frame in standing animation by stack ID, helps in showing 'random moves'
 
+	CPlayerInterface *tacticianInterface; //used during tactics mode, points to the interface of player with higher tactics (can be either attacker or defender in hot-seat), valid onloy for human players
 	bool tacticsMode;
 	bool spellDestSelectMode; //if true, player is choosing destination for his spell
 	int spellSelMode; //0 - any location, 1 - any friendly creature, 2 - any hostile creature, 3 - any creature,

+ 1 - 1
lib/CObjectHandler.cpp

@@ -1494,7 +1494,7 @@ void CGHeroInstance::deserializationFix()
 		if(i->second.artifact && !i->second.locked)
 			attachTo(i->second.artifact);
 
-	attachTo(&speciality);
+	//attachTo(&speciality);
 }
 
 CBonusSystemNode * CGHeroInstance::whereShouldBeAttached(CGameState *gs)

+ 2 - 1
lib/ERMInterpreter.cpp

@@ -2254,7 +2254,8 @@ std::string IexpValStr::getName() const
 	{
 		return "Literal " + boost::lexical_cast<std::string>(getInt());
 	}
-
+	else
+		return "Unknown variable";
 }
 
 void ERMInterpreter::init()

+ 2 - 0
lib/IGameCallback.cpp

@@ -1175,6 +1175,8 @@ const CGHeroInstance* CGameInfoCallback::getHeroWithSubid( int subid ) const
 	BOOST_FOREACH(const CGHeroInstance *h, gs->map->heroes)
 		if(h->subID == subid)
 			return h;
+
+	return NULL;
 }