[BUG] (un)Snap to grid and FoW

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

[BUG] (un)Snap to grid and FoW

Post by wolph42 »

I've not been able to recreate this issue on another map so im still missing some point.
First download this:
test movement.cmpgn
(488.2 KiB) Downloaded 89 times
The issue is this:
- load the test map (b87)
- select both tokens (truck and hero)
- now move the hero (which is snapped to grid), the truck will move along as its also selected
- then move the truck (whicj is unsnapped to grid), the hero will also move along and will be placed within a grid cell so thats ok however I ALSO get the following
ERROR MESSAGE
java.lang.ClassCastException: net.rptools.maptool.model.ZonePoint cannot be cast to net.rptools.maptool.model.CellPoint
at net.rptools.maptool.client.ui.zone.FogUtil.exposeLastPath(FogUtil.java:250)
at net.rptools.maptool.client.tool.PointerTool.stopTokenDrag(PointerTool.java:267)
at net.rptools.maptool.client.tool.PointerTool.mouseReleased(PointerTool.java:541)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:38)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
If you turn the FoW off then the error does not occur.
If you snap the truck to grid, then the issue does not occur.
If you unsnap the hero to grid, then the issue does not occur.
If you recreate the entire map in a new campaign file... the issue does not occur (probly cause there's another factor I'm missing)

tiorthan
Cave Troll
Posts: 84
Joined: Fri Aug 24, 2012 8:56 am
Location: Germany
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by tiorthan »

Interesting, I could look into the issue tomorrow.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by JamzTheMan »

Was the campaign also initially creating in b87?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by JamzTheMan »

FYI: I'm able to reproduce and isolate this to the Hero 2 token. I saved both tokens and imported just the tokens to a new campaign. If I add new tokens, they move with the truck, but basically any token that is not snapToGrid and moved while Hero 2 is selected it throws the error.

Copying the Hero 2 token does not rid the error (any copy of Hero 2 generates errror).

Not a solution but may help narrow the issue down. Might just be bad data stored in the token?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by wolph42 »

not sure about the build of the campaign file as it from the BoT and I refresh that from time to time. The map was certainly created in b87.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by wolph42 »

JamzTheMan wrote:FYI: I'm able to reproduce and isolate this to the Hero 2 token. I saved both tokens and imported just the tokens to a new campaign. If I add new tokens, they move with the truck, but basically any token that is not snapToGrid and moved while Hero 2 is selected it throws the error.

Copying the Hero 2 token does not rid the error (any copy of Hero 2 generates errror).

Not a solution but may help narrow the issue down. Might just be bad data stored in the token?
ok this is interesting: if I delete the Hero and drag a new hero from the library (you know the ones that come with MT per default): same error

tiorthan
Cave Troll
Posts: 84
Joined: Fri Aug 24, 2012 8:56 am
Location: Germany
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by tiorthan »

This is an actual bug.

It is caused by the following (you can test that on a fresh map):
- fog of war must be active
- auto exposure upon token movement must be active
- you have multiple tokens selected of which at least one has snap to grid active and one has snap to grid deactivated
- move the non-snap-to-grid token

When moved like that, the snap-to-grid token moves independently form the map grid. FogUtil.exposeLastPath() (the method that throws the exception here) does not check how the token is moved. Since it is a snap-to-grid token, it just assumes that it was moved to a CellPoint (which is a grid position) and not a ZonePoint (which is a pixel position on the map).

I'm not yet sure in which place to fix that. Since I cannot be sure that no other function assumes that a snap-to-grid token always returns CellPoints I currently favour a patch that fixes how the token is moved in a selection group.
I understand that there has been a movement related patch by Phergus, which has been deactivated? I suppose that http://forums.rptools.net/viewtopic.php?f=60&t=19072 is the patch?

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [BUG] (un)Snap to grid and FoW

Post by Lee »

I was about to write a reply. It's in the part I worked on in fixing the bug aliasMask reported. So, I guess I'll check on it since I have an idea already on what's causing it, not to mention the classes affected are part of a patch of mine.

Actually, the one that triggers the exception is the snapped token. Since it's following an unsnapped key token, it's path is saved in Zone Points. An additional criteria for triggering this is that the token(s) at fault should be PCs, since an optimization was done to have only PC tokens reveal FoW. It's not really a bug per se, it's just that little or no support for unsnapped scenarios were written in the code; implying that everything really rides on a grid-ed foundation to function smoothly. It even says so in the fog class. I'm working on something that might touch on this. I'd rather not do the quick fix I have in mind.

In reality, mixing types can and will cause problems because the implementation can only mostly handle homogeneous groups.
Last edited by Lee on Tue Oct 30, 2012 8:11 am, edited 1 time in total.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [BUG] (un)Snap to grid and FoW

Post by Lee »

tiorthan wrote:This is an actual bug.
..I currently favour a patch that fixes how the token is moved in a selection group.
When I worked on that bug I mentioned, that was my first assumption for a broad fix to a lot of problems. It's not that cut and dry, however, without rewriting a big chunk of the movement classes. Tokens in a selection group rely on the key token that's being dragged for their transit, and for what finally gets saved as their path information. Untangling that and taking it to an individualized level would mean we might as well rewrite the whole thing while we're at it; which I think shouldn't be done because apart from these exotic (my term) occurrences, it has served well being what it is.
tiorthan wrote: I understand that there has been a movement related patch by Phergus, which has been deactivated? I suppose that http://forums.rptools.net/viewtopic.php?f=60&t=19072 is the patch?
I think it's actually applied. It's what makes keyboard movement smooth, and I think was returned on b87. It seems to have broken whatever patch was in b86 for that nice behavior of picking a token up, and moving the mouse cursor just around the token area without it snapping on a bad offset. Either that or something else that affected the pointer tool.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: [BUG] (un)Snap to grid and FoW

Post by jfrazierjr »

Lee wrote:...stuff..
Replied to Private Message, hopefully with something helpful.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

tiorthan
Cave Troll
Posts: 84
Joined: Fri Aug 24, 2012 8:56 am
Location: Germany
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by tiorthan »

Lee wrote:It's not that cut and dry, however, without rewriting a big chunk of the movement classes.
I was prepared to clean things up, but I gather that your patch is going to fix this as well?

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [BUG] (un)Snap to grid and FoW

Post by Lee »

Hopefully, it will. Currently, there are 2 viable options that I'm experimenting with. In the event I upload the patch and it's found wanting, I won't mind if you supplant it with your idea of a fix.

tiorthan
Cave Troll
Posts: 84
Joined: Fri Aug 24, 2012 8:56 am
Location: Germany
Contact:

Re: [BUG] (un)Snap to grid and FoW

Post by tiorthan »

Well, I'll wait how your idea turns out then.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [BUG] (un)Snap to grid and FoW

Post by Lee »

patch uploaded to the Testing section.

@tiorthan the complete fix was extensive and too invasive to upload all in one go. It's been decided to do simpler fixes in favor of an earlier release.

Post Reply

Return to “MapTool”