- Joined
- Jul 10, 2007
- Messages
- 6,306
//if the point was found as pathable, it may not be pathable
//units are placed at the original coordinates if the closest pathable point is
//at least 1024 units out
//loop through to see if the coordinates move *away* from the original position
constant pathingtype PATHING_TYPE_ANY = ConvertPathingType(0)
constant pathingtype PATHING_TYPE_WALKABILITY = ConvertPathingType(1)
constant pathingtype PATHING_TYPE_FLYABILITY = ConvertPathingType(2)
constant pathingtype PATHING_TYPE_BUILDABILITY = ConvertPathingType(3)
constant pathingtype PATHING_TYPE_PEONHARVESTPATHING = ConvertPathingType(4)
constant pathingtype PATHING_TYPE_BLIGHTPATHING = ConvertPathingType(5)
constant pathingtype PATHING_TYPE_FLOATABILITY = ConvertPathingType(6)
constant pathingtype PATHING_TYPE_AMPHIBIOUSPATHING = ConvertPathingType(7)
globals
constant boolean F=true
endglobals
function r takes nothing returns nothing
local integer x=5000
local integer i
loop
static if F then
set i=GetHandleId(PATHING_TYPE_ANY)
else
set i=0
endif
set x=x-1
exitwhen 0==x
endloop
endfunction
struct tester extends array
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),.015625000,true,function r)
endmethod
endstruct
Oh yea, and to give you an idea of how slow GetHandleId is, it tied with the SubString and LoadInteger natives on speed.
class hashtable{};
library Test initializer init
globals
private boolean GetHandleIdTest = false
integer array I
endglobals
function F takes nothing returns nothing
local integer i
local integer j = 0
loop
exitwhen j == 6500
set j = j+1
static if GetHandleIdTest then
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
set i = GetHandleId(PATHING_TYPE_WALKABILITY)
else
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
set i = I[1]
endif
endloop
//call BJDebugMsg("limit op not reached")
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerSleepAction(2.)
call BJDebugMsg("test")
set I[1] = 1
call TimerStart(CreateTimer(),0.03,true,function F)
endfunction
endlibrary
globals
constant boolean F=true
integer array p
endglobals
function r takes nothing returns nothing
local integer x=5000
local integer i
loop
static if F then
set i=GetHandleId(PATHING_TYPE_ANY)
else
set i=p[1]
endif
set x=x-1
exitwhen 0==x
endloop
endfunction
struct tester extends array
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),.015625000,true,function r)
endmethod
endstruct
Correct me if i miss something but i consider my last test (i tested again and the result was still about 45 for both) as more accurate because
globals
constant boolean F=false
integer array p
endglobals
function r takes nothing returns nothing
local integer x=5000
local integer i
loop
static if F then
set i=GetHandleId(PATHING_TYPE_ANY)
else
set i=p[1]
endif
set x=x-1
exitwhen 0==x
endloop
endfunction
struct tester extends array
private static method onInit takes nothing returns nothing
set p[1]=1
call TimerStart(CreateTimer(),.015625000,true,function r)
endmethod
endstruct
if Warcraft 3's handle class contains, say, an integer or some similar member variable named say, myHandleID. and GetHandleID() only tried to look up that value then it should be one of the fastest natives.
However, that doesn't seem to be the case, if it's stored in a vector or array, or any other container class then it could result in slower times. If it's stored in the hashtable class then it possibly could be even slower.
Knowing Blizzard and how they coded the natives and BJ's my bet is they put it into a hashtable of sorts.
Convert to JASS as an option, because using vJASS limits who can use it.
pt~="blighted"
means?hmm perhaps with the units?
can you provide a test map where I can copy the units?
don't suggest the LUA, i'm not gonna use it D:
seems like its always returning false
integer x, integer y
on the functionbut i'm still able to pass through a group of trees and through the pathing blocker doodad o.o
Alternatively you could probably get away with the "inferno" point-order trick, which checks pathing as well. That would at least avoid needing to create several units.