• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Question about the JASS Compiler

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
so i had an error in my script and i noticed this

JASS:
function sa__QuestInteractListener_enable takes nothing returns boolean
local integer this=f__arg_this
local player p=f__arg_player1
            call s__Table__setindex(s__QuestInteractListener_b[this],GetPlayerId(p), 1)
            call PingMinimap(GetWidgetX(s__QuestInteractListener_interact[this]), GetWidgetY(s__QuestInteractListener_interact[this]), 5)
            call ShowUnit(s__QuestInteractListener_exc[this], s__Table__getindex(s__QuestInteractListener_b[this],GetPlayerId(GetLocalPlayer())) != 99)
            call TimedTextBoolean(15 , s__Table__getindex(s__QuestInteractListener_b[this],GetPlayerId(GetLocalPlayer())) != 99 , Quest___beforeQuestNameAccepted + s__QuestInteractListener_questName[this] + Quest___afterQuestNameAccepted)
set f__result_integer= this
   return true
endfunction

wtf does it leak p?
 
Level 7
Joined
Mar 6, 2006
Messages
282
I've heard 2 things about that... 1 being that it leaks, and 2 that it doesn't because it points to a static player handle that will be used the rest of the game. Dunno, but that doesn't even need a local player var, since it could just be local integer p = GetPlayerId( f__arg_player1 ) and then replaced in the call to s__Table__setindex(). Also it uses GetPlayerId( GetLocalPlayer() ) twice :O
 
Status
Not open for further replies.
Top