Hey,
My parner and I have fixed another tiny bug. Attached is the patch.
Before the patch, zooming them mini-map all the way out would result in some 
weird behavior. The mapwould not center where the mouse was clicked. We changed 
this by removing the adjustX and adjustYvalues in the focus method of 
MiniMap.java. We are a little dubious about this, as they must have been there 
for areason but there were no comments indicating why. 
We then changed it so that if the user clicked in the minimap, but outof the 
area that the minimap was showing, the main map wouldn't focus out of bounds.
 Finally, the "parchment" the minimapis on, allowed users to click on it, and 
the game would think they were trying to focus the main map to the tile 
directly under the parchment. We fixed this by saying that any clicks in the 
area of the parchment are not meant to refocus the map. The image height of the 
parchment imagedoes not correspond to the height of the image in the game, so 
we hardcoded a value of 40 pixels. These are pixelsthat the game thinks are 
part of the image, but actually aren't. Thus clicking on these 40 pixels will 
actually refocus themap.
Let us know if there are any issues.
-Saagar and Charlie                                       
Index: src/net/sf/freecol/client/gui/panel/MiniMap.java
===================================================================
--- src/net/sf/freecol/client/gui/panel/MiniMap.java    (revision 10243)
+++ src/net/sf/freecol/client/gui/panel/MiniMap.java    (working copy)
@@ -367,9 +367,25 @@
 
 
     private void focus(int x, int y) {
-        int tileX = ((x - adjustX) / tileSize) + firstColumn;
-        int tileY = ((y - adjustY) / tileSize * 4) + firstRow;
+        
+       int tileX = (x / tileSize) + firstColumn;
+        int tileY = (y / tileSize * 4) + firstRow;
 
+        int maxRow = freeColClient.getGame().getMap().getWidth();
+        int maxCol = freeColClient.getGame().getMap().getHeight();
+        
+        /*
+         * Make sure if they click outside the bounding box of our minimap that
+         * it doesn't go off the edge. Here we just move it all the way to the
+         * edge, but alternatively, we could not move it at all (just not call
+         * setFocus)
+         */
+        if (tileX >= maxRow){
+               tileX = maxRow - 1;
+        }
+        if (tileY >= maxCol){
+               tileY = maxCol - 1;
+        }
         gui.setFocus(freeColClient.getGame().getMap().getTile(tileX,tileY));
     }

Index: src/net/sf/freecol/client/gui/CanvasMouseListener.java
===================================================================
--- src/net/sf/freecol/client/gui/CanvasMouseListener.java      (revision 10243)
+++ src/net/sf/freecol/client/gui/CanvasMouseListener.java      (working copy)
@@ -19,6 +19,7 @@
 
 package net.sf.freecol.client.gui;
 
+import java.awt.Image;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
@@ -35,6 +36,7 @@
 import net.sf.freecol.common.model.Tile;
 import net.sf.freecol.common.model.Unit;
 import net.sf.freecol.common.model.Unit.UnitState;
+import net.sf.freecol.common.resources.ResourceManager;
 
 /**
  * Listens to mouse buttons being pressed at the level of the Canvas.
@@ -148,9 +150,15 @@
                 } else if (doubleClickTimer.isRunning()) {
                     doubleClickTimer.stop();
                 } else {
-                    centerX = e.getX();
-                    centerY = e.getY();
-                    doubleClickTimer.start();
+                       Image miniMapSkin = 
ResourceManager.getImage("MiniMap.skin");
+                       int miniWidth = miniMapSkin.getWidth(null);
+                       int miniHeight = miniMapSkin.getHeight(null);
+                       if (e.getX() > miniWidth ||
+                               e.getY() < canvas.getHeight() - miniHeight + 
40){ //<- magic 40!
+                               centerX = e.getX();
+                               centerY = e.getY();
+                               doubleClickTimer.start();
+                       }
                 }
                 canvas.requestFocus();
             }
------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to