Bläddra i källkod

* fixing hero move
* fixing horopos actualization
* fixing #9 bug

mateuszb 18 år sedan
förälder
incheckning
df3b0f56d9
2 ändrade filer med 11 tillägg och 3 borttagningar
  1. 2 2
      CAdvmapInterface.cpp
  2. 9 1
      CCallback.cpp

+ 2 - 2
CAdvmapInterface.cpp

@@ -598,7 +598,7 @@ void CTerrainRect::clickLeft(tribool down)
 	{
 		if ( (currentPath->endPos()) == mp)
 		{ //move
-			LOCPLINT->cb->moveHero(0,currentPath->endPos(), 1);//todo - move selected hero
+			LOCPLINT->cb->moveHero(0,currentPath->endPos(),0, 1);//todo - move selected hero
 			return;
 		}
 		else
@@ -692,7 +692,7 @@ void CTerrainRect::show()
 					{
 						pn = 14;
 					}
-					else if(cv[i-1].coord.x-1 == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y)
+					else if(cv[i-1].coord.x+1 == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y)
 					{
 						pn = 23;
 					}

+ 9 - 1
CCallback.cpp

@@ -50,7 +50,11 @@ bool CCallback::moveHero(int ID, int3 destPoint, int idtype, unsigned char posTy
 		return false;
 	if(destPoint.z<0 || destPoint.z>CGI->mh->ttiles[0][0].size()-1)
 		return false;
-	CPath * ourPath = CGI->pathf->getPath(CGI->heroh->heroInstances[ID]->pos, destPoint, CGI->heroh->heroInstances[ID], posType);
+	if(posType==1)
+	{
+		destPoint.x+=1;
+	}
+	CPath * ourPath = CGI->pathf->getPath(CGI->heroh->heroInstances[ID]->pos, destPoint, CGI->heroh->heroInstances[ID]);
 	if(!ourPath)
 		return false;
 	for(int i=ourPath->nodes.size()-1; i>0; i--)
@@ -63,6 +67,10 @@ bool CCallback::moveHero(int ID, int3 destPoint, int idtype, unsigned char posTy
 		curd.dst = endpos;
 		curd.heroID = ID;
 		curd.owner = CGI->heroh->heroInstances[ID]->owner;
+		if(player!=-1)
+		{
+			gs->players[player].heroes[ID]->pos = endpos;
+		}
 		//if(CGI->heroh->heroInstances[ID]->movement>=CGI->mh->getCost(stpos, endpos, CGI->heroh->heroInstances[ID]))
 		{ //performing move
 			int nn=0; //number of interfece of currently browsed player