View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 15th, 2013, 08:15 AM
The positioning fix was a very subtle thing.

Old:
Code:
 
      ~if the height the tables exceeds the available space, we need to divvy
      ~up that space between the tables
      if (portal[oArmor].height + portal[oWeapon].height + portal[oMagicArmr].height + portal[oMagicWeap].height > remain) then
        ~if the armor table is less than half the space, limit the weapon table
        ~to whatever space is leftover
        if (portal[oArmor].height + portal[oMagicArmr].height < remain / 2) then
          portal[oMagicWeap].height = remain - portal[oArmor].height + portal[oMagicArmr].height
          portal[oWeapon].height = remain - portal[oArmor].height + portal[oMagicArmr].height + portal[oMagicWeap].height
        ~if the weapon table is less than half the space, limit the armor table
        ~to whatever space is leftover
        elseif (portal[oWeapon].height + portal[oMagicWeap].height < remain / 2) then
          portal[oMagicArmr].height = remain - portal[oWeapon].height + portal[oMagicWeap].height
          portal[oArmor].height = remain - portal[oWeapon].height + portal[oMagicWeap].height + portal[oMagicArmr].height
        ~otherwise, both tables are larger than half the space, so we need to limit
        ~the height of both of them
        ~NOTE! If we just divide the remaining amount by two and set both tables to
        ~that height, we could end up with both tables being truncated by more than
        ~a half item, with the combined height being a full item short of taking up
        ~the full space. So we have to set the height of one table to half the
        ~remaining space, then subtract that table's final height from our remaining
        ~space, and finally set that as the height for the second table.
        else
          portal[oMagicWeap].height = minimum(portal[oMagicWeap].height,remain / 2)
          portal[oWeapon].height = (remain / 2) - portal[oMagicWeap].height
          portal[oMagicArmr].height = remain - (portal[oWeapon].height + portal[oMagicWeap].height)
          portal[oArmor].height = (remain / 2) - portal[oMagicArmr].height
          endif
        endif
New:
Code:
 
      ~if the height the tables exceeds the available space, we need to divvy
      ~up that space between the tables
      if (portal[oArmor].height + portal[oWeapon].height + portal[oMagicArmr].height + portal[oMagicWeap].height > remain) then
        ~if the armor table is less than half the space, limit the weapon table
        ~to whatever space is leftover
        if (portal[oArmor].height + portal[oMagicArmr].height < remain / 2) then
          portal[oMagicWeap].height = remain - portal[oArmor].height - portal[oMagicArmr].height
          portal[oWeapon].height = remain - portal[oArmor].height - portal[oMagicArmr].height - portal[oMagicWeap].height
        ~if the weapon table is less than half the space, limit the armor table
        ~to whatever space is leftover
        elseif (portal[oWeapon].height + portal[oMagicWeap].height < remain / 2) then
          portal[oMagicArmr].height = remain - portal[oWeapon].height - portal[oMagicWeap].height
          portal[oArmor].height = remain - portal[oWeapon].height - portal[oMagicWeap].height - portal[oMagicArmr].height
        ~otherwise, both tables are larger than half the space, so we need to limit
        ~the height of both of them
        ~NOTE! If we just divide the remaining amount by two and set both tables to
        ~that height, we could end up with both tables being truncated by more than
        ~a half item, with the combined height being a full item short of taking up
        ~the full space. So we have to set the height of one table to half the
        ~remaining space, then subtract that table's final height from our remaining
        ~space, and finally set that as the height for the second table.
        else
          portal[oMagicWeap].height = minimum(portal[oMagicWeap].height,remain / 2)
          portal[oWeapon].height = (remain / 2) - portal[oMagicWeap].height
          portal[oMagicArmr].height = remain - (portal[oWeapon].height - portal[oMagicWeap].height)
          portal[oArmor].height = (remain / 2) - portal[oMagicArmr].height
          endif
        endif
On 5 lines, some of the + were changed to -.
Mathias is offline   #21 Reply With Quote