MasterRofl
New Member
- Reaction score
- 8
Sure, I know how to attach a struct to a handle just fine, but how would you do it with a trigger?
EDIT: Shoot, forgot to mention, using ABC.
EDIT: Shoot, forgot to mention, using ABC.
//! runtextmacro ABC("A","Timer","timer")
//! runtextmacro ABC("B","Timer","timer")
//! runtextmacro ABC("C","Timer","timer")
//! runtextmacro ABC("A","Trigger","trigger")
//! runtextmacro ABC("B","Trigger","trigger")
//! runtextmacro ABC("C","Trigger","trigger")
//! runtextmacro ABC("A","Dialog","dialog")
//! runtextmacro ABC("B","Dialog","dialog")
//! runtextmacro ABC("C","Dialog","dialog")
//! runtextmacro ABC("A","Region","region")
//! runtextmacro ABC("B","Region","region")
//! runtextmacro ABC("C","Region","region")
private function Init takes nothing returns nothing
call InitTimerHashA()
call InitTimerHashB()
call InitTimerHashC()
call InitTriggerHashA()
call InitTriggerHashB()
call InitTriggerHashC()
call InitDialogHashA()
call InitDialogHashB()
call InitDialogHashC()
call InitRegionHashA()
call InitRegionHashB()
call InitRegionHashC()
endfunction
function foo takes nothing returns nothing
local trigger t = CreateTrigger()
local SomeStruct d = SomeStruct.create()
call SetHandleStructA(t, d)
endfunction
local timer t = GetExpiredTimer()
local struct s = GetTimerStructA(t)
Do NOT do what TheDamien just did.
Doing direct handle attachments is a railroad to hell.
That is because you never made any real maps.
And if there was no compelling reason for type-safety people would be programming in assembler now, not in strong-type languages we have today.
It is relevant because you start to appreciate type safety only when you spend hours debugging attachment code.Unless you are suggesting that my use of handle type attachment systems is responsible for my vapourmapping, I don't see how this is relevant. There are hundreds of successful maps that use handle attachment, so this really doesn't cut it as an argument.
subtypes are specialization, using handles is generalization, it goes in the opposite direction (up the type tree) so I guess your point is in my favor here..Yet many strongly typed languages we use today allow us to treat subtypes and subclasses as parent types/classes. ABC does not offer extra type-safety merely because you declare it so.
It is relevant because you start to appreciate type safety only when you spend hours debugging attachment code.
And what are those hundreds of successful maps you are talking about?
I know only 5-10 successful maps and half of them don't even use attaching while other half uses type-safety attaching.
Even DotA-Allstars uses a type-safe gamecache library.
subtypes are specialization, using handles is generalization, it goes in the opposite direction (up the type tree) so I guess your point is in my favor here..
Great now that you lost your arguments you call me a liar above all.
And your use of "big" programming words does not help your either, it only makes you look silly to anyone who knows the subject.
I said all I wanted to say on the subject, you can argue with yourself now.
Great now that you lost your arguments you call me a liar above all.
And your use of "big" programming words does not help your either, it only makes you look silly to anyone who knows the subject.
What you said about DotA was simply false, so I just reached the obvious conclusion. There are many less flattering conclusions I could have reached.
function InitDTAXCache takes nothing returns nothing
call FlushGameCache(InitGameCache("DotACache.x"))
set udg_gc_DTAX_Cache=InitGameCache("DotACache.x")
endfunction
function H2I takes handle h returns integer
return h
return 0
endfunction
function H2S takes handle h returns string
return I2S(H2I(h))
endfunction
function FlushStoredMissionShell takes string sMission returns nothing
call FlushStoredMission(udg_gc_DTAX_Cache,sMission)
endfunction
function StoreDTAXObject takes string sMission,string sKey,handle hObject returns nothing
call StoreInteger(udg_gc_DTAX_Cache,sMission,sKey,H2I(hObject))
endfunction
function StoreDTAXInteger takes string sMission,string sKey,integer iInteger returns nothing
call StoreInteger(udg_gc_DTAX_Cache,sMission,sKey,iInteger)
endfunction
function StoreDTAXInteger_Copy takes string sMission,string sKey,integer iInteger returns nothing
call StoreInteger(udg_gc_DTAX_Cache,sMission,sKey,iInteger)
endfunction
function StoreDTAXReal takes string sMission,string sKey,real rReal returns nothing
call StoreReal(udg_gc_DTAX_Cache,sMission,sKey,rReal)
endfunction
function StoreDTAXBoolean takes string sMission,string sKey,boolean bBoolean returns nothing
call StoreBoolean(udg_gc_DTAX_Cache,sMission,sKey,bBoolean)
endfunction
function GetStoredDTAXUnit takes string sMission,string sKey returns unit
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXPlayer takes string sMission,string sKey returns player
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXTimer takes string sMission,string sKey returns timer
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXTrigger takes string sMission,string sKey returns trigger
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXGroup takes string sMission,string sKey returns group
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXEffect takes string sMission,string sKey returns effect
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXLocation takes string sMission,string sKey returns location
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXTriggerAction takes string sMission,string sKey returns triggeraction
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
return null
endfunction
function GetStoredDTAXInteger takes string sMission,string sKey returns integer
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
endfunction
function GetStoredDTAXInteger_Copy takes string sMission,string sKey returns integer
return GetStoredInteger(udg_gc_DTAX_Cache,sMission,sKey)
endfunction
function GetStoredDTAXReal takes string sMission,string sKey returns real
return GetStoredReal(udg_gc_DTAX_Cache,sMission,sKey)
endfunction
function GetStoredDTAXBoolean takes string sMission,string sKey returns boolean
return GetStoredBoolean(udg_gc_DTAX_Cache,sMission,sKey)
endfunction
function OI0110 takes string OI0O00,string OI00I0 returns unit
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
function OIIOO0 takes string OI0O00,string OI00I0 returns player
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
function OIIO00 takes string OI0O00,string OI00I0 returns timer
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
function OIIOI0 takes string OI0O00,string OI00I0 returns trigger
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
function OIIO10 takes string OI0O00,string OI00I0 returns group
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
function OII0O0 takes string OI0O00,string OI00I0 returns effect
return GetStoredInteger(OOII,OI0O00,OI00I0)
return null
endfunction
// and so on....
Even DotA-Allstars uses a type-safe gamecache library.