• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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