View Single Post
09/14/15, 04:23 PM   #5
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Baertram View Post
Just a hint as this lead to crashes in the past (maybe it is not necessary anymore today as the code got changed?):

Inside your callback function of the row, after the original callback function was executed, check if the inventory updte was executed because a horse got changed and your bagsize changed this way:

Lua Code:
  1. --Do not execute if horse is changed
  2. if SCENE_MANAGER:GetCurrentScene() ~= STABLES_SCENE then
  3. -- do your stuff
  4. end

In the past, if you didn't check for the horse stuff, the game crashed some times. But this maybe old and not needed anymore? Maybe circonian knows as his code is not using it.
That code is not needed here, never was. That bug was due to switching horses with different carrying capacities. When switching horses with different carrying capacities it fired off an EVENT_INVENTORY_SINGLE_SLOT_UPDATE for every slot in your inventory due to it re-Indexing item slots for the new carrying capacity (max slots). For addons that needed to handle old items (not newly picked up/looted) in the single slot update event they could use that code in their single slot update function to prevent/buffer/delay processing items when horses are switched. For addons that did not need to process old items they could just check if it was a new item & if not return:
Lua Code:
  1. local function SingleSlotUpdate(eventCode, iBagId, iSlotId, newItem, itemSoundCategory, updateReason)
  2.    if not newItem then return end
  3.    ...
  4. end
In their single slot update event function which would also prevent the problem because when switching horses all items are old items.

The inventory row controls setupCallback only fires when a row control is to be setup, which does not happen at that time (when switching horses) so it would have no effect here.

EDIT: Also the problem probably doesn't exist anymore since they changed horses....I don't actually play the game, but don't all of your horses have the same carrying capacity now, there is no more changing horses right (or at least they all have the same stats, they just look different)? So then the problem would not exist anymore.

Last edited by circonian : 09/14/15 at 04:41 PM.
  Reply With Quote