1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

minimap completety fixed (never use float for precise int calculations!)

This commit is contained in:
mateuszb
2007-12-09 14:02:11 +00:00
parent aef05b45fc
commit 56ed228cb1
4 changed files with 12 additions and 19 deletions

View File

@@ -650,8 +650,10 @@ void CMinimap::draw()
for (int i=0; i<hh.size();i++)
{
int3 hpos = hh[i]->getPosition(false);
float zawx = ((float)hpos.x/CGI->mh->sizes.x), zawy = ((float)hpos.y/CGI->mh->sizes.y);
int3 maplgp ( zawx*mw, zawy*mh, hpos.z );
if(hpos.z!=LOCPLINT->adventureInt->position.z)
continue;
//float zawx = ((float)hpos.x/CGI->mh->sizes.x), zawy = ((float)hpos.y/CGI->mh->sizes.y);
int3 maplgp ( (hpos.x*mw)/CGI->mh->sizes.x, (hpos.y*mh)/CGI->mh->sizes.y, hpos.z );
for (int ii=0; ii<wo; ii++)
{
for (int jj=0; jj<ho; jj++)
@@ -786,7 +788,7 @@ void CMinimap::showTile(int3 pos)
{
for (int jj=0; jj<ho; jj++)
{
if ((pos.x*wo+ii<this->pos.w-1) && (pos.y*ho+jj<this->pos.h-1))
if ((pos.x*wo+ii<this->pos.w) && (pos.y*ho+jj<this->pos.h))
CSDL_Ext::SDL_PutPixel(FoW[pos.z],pos.x*wo+ii,pos.y*ho+jj,0,0,0,0,0);
}
@@ -1336,7 +1338,7 @@ void CAdvMapInt::show()
infoBar.draw();
SDL_Flip(ekran);
CSDL_Ext::update(ekran);
}
void CAdvMapInt::hide()
{