1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

- fixed wrong battlefield (#961)

- minor tweaks
This commit is contained in:
Ivan Savenko
2012-05-19 11:47:26 +00:00
parent 7116377e4e
commit 6f6cd6814e
6 changed files with 29 additions and 26 deletions

View File

@ -284,13 +284,29 @@ bool CGObjectInstance::blockingAt(int x, int y) const
bool CGObjectInstance::coveringAt(int x, int y) const
{
//input coordinates are always negative
x = -x;
y = -y;
#if USE_COVERAGE_MAP
//NOTE: this code may be broken
if((defInfo->coverageMap[y] >> (7-(x) )) & 1
|| (defInfo->shadowCoverage[y] >> (7-(x) )) & 1)
return true;
return false;
#else
return x < 8 && y < 6;// ignore unreliable msk\msg
return x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
#endif
}
bool CGObjectInstance::hasShadowAt( int x, int y ) const
{
#if USE_COVERAGE_MAP
//NOTE: this code may be broken
if( (defInfo->shadowCoverage[y] >> (7-(x) )) & 1 )
return true;
return false;
#else
return coveringAt(x,y);// ignore unreliable shadowCoverage map
#endif
}
@ -475,17 +491,6 @@ ui8 CGObjectInstance::getPassableness() const
return 0;
}
bool CGObjectInstance::hasShadowAt( int x, int y ) const
{
#if USE_COVERAGE_MAP
if( (defInfo->shadowCoverage[y] >> (7-(x) )) & 1 )
return true;
return false;
#else
return coveringAt(x,y);// ignore unreliable shadowCoverage map
#endif
}
int3 CGObjectInstance::visitablePos() const
{
return pos - getVisitableOffset();