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

Fix GUI object initializing - Point(0,0)

This commit is contained in:
paracelsus
2013-03-13 23:11:27 +00:00
parent 06e2e6ac10
commit fce4f8061c
9 changed files with 23 additions and 22 deletions

View File

@ -31,9 +31,12 @@ Rect Rect::operator&(const Rect &p) const //rect intersection
Rect ret;
ret.x = std::max(this->x, p.x);
ret.y = std::max(this->y, p.y);
Point bR; //bottomRight point of returned rect
bR.x = std::min(this->w+this->x, p.w+p.x);
bR.y = std::min(this->h+this->y, p.h+p.y);
//bottomRight point of returned rect
Point bR(
std::min(rightX(), p.rightX()),
std::min(bottomY(), p.bottomY())
);
ret.w = bR.x - ret.x;
ret.h = bR.y - ret.y;
return ret;