[messages] [Developers] LOS and some help

relvar99 spencer.lee.olson at gmail.com
Fri Mar 13 21:17:04 CET 2015


Hello All,

I posted the following in the Module Forum, but maybe this is a better
place.  And again please forgive my ignorance ...  After looking at the
code again, is there a way to traverse the lastRangeRect in the
LOS_Thread code to determine which, if any, Hexes or Hexsides are
crossed by that "line". If I am reading the code correctly, the
Rectangle that constitutes the range (assuming snap to grid) once the
mouse button is released, should be traversable? I know, that is not a
word, but is there existing code I could hack, or does someone know of a
way to do this? 

Thanks,
Spencer

_Hello,

I am new here, so please bear with me. If this is not the right place,
forum, etc... I have been trying to leverage both the LOS_Thread code
and expanding upon the attackwizard from The Devil's Cauldron which
enhances the terrain features of a map to determine the following. From
a source point S to an end point E, has some code already been published
that determines all of the hex and hexsides that a line passes through
AFTER the target has been selected. One drawback of the LOS_Thread is
that it stores EVERY hex the mouse crosses during the drag events, so
along the way if a player moves here and there all hexes get added to
the list. What I would like are just those hexes and hexsides that are
traversed between points S and E assuming we are snapping to the hex
centers. Hence code like the following is great but not quite there.
Anyone know of such a thing, I am sure it has been done?


Regards,
Spencer

String location = this.map.localizedLocationName(this.arrow);
if ((!this.checkList.contains(location)) &&
(!location.equals(this.anchorLocation))) {
this.checkList.add(location); // this adds every hex crossed, even if
not in the line once targeted, this is a List<>
this.lastLocation = location;
}_

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=48232#p48232


More information about the messages mailing list