List Passing Issue in Developer Help
|
|
Code:
client proc/SetDblClickCommandObjsFromAtom(var/atom/thisAtom)
var/list/verbListToPass = thisAtom.GetPlayerCommandVerbs()
#warn For some reason verbListToPath cannot inherit the contents...
if (isnull(verbListToPass)) CRASH ("[type].SetDblClickCommandObjsFromAtom() cannot fetch verb list.") SetCommandObjectListFromVerbList(verbListToPass)
atom proc/GetPlayerCommandVerbs(var/list/inheritedPlayerCommandVerbs)
var/list/playerCommandVerbs
if (inheritedPlayerCommandVerbs == null) playerCommandVerbs = new/list() else playerCommandVerbs = inheritedPlayerCommandVerbs.Copy()
for (var/thisVerb in playerCommandVerbs) if (thisVerb == null) DebugMsg("atom.GetPlayerCommandVerbs, null verb removed.") playerCommandVerbs.Remove(thisVerb)
if (playerCommandVerbs == null || playerCommandVerbs.len == 0) return(null) else DebugMsg("[type].GetPlayerCommandVerbs() returning [playerCommandVerbs.len] length list.") return(playerCommandVerbs)
|
Problem description:
For some reason, I can't seem to pass this list. The above CRASH is triggered with this error:
runtime error: /client.SetDblClickCommandObjsFromAtom() cannot fetch verb list. proc name: SetDblClickCommandObjsFromAtom (/client/proc/SetDblClickCommandObjsFromAtom) source file: PlayerCommand.dm,117 usr: Geldonyetich (/mob/player) src: Geldonyetich (/client) call stack: Geldonyetich (/client): SetDblClickCommandObjsFromAtom(Nanite cannon (/obj/device/nanitesystem/cannon)) Geldonyetich (/client): SelectNewAtomToCommand(Nanite cannon (/obj/device/nanitesystem/cannon)) Geldonyetich (/mob/player): SelectNewAtomToCommand(Nanite cannon (/obj/device/nanitesystem/cannon)) Nanite cannon (/obj/device/nanitesystem/cannon): Click(Alchelite wall (81,85,2) (/turf/personal/wall/alchelite), "paneView.mapDefault", "icon-x=30;icon-y=21;left=1;scr...") /obj/device/nanitesystem/cannon.GetPlayerCommandVerbs() returning 6 length list.
|
Note the "/mob/creature/human.GetPlayerCommandVerbs() returning 6 length list" message at the end coming from my DebugMsg() proc. We know there's definitely a 6-length list there immediately before it is returned() but it never gets there!
I can't help but think this is something really obvious, but I can't figure out what.
I originally simply simply stuck thisAtom.GetPlayerCommandVerbs()inside of the arg for SetCommandObjectListFromVerbList() but I was getting null on the other end.
|
I'm going to say it's probably one of these two things:
1) The list is falling out of scope and being consumed by the garbage collector.
2) There's a stack limit to keep that list in scope, and I passed it.
Found a workaround, but that didn't do me any particular good seeing how I apparently can't do verb arithmetic with text2path anyway.