HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need: isRectinRegion Function

08-15-2004, 08:18 PM#1
Exor
A need a Function that can tell me if a rect is part of a region object.

(I use getTriggeringRegion() but can't compare it to a Rect...)



You are my last hope ;)
08-15-2004, 09:04 PM#2
GaDDeN
Im not that good of a jasser, but if you do this in triggers and then translate into jass and CnP it should work. "Is center of rect inside (change rect into region blabla) = true"

should work? =/
08-16-2004, 09:16 AM#3
Exor
Quote:
Originally Posted by GaDDeN
Im not that good of a jasser, but if you do this in triggers and then translate into jass and CnP it should work. "Is center of rect inside (change rect into region blabla) = true"

should work? =/

Again ^^. My Problem is:

I get a Region , but in We all "Regions" are the Rect Variabletype but the Function getTriggeringRegion() returns a Region VariableType.
The Problem is: a Region is a Group of Rects and there is only the way of adding,removing rects from a region. But i need a way to ask is this specific rect contained in this specific region...
(Or a getFirstRectinRegion(...) function would do it too because my TriggeringRegions contain only 1 rect anyway...)
08-16-2004, 08:36 PM#4
Vexorian
You need another solution, An IsRectInRegion function would use a giant laggy loop, I suggest you to use the handle variables functions:

http://www.wc3sear.ch/index.php?p=JASS&ID=218

Now get this function

Code:
function GetRectRegion takes rect r returns region
    return GetHandleHandle(r,"GetRegion")
endfunction

Now in another place, you have to create a region that contains the rect, and use

call SetHandleHanlde( rect, "GetRegion", region)

Now REGISTER THE REGION for the unit enters trigger, then when you need it, use GetRectRegion(rect) to get the region of a rect
08-17-2004, 02:54 PM#5
Exor
a big thx

works great but i exchanged rect with region to fit my needs
call SetHandleHandle( region, "GetRect", rect)

function GetRectRegion takes region r returns rect
return GetHandleHandle(r,"GetRect")
endfunction

because i store some rects more often than once

You helped me reducing 64 Triggers to 12 =)
08-17-2004, 05:03 PM#6
Vexorian
Quote:
Originally Posted by Exor
a big thx

works great but i exchanged rect with region to fit my needs
call SetHandleHandle( region, "GetRect", rect)

function GetRectRegion takes region r returns rect
return GetHandleHandle(r,"GetRect")
endfunction

because i store some rects more often than once

You helped me reducing 64 Triggers to 12 =)
Sorry for that I miss did the thing, it should be the way you did