On 19.11.2012 18:08, Michael Vehrs wrote: > On 19.11.2012 11:36, Michael T. Pope wrote: > >> On Sun, 18 Nov 2012 02:32:10 PM Michael Vehrs wrote: >> >> >>> As it turns out, csDisposeSettlement doesn't produce ideal results, >>> either, as you can easily check with the included patch. >>> >>> >> Alas no. I am blocked by the crash below which is unrelated to the patch. >> However I am not particularly surprised that csDisposeSettlement is >> misbehaving. I will look into it. The crash occurs as follows: >> 1. Start freecol, select map editor. >> 2. Import a recent game >> 3. Try to add a settlement to a free (non-owned) tile adjacent to the border >> of a radius-1 Apache settlement >> >> > Well, you can always create a new empty map, and add and remove a few > settlements. csDisposeSettlement isn't really misbehaving, but its > approach differs from what I would expect to see in the map editor. > Anyway, I'll have a look at the crash as soon as I have time. > > >> => >> java.util.logging.LogManager$RootLogger log >> WARNING: Uncaught exception from thread: Thread[AWT-EventQueue-0,6,main] >> Mon Nov 19 09:07:37 CST 2012 >> Thread ID: 15 >> Stack trace: >> java.lang.IllegalArgumentException: Trying to retrieve AbstractOption with ID >> 'model.option.landPriceFactor' returned 'null'. >> at >> net.sf.freecol.common.model.Specification.getOption(Specification.java:658) >> at >> net.sf.freecol.common.model.Specification.getInteger(Specification.java:823) >> at net.sf.freecol.common.model.Player.getLandPrice(Player.java:1581) >> at >> net.sf.freecol.common.model.Player.canClaimForSettlementReason(Player.java:1266) >> at >> net.sf.freecol.common.model.Player.canClaimForSettlement(Player.java:1247) >> at >> net.sf.freecol.common.model.Player.getClaimableTiles(Player.java:1397) >> at >> net.sf.freecol.common.model.Settlement.placeSettlement(Settlement.java:223) >> at >> net.sf.freecol.client.gui.panel.MapEditorTransformPanel$SettlementTransform.transform(MapEditorTransformPanel.java:391) >> at >> net.sf.freecol.client.control.MapEditorController.transform(MapEditorController.java:144) >> at >> net.sf.freecol.client.gui.CanvasMapEditorMouseListener.mouseReleased(CanvasMapEditorMouseListener.java:226) >> at java.awt.Component.processMouseEvent(Component.java:6505) >> at javax.swing.JComponent.processMouseEvent(JComponent.java:3312) >> at java.awt.Component.processEvent(Component.java:6270) >> at java.awt.Container.processEvent(Container.java:2229) >> at java.awt.Component.dispatchEventImpl(Component.java:4861) >> at java.awt.Container.dispatchEventImpl(Container.java:2287) >> at java.awt.Component.dispatchEvent(Component.java:4687) >> at >> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) >> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) >> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) >> at java.awt.Container.dispatchEventImpl(Container.java:2273) >> at java.awt.Window.dispatchEventImpl(Window.java:2713) >> at java.awt.Component.dispatchEvent(Component.java:4687) >> at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707) >> at java.awt.EventQueue.access$000(EventQueue.java:101) >> at java.awt.EventQueue$3.run(EventQueue.java:666) >> at java.awt.EventQueue$3.run(EventQueue.java:664) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) >> at >> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) >> at java.awt.EventQueue$4.run(EventQueue.java:680) >> at java.awt.EventQueue$4.run(EventQueue.java:678) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) >> at java.awt.EventQueue.dispatchEvent(EventQueue.java:677) >> at >> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211) >> at >> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) >> at >> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) >> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) >> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) >> at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) >> >> >> >>> As far as the >>> map editor is concerned, I think placing two settlements with >>> overlapping territories and then removing one of them, should restore >>> the original territory of the remaining settlement. >>> >>> >> Mostly agree. The map editor only deals with the tiles within the immediate >> radius of each settlement. These certainly should recover cleanly. However >> in general, settlements can acquire tiles beyond the immediate radius. These >> are more problematic, and indeed are usually the ones where there might be >> multiple claimants, and are thus responsible for the general hairiness of the >> settlement disposal code. >> >> Hopefully I can fix csDisposeSettlement quick, and thus the patch should be >> good. However if you want to do something simpler for the map editor that >> just handles the radius-enclosed tiles, that would work too. >> >> Cheers, >> Mike Pope >> >> > I'll think about a solution for the map editor only. > > > Regards > > Michael >
In the case of the map editor, a settlement might also change its owner, which can not happen in the game itself, at this time. An Inca city that is changed to an Arawak settlement, for example, also needs to recalculate its sphere of influence. At the very least, the map editor should allow the editor to change tile ownership. Better yet, it should recalculate the tile ownership on demand. Better yet, it should do so automatically. And as far as the map editor is concerned, I don't think it would be forbiddingly expensive to record tile claimants in a Map<Tile, List<Settlement>> or similar data structure. Regards Michael ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Freecol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freecol-developers
