浏览代码

Fixed #739 and #742.
Version set to 0.85.

Michał W. Urbańczyk 14 年之前
父节点
当前提交
0dbd7ee3c8
共有 4 个文件被更改,包括 10 次插入4 次删除
  1. 6 1
      client/CBattleInterface.cpp
  2. 1 1
      global.h
  3. 2 1
      lib/IGameCallback.cpp
  4. 1 1
      lib/NetPacks.h

+ 6 - 1
client/CBattleInterface.cpp

@@ -3150,10 +3150,15 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
 		{
 			boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetFightingHero(sc->side)->name);
 		}
-		else
+		else if(sc->attackerType < CGI->creh->creatures.size())
 		{
 			boost::algorithm::replace_first(text, "%s", CGI->creh->creatures[sc->attackerType]->namePl); //creature caster
 		}
+		else
+		{
+			//TODO artifacts that cast spell; scripts some day
+			boost::algorithm::replace_first(text, "Something", CGI->creh->creatures[sc->attackerType]->namePl); //creature caster
+		}
 		boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id]->name);
 		console->addText(text);
 	}

+ 1 - 1
global.h

@@ -34,7 +34,7 @@ typedef si32 TBonusSubtype;
 #define THC
 #endif
 
-#define NAME_VER ("VCMI 0.84d")
+#define NAME_VER ("VCMI 0.85")
 extern std::string NAME; //full name
 extern std::string NAME_AFFIX; //client / server
 #define CONSOLE_LOGGING_LEVEL 5

+ 2 - 1
lib/IGameCallback.cpp

@@ -819,7 +819,8 @@ int3 CGameInfoCallback::getMapSize() const
 std::vector<const CGHeroInstance *> CGameInfoCallback::getAvailableHeroes(const CGObjectInstance * townOrTavern) const
 {
 	std::vector<const CGHeroInstance *> ret;
-	ERROR_RET_VAL_IF(!isOwnedOrVisited(townOrTavern), "Town or tavern must be owned or visited!", ret);
+	//ERROR_RET_VAL_IF(!isOwnedOrVisited(townOrTavern), "Town or tavern must be owned or visited!", ret);
+	//TODO: town needs to be owned, advmap tavern needs to be visited; to be reimplemented when visit tracking is done
 	ret.resize(gs->players[player].availableHeroes.size());
 	std::copy(gs->players[player].availableHeroes.begin(),gs->players[player].availableHeroes.end(),ret.begin());
 	return ret;

+ 1 - 1
lib/NetPacks.h

@@ -1370,7 +1370,7 @@ struct BattleSpellCast : public CPackForClient//3009
 	ui16 tile; //destination tile (may not be set in some global/mass spells
 	std::vector<ui32> resisted; //ids of creatures that resisted this spell
 	std::set<ui32> affectedCres; //ids of creatures affected by this spell, generally used if spell does not set any effect (like dispel or cure)
-	TCreature attackerType;//id of caster to generate console message
+	TCreature attackerType;//id of caster to generate console message; -1 if not set (eg. spell casted by artifact)
 	ui8 castedByHero; //if true - spell has been casted by hero, otherwise by a creature
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{