1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-07 00:58:39 +02:00

* resolving #18

* small bugfix
This commit is contained in:
mateuszb
2007-10-09 15:15:35 +00:00
parent a98ee6b466
commit e32eaac8af
4 changed files with 23 additions and 3 deletions

View File

@ -217,6 +217,12 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
adventureInt->terrain.currentPath->nodes.erase(adventureInt->terrain.currentPath->nodes.end()-1);
}
int3 buff = details.ho->pos;
buff.x-=11;
buff.y-=9;
buff = repairScreenPos(buff);
LOCPLINT->adventureInt->position = buff; //actualizing screen pos
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
{
ho->moveDir = 1;
@ -953,4 +959,17 @@ void CPlayerInterface::handleEvent(SDL_Event *sEvent)
}
current = NULL;
} //event end
} //event end
int3 CPlayerInterface::repairScreenPos(int3 pos)
{
if(pos.x<=-Woff)
pos.x = -Woff+1;
if(pos.y<=-Hoff)
pos.y = -Hoff+1;
if(pos.x>CGI->mh->reader->map.width - this->adventureInt->terrain.tilesw + Woff)
pos.x = CGI->mh->reader->map.width - this->adventureInt->terrain.tilesw + Woff;
if(pos.y>CGI->mh->reader->map.height - this->adventureInt->terrain.tilesh + Hoff)
pos.y = CGI->mh->reader->map.height - this->adventureInt->terrain.tilesh + Hoff;
return pos;
}