From: <aki...@us...> - 2008-09-17 06:27:38
|
Revision: 5162 http://gridarta.svn.sourceforge.net/gridarta/?rev=5162&view=rev Author: akirschbaum Date: 2008-09-17 06:27:32 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/MapActions.java Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-09-17 06:24:29 UTC (rev 5161) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-09-17 06:27:32 UTC (rev 5162) @@ -353,13 +353,13 @@ * @param currentMapView the map view to leave * @param path path to map that should be loaded * @param direction the direction to go - * @param destinationPoint the new cursor position + * @param destinationPoint the desired destination point on the map (pass + * 0|0 if unknown, and note that the point gets modified) * @param exit the applied exit object */ private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView, @NotNull final String path, final int direction, final Point destinationPoint, final GameObject exit) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); - // path points to a different map @NotNull final File newfile; // new mapfile to open if (exit != null && path.equals("/!")) { // destination is a random map; extract the final non-random map @@ -381,17 +381,15 @@ } newfile = new File(currentMap.getMapFile().getParent(), path); } - if (path.length() == 0 || (currentMap.getMapFile() != null && newfile.equals(currentMap.getMapFile()))) { // path points to the same map if (destinationPoint != null) { if (destinationPoint.x == 0 && destinationPoint.y == 0) { ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); - } else - if (!currentMap.getMapModel().isPointValid(destinationPoint)) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); - } else { + } else if (currentMap.getMapModel().isPointValid(destinationPoint)) { currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); + } else { + ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); } } return; Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-09-17 06:24:29 UTC (rev 5161) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-09-17 06:27:32 UTC (rev 5162) @@ -353,8 +353,8 @@ * @param currentMapView the map view to leave * @param path path to map that should be loaded * @param direction the direction to go - * @param destinationPoint Desired destination point on the map (pass 0|0 if - * unknown, and note that the point gets modified) + * @param destinationPoint the desired destination point on the map (pass + * 0|0 if unknown, and note that the point gets modified) */ private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView, @NotNull final String path, final int direction, @NotNull final Point destinationPoint) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); @@ -376,8 +376,7 @@ if (destinationPoint != null) { if (destinationPoint.x == 0 && destinationPoint.y == 0) { ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); - } else - if (currentMap.getMapModel().isPointValid(destinationPoint)) { + } else if (currentMap.getMapModel().isPointValid(destinationPoint)) { currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); } else { ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |