From d0784bd31476ecf6b665c602c6c2060ec5a3281c Mon Sep 17 00:00:00 2001 From: leper Date: Fri, 4 May 2012 17:44:28 +0000 Subject: [PATCH] Fix minimap issue caused by 5b7027ec53. Fixes #1372. This was SVN commit r11748. --- source/gui/MiniMap.cpp | 14 ++++++------ source/gui/MiniMap.h | 51 +++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index ff3b61fc18..f05da713b6 100644 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -59,7 +59,7 @@ CMiniMap::CMiniMap() : AddSetting(GUIST_CStrW, "tooltip"); AddSetting(GUIST_CStr, "tooltip_style"); m_Clicking = false; - m_Hovering = false; + m_MouseHovering = false; } CMiniMap::~CMiniMap() @@ -73,7 +73,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message) { case GUIM_MOUSE_PRESS_LEFT: { - if (m_Hovering) + if (m_MouseHovering) { SetCameraPos(); m_Clicking = true; @@ -82,7 +82,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message) } case GUIM_MOUSE_RELEASE_LEFT: { - if(m_Hovering && m_Clicking) + if(m_MouseHovering && m_Clicking) { SetCameraPos(); } @@ -91,7 +91,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message) } case GUIM_MOUSE_DBLCLICK_LEFT: { - if(m_Hovering && m_Clicking) + if(m_MouseHovering && m_Clicking) { SetCameraPos(); } @@ -100,13 +100,13 @@ void CMiniMap::HandleMessage(SGUIMessage &Message) } case GUIM_MOUSE_ENTER: { - m_Hovering = true; + m_MouseHovering = true; break; } case GUIM_MOUSE_LEAVE: { m_Clicking = false; - m_Hovering = false; + m_MouseHovering = false; break; } case GUIM_MOUSE_RELEASE_RIGHT: @@ -121,7 +121,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message) } case GUIM_MOUSE_MOTION: { - if (m_Hovering && m_Clicking) + if (m_MouseHovering && m_Clicking) { SetCameraPos(); } diff --git a/source/gui/MiniMap.h b/source/gui/MiniMap.h index 13253a1468..2ad3e578b1 100644 --- a/source/gui/MiniMap.h +++ b/source/gui/MiniMap.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,56 +25,55 @@ class CTerrain; class CMiniMap : public IGUIObject { - GUI_OBJECT(CMiniMap) + GUI_OBJECT(CMiniMap) public: - CMiniMap(); - virtual ~CMiniMap(); + CMiniMap(); + virtual ~CMiniMap(); protected: - virtual void Draw(); + virtual void Draw(); /** * @see IGUIObject#HandleMessage() */ virtual void HandleMessage(SGUIMessage &Message); - // create the minimap textures - void CreateTextures(); + // create the minimap textures + void CreateTextures(); - // rebuild the terrain texture map - void RebuildTerrainTexture(); + // rebuild the terrain texture map + void RebuildTerrainTexture(); - // destroy and free any memory and textures - void Destroy(); + // destroy and free any memory and textures + void Destroy(); void SetCameraPos(); void FireWorldClickEvent(int button, int clicks); - // the terrain we are mini-mapping - const CTerrain* m_Terrain; + // the terrain we are mini-mapping + const CTerrain* m_Terrain; const CCamera* m_Camera; - + //Whether or not the mouse is currently down bool m_Clicking; - bool m_Hovering; - // minimap texture handles - GLuint m_TerrainTexture; + // minimap texture handles + GLuint m_TerrainTexture; - // texture data - u32* m_TerrainData; + // texture data + u32* m_TerrainData; - // whether we need to regenerate the terrain texture - bool m_TerrainDirty; + // whether we need to regenerate the terrain texture + bool m_TerrainDirty; - ssize_t m_Width, m_Height; + ssize_t m_Width, m_Height; - // map size - ssize_t m_MapSize; + // map size + ssize_t m_MapSize; - // texture size - GLsizei m_TextureSize; + // texture size + GLsizei m_TextureSize; // 1.f if map is circular or 1.414f if square (to shrink it inside the circle) float m_MapScale;