From 886a5d4803e277b053014ae6b5c1c347f7756d48 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Tue, 25 Nov 2008 18:43:28 +0000 Subject: Miscellaneous TMW change commits. Missed these changes before because of a confusion on git. --- src/gui/minimap.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/gui/minimap.cpp') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 728f61e4..bd79ec87 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -70,18 +70,29 @@ void Minimap::draw(gcn::Graphics *graphics) { Window::draw(graphics); - if (mMapImage != NULL) + const gcn::Rectangle a = getChildrenArea(); + + int mapOriginX = a.x; + int mapOriginY = a.y; + + if (mMapImage) { + if (mMapImage->getWidth() > a.width || + mMapImage->getHeight() > a.height) + { + mapOriginX += (a.width - player_node->mX) / 2; + mapOriginY += (a.height - player_node->mY) / 2; + } static_cast(graphics)-> - drawImage(mMapImage, getPadding(), getTitleBarHeight()); + drawImage(mMapImage, mapOriginX, mapOriginY); } - Beings &beings = beingManager->getAll(); - BeingIterator bi; + const Beings &beings = beingManager->getAll(); + Beings::const_iterator bi; for (bi = beings.begin(); bi != beings.end(); bi++) { - Being *being = (*bi); + const Being *being = (*bi); int dotSize = 2; switch (being->getType()) { @@ -107,11 +118,11 @@ void Minimap::draw(gcn::Graphics *graphics) continue; } - int offset = (dotSize - 1) * (int) mProportion; + const int offset = (dotSize - 1) * (int) mProportion; graphics->fillRectangle(gcn::Rectangle( - (being->mX * (int) mProportion) + getPadding() - offset, - (being->mY * (int) mProportion) + getTitleBarHeight() - offset, + (being->mX * (int) mProportion) + mapOriginX - offset, + (being->mY * (int) mProportion) + mapOriginY - offset, dotSize, dotSize)); } } -- cgit v1.2.3-70-g09d2