1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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

@ -107,7 +107,7 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
int nn=0; //number of interfece of currently browsed player
for(std::map<int, PlayerState>::iterator j=CGI->state->players.begin(); j!=CGI->state->players.end(); ++j)//CGI->state->players.size(); ++j) //for testing
{
if(j->second.fogOfWarMap[stpos.x][stpos.y][stpos.z] || j->second.fogOfWarMap[endpos.x][endpos.y][endpos.z])
if(j->second.fogOfWarMap[stpos.x-1][stpos.y][stpos.z] || j->second.fogOfWarMap[endpos.x-1][endpos.y][endpos.z])
{ //player should be notified
CGI->playerint[nn]->heroMoved(curd);
}

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

View File

@ -124,6 +124,7 @@ public:
void handleEvent(SDL_Event * sEvent);
void init(CCallback * CB);
int3 repairScreenPos(int3 pos);
CPlayerInterface(int Player, int serial);
};

View File

@ -517,7 +517,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
}
}
SDL_BlitSurface(tb,&pp,su,&sr);
if(ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
if(!ttiles[x+bx][y+by][level].objects[h].first->flagPrinted)
{
SDL_BlitSurface(CGI->heroh->flags4[ttiles[x+bx][y+by][level].objects[h].first->owner]->ourImages[gg+anim%imgVal+35].bitmap, NULL, su, &sr);
ttiles[x+bx][y+by][level].objects[h].first->flagPrinted = true;