Browse Source

Fixed #607
Support for Admiral's Hat

DjWarmonger 14 years ago
parent
commit
5eef9551de
3 changed files with 15 additions and 2 deletions
  1. 1 0
      client/CPlayerInterface.cpp
  2. 2 0
      client/NetPacksClient.cpp
  3. 12 2
      server/CGameHandler.cpp

+ 1 - 0
client/CPlayerInterface.cpp

@@ -253,6 +253,7 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
 		{
 			if(adventureInt->terrain.currentPath)
 				eraseCurrentPathOf(ho);
+			cb->recalculatePaths();
 			return; //teleport - no fancy moving animation
 					//TODO: smooth disappear / appear effect
 		}

+ 2 - 0
client/NetPacksClient.cpp

@@ -360,7 +360,9 @@ void TryMoveHero::applyCl( CClient *cl )
 	const CGHeroInstance *h = cl->getHero(id);
 
 	if(result == TELEPORTATION  ||  result == EMBARK  ||  result == DISEMBARK)
+	{
 		CGI->mh->printObject(h);
+	}
 
 	if(result == EMBARK)
 		CGI->mh->hideObject(h->boat);

+ 12 - 2
server/CGameHandler.cpp

@@ -1379,7 +1379,12 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
 	if(!h->boat && t.visitableObjects.size() && t.visitableObjects.back()->ID == 8)
 	{
 		tmh.result = TryMoveHero::EMBARK;
-		tmh.movePoints = 0; //embarking takes all move points
+		if (h->hasBonusOfType(Bonus::FREE_SHIP_BOARDING))
+		{
+			tmh.movePoints = (h->movement - cost)*((float)(h->maxMovePoints(true)) / h->maxMovePoints(false));
+		}
+		else
+			tmh.movePoints = 0; //embarking takes all move points
 		//TODO: check for bonus that removes that penalty
 
 		getTilesInRange(tmh.fowRevealed,h->getSightCenter()+(tmh.end-tmh.start),h->getSightRadious(),h->tempOwner,1);
@@ -1390,7 +1395,12 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
 	else if(h->boat && t.tertype != TerrainTile::water && !t.blocked)
 	{
 		tmh.result = TryMoveHero::DISEMBARK;
-		tmh.movePoints = 0; //disembarking takes all move points
+		if (h->hasBonusOfType(Bonus::FREE_SHIP_BOARDING))
+		{
+			tmh.movePoints = (h->movement - cost)*((float)(h->maxMovePoints(false)) / h->maxMovePoints(true));
+		}
+		else
+			tmh.movePoints = 0; //disembarking takes all move points
 		//TODO: check for bonus that removes that penalty
 
 		getTilesInRange(tmh.fowRevealed,h->getSightCenter()+(tmh.end-tmh.start),h->getSightRadious(),h->tempOwner,1);