mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #335 from dydzio0614/bug2476_fix2
Fix #2 for bug #2476
This commit is contained in:
commit
2cf7c7b234
@ -402,7 +402,7 @@ void CGuiHandler::handleMoveInterested(const SDL_MouseMotionEvent & motion)
|
||||
std::list<CIntObject*> miCopy = motioninterested;
|
||||
for(auto & elem : miCopy)
|
||||
{
|
||||
if ((elem)->strongInterest || isItIn(&(elem)->pos, motion.x-1, motion.y-1)) //-1 offset to include lower bound, fixes bug #2476
|
||||
if(elem->strongInterest || isItInOrLowerBounds(&elem->pos, motion.x, motion.y)) //checking lower bounds fixes bug #2476
|
||||
{
|
||||
(elem)->mouseMoved(motion);
|
||||
}
|
||||
|
@ -62,6 +62,11 @@ bool isItIn(const SDL_Rect * rect, int x, int y)
|
||||
return (x>rect->x && x<rect->x+rect->w) && (y>rect->y && y<rect->y+rect->h);
|
||||
}
|
||||
|
||||
bool isItInOrLowerBounds(const SDL_Rect * rect, int x, int y)
|
||||
{
|
||||
return (x >= rect->x && x < rect->x + rect->w) && (y >= rect->y && y < rect->y + rect->h);
|
||||
}
|
||||
|
||||
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst)
|
||||
{
|
||||
if(!dst) dst = screen;
|
||||
|
@ -70,6 +70,7 @@ extern SDL_Surface * screen, *screen2, *screenBuf;
|
||||
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);
|
||||
void blitAt(SDL_Surface * src, const SDL_Rect & pos, SDL_Surface * dst=screen);
|
||||
bool isItIn(const SDL_Rect * rect, int x, int y);
|
||||
bool isItInOrLowerBounds(const SDL_Rect * rect, int x, int y);
|
||||
|
||||
/**
|
||||
* The colors class defines color constants of type SDL_Color.
|
||||
|
Loading…
Reference in New Issue
Block a user