verhoevenv / OpenNotrium

Code and bugfixes for Instant Kingdom's Notrium, a topdown survival game
Other
86 stars 26 forks source link

Switching inventories #46

Open Infernus444 opened 9 years ago

Infernus444 commented 9 years ago

When you switch to another inventory, the scroller is at the same position of the first inventory.

http://gyazo.com/d29be7ff2c324aa86efab019ff1a4661 (Main inventory, scroller at top)

http://gyazo.com/ee8f6a3f3f80b25de61490aa5d94072d (Second inventory, accessed via quick key, scroller at top)

http://gyazo.com/6335a8eae4e6f1e46241b685d0462076 (Main inventory, scroller at bottom)

http://gyazo.com/fe472bf5c333112d28557fa1f8495ac5 (Second inventory, accessed via quick key, scroller at bottom)

So, if you access another inventory if your scroller from main inventory is below the topmost position, the second inventory will jump to that position (With no scroller, making it impossible to go up). Works with every inventory (0 - 20)

The fix would be to reset the view to the top list for every inventory switch.

Took me 2 days to figure out why my items were invisible...

Enet4 commented 9 years ago

Thanks for reporting. I honestly hadn't tested multiple inventories with Open Notrium. There's more than one place where the active inventory number is modified, at least here and there. We should seriously start encapsulating these into a single setActiveInventory, hopefully becoming a member function later on.