Michał W. Urbańczyk 18 år sedan
förälder
incheckning
b434479b53
4 ändrade filer med 12 tillägg och 0 borttagningar
  1. 1 0
      CAdvmapInterface.cpp
  2. 2 0
      CCallback.cpp
  3. 7 0
      CGameInterface.cpp
  4. 2 0
      CPathfinder.cpp

+ 1 - 0
CAdvmapInterface.cpp

@@ -1129,6 +1129,7 @@ void CAdvMapInt::centerOn(int3 on)
 
 	LOCPLINT->adventureInt->position.x=on.x;
 	LOCPLINT->adventureInt->position.y=on.y;
+	LOCPLINT->adventureInt->position.z=on.z;
 	LOCPLINT->adventureInt->updateScreen=true;
 }
 CAdvMapInt::CurrentSelection::CurrentSelection()

+ 2 - 0
CCallback.cpp

@@ -215,6 +215,8 @@ bool CCallback::verifyPath(CPath * path, bool blockSea)
 					((CGI->mh->ttiles[path->nodes[i].coord.x][path->nodes[i].coord.y][path->nodes[i].coord.z].terType!=EterrainType::water)
 					&&
 					(CGI->mh->ttiles[path->nodes[i-1].coord.x][path->nodes[i-1].coord.y][path->nodes[i-1].coord.z].terType==EterrainType::water))
+				  ||
+				  (CGI->mh->ttiles[path->nodes[i-1].coord.x][path->nodes[i-1].coord.y][path->nodes[i-1].coord.z].terType==EterrainType::rock)
 					
 				)
 				return false;

+ 7 - 0
CGameInterface.cpp

@@ -10,6 +10,7 @@
 #include "CCallback.h"
 #include "SDL_Extensions.h"
 #include "hch/CLodHandler.h"
+#include "CPathfinder.h"
 #include <sstream>
 using namespace CSDL_Ext;
 class OCM_HLP_CGIN
@@ -210,6 +211,12 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
 	//initializing objects and performing first step of move
 	CObjectInstance * ho = details.ho; //object representing this hero
 	int3 hp = details.src;
+
+	if (adventureInt->terrain.currentPath) //&& hero is moving
+	{
+		adventureInt->terrain.currentPath->nodes.erase(adventureInt->terrain.currentPath->nodes.end()-1);
+	}
+
 	if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
 	{
 		ho->moveDir = 1;

+ 2 - 0
CPathfinder.cpp

@@ -58,6 +58,8 @@ CPath * CPathfinder::getPath(int3 src, int3 dest, const CHeroInstance * hero, un
 			graph[i][j]->coord.x = i;
 			graph[i][j]->coord.y = j;
 			graph[i][j]->coord.z = dest.z;
+			if (CGI->mh->ttiles[i][j][src.z].terType==EterrainType::rock)
+				graph[i][j]->accesible = false;
 			if ((blockLandSea) && (CGI->mh->ttiles[i][j][src.z].terType==EterrainType::water))
 				graph[i][j]->accesible = false;
 			else if ((!blockLandSea) && (CGI->mh->ttiles[i][j][src.z].terType!=EterrainType::water))