浏览代码

Merge branch 'develop' of https://github.com/vcmi/vcmi into develop

DjWarmonger 10 年之前
父节点
当前提交
a736a863da
共有 4 个文件被更改,包括 13 次插入7 次删除
  1. 1 1
      client/widgets/Buttons.cpp
  2. 6 4
      client/windows/CAdvmapInterface.cpp
  3. 1 1
      client/windows/CQuestLog.cpp
  4. 5 1
      server/CGameHandler.cpp

+ 1 - 1
client/widgets/Buttons.cpp

@@ -424,7 +424,7 @@ void CToggleGroup::addToggle(int identifier, CToggleBase* bt)
 }
 
 CToggleGroup::CToggleGroup(const CFunctionList<void(int)> &OnChange, bool musicLikeButtons)
-: onChange(OnChange), musicLike(musicLikeButtons), selectedID(-1)
+: onChange(OnChange), selectedID(-1), musicLike(musicLikeButtons)
 {}
 
 void CToggleGroup::setSelected(int id)

+ 6 - 4
client/windows/CAdvmapInterface.cpp

@@ -1192,7 +1192,8 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
 
 			CGPath &path = LOCPLINT->paths[h];
 			terrain.currentPath = &path;
-			if(!LOCPLINT->cb->getPathsInfo(h)->getPath(h->getPosition(false) + dir, path))
+			int3 dst = h->getPosition(false) + dir;
+			if(dst != verifyPos(dst) || !LOCPLINT->cb->getPathsInfo(h)->getPath(dst, path))
 			{
 				terrain.currentPath = nullptr;
 				return;
@@ -1604,9 +1605,10 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
 				{
 					const CGGarrison* garrObj = dynamic_cast<const CGGarrison*>(objAtTile); //TODO evil evil cast!
 
-					// Show battle cursor for guarded enemy garrisons, otherwise movement cursor.
-					if (garrObj  &&  garrObj->stacksCount()
-						&& !LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, garrObj->tempOwner) )
+					// Show battle cursor for guarded enemy garrisons or garrisons have guarding creature behind, otherwise movement cursor.
+					if (garrObj  &&  ((garrObj->stacksCount()
+						&& !LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, garrObj->tempOwner))
+						|| guardingCreature))
 						CCS->curh->changeGraphic(ECursor::ADVENTURE, 5 + turns*6);
 					else
 						CCS->curh->changeGraphic(ECursor::ADVENTURE, 9 + turns*6);

+ 1 - 1
client/windows/CQuestLog.cpp

@@ -120,8 +120,8 @@ CQuestLog::CQuestLog (const std::vector<QuestInfo> & Quests) :
 	questIndex(0),
 	currentQuest(nullptr),
 	componentsBox(nullptr),
-	quests (Quests),
 	hideComplete(false),
+	quests(Quests),	
 	slider(nullptr)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;

+ 5 - 1
server/CGameHandler.cpp

@@ -1747,7 +1747,11 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, Pl
 		tmh.result = result;
 		sendAndApply(&tmh);
 
-		if(lookForGuards == CHECK_FOR_GUARDS && this->isInTheMap(guardPos))
+		if (visitDest == VISIT_DEST && t.topVisitableObj() && t.topVisitableObj()->id == h->id)
+		{ // Hero should be always able to visit any object he staying on even if there guards around
+			visitObjectOnTile(t, h);
+		}
+		else if(lookForGuards == CHECK_FOR_GUARDS && this->isInTheMap(guardPos))
 		{
 			tmh.attackedFrom = guardPos;