Thread Tools Display Modes
07/12/20, 01:52 PM   #1
Katorrei
Join Date: Jul 2020
Posts: 1
[open] ZO_StateEngine bug

You will see that the passed arg is NOT used (I commented out the original code). optionalEdgeTemplate (Edge, Transition, whatever you wanna call it.) is passed from other functions as such... But used on this line (466) as optionalStateTemplate, which defaults to a global.

If overridden the function in my addon, but another work around would be to use optionalStateTemplate as a global before calling AddEdge.

I don't see it being used anywhere in the default UI, but I think we can all agree we don't like to see a bug in functions directly attached to the Crown store!

Code:
function ZO_StateMachine_Base:AddEdge(edgeName, fromState, toState, optionalEdgeTemplate, ...)
    if type(fromState) == "string" then
        fromState = self:GetStateByName(fromState)
    end
    if type(toState) == "string" then
        toState = self:GetStateByName(toState)
    end
    -- Original ZOS code:
    -- local template = optionalStateTemplate or ZO_StateMachine_Edge
    --
    -- Suggested Change:
    local template = optionalEdgeTemplate or ZO_StateMachine_Edge
    --
    -- Other Workaround:
    -- Treat optionalStateTemplate as a global before passing to AddEdge
    
    local edge = template:New(fromState, toState, ...)
    self.edges[edgeName] = edge
    return edge
end
  Reply With Quote
07/13/20, 11:53 AM   #2
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
Thank you for the heads up, will correct this.
  Reply With Quote

ESOUI » Developer Discussions » Bug Reports » [open] ZO_StateEngine bug

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off