BUG: [b54] moveToken() does not move properly on hex grid

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
palmer
Great Wyrm
Posts: 1367
Joined: Sat Sep 06, 2008 7:54 pm

BUG: [b54] moveToken() does not move properly on hex grid

Post by palmer »

As explained here: http://forums.rptools.net/viewtopic.php?f=3&t=8214

I'm trying to use moveToken on a vertical hex grid (the kind where the sides are flat up and down) and it's, well, not working properly.

[moveToken(6,-3)] = 6,-3 (correct...)
[moveToken(4,2)] = 3,2 (wait...)
[moveToken(2,1)] = 1,1 (no...)
[moveToken(0,5)] = -1,5 (huh?)
[moveToken(0,-4)] = -1,-5 (off by two? actually one and one)
[moveToken(-2,-1)] = -3,-2 (off by one and one again)
[moveToken(-2,2)] = -4,2 (off by a FULL two!!!)
[moveToken(34,32)] = 38,32 (now it's 4, distance from 0 seems to make it worse?)
[moveToken(-33,-39)] = -39,-40 (that's 6, plus 1 on the Y axis)

To which I say... Craig? Anyone? Bueller?

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: BUG: [b54] moveToken() does not move properly on hex grid

Post by Craig »

Working with grids is painful!!!

Yeah its a bug, I also noticed its not the only bug in the movement/distance code. Its using pixels per cell instead of distance per cell, I need to fix these things.
Gah

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: BUG: [b54] moveToken() does not move properly on hex grid

Post by Craig »

Ok I think I have the problem sorted out.

I would really appreciate it if a couple of people who have the source could download and apply the patch with square, hex, no grid both using 1 and some other number for distance per cell, so that I get a couple more tests apart from the ones I have done and don't fall into the trap of only testing the bits that worked :)

functions that need testing
Wiki: getDistance()
Wiki: getDistanceToXY()
Wiki: moveTokenToMap()
Wiki: moveTokenFromMap()

Other functions which are also affected (but use the code from one of the above functions, so if they work these should work).
Wiki: getTokens() (json version using range and area)
Wiki: moveToken()
Wiki: copyToken()

User avatar
Mrugnak
Dragon
Posts: 745
Joined: Mon Jul 21, 2008 7:38 pm

Re: BUG: [b54] moveToken() does not move properly on hex grid

Post by Mrugnak »

Craig wrote:I would really appreciate it if a couple of people who have the source could download and apply the patch with square, hex, no grid both using 1 and some other number for distance per cell, so that I get a couple more tests apart from the ones I have done and don't fall into the trap of only testing the bits that worked :)
I'll have a look at it when I get home tonight, having triggered this whole affair by accident :D

By the way, I just noticed the wfunc and wiki and wroll and wsearch tags for the forum. Those are, I'm pretty sure, new. Do we have documentation on those? On the wiki, perhaps? :D

User avatar
trevor
Codeum Arcanum (RPTools Founder)
Posts: 11311
Joined: Mon Jan 09, 2006 4:16 pm
Location: Austin, Tx
Contact:

Re: BUG: [b54] moveToken() does not move properly on hex grid

Post by trevor »

Patch from Craig applied for 1.3b56
Dreaming of a 1.3 release

Post Reply

Return to “Resolved”