1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

* fixing hero move

* fixing horopos actualization
* fixing #9 bug
This commit is contained in:
mateuszb 2007-10-04 16:40:40 +00:00
parent d530bd057d
commit df3b0f56d9
2 changed files with 11 additions and 3 deletions

View File

@ -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;
}

View File

@ -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