TM prototype 2 fix


I have just pushed an updated prototype 2 build out called tm_proto_2_v2.zip.

There was a major issue found in the previous build with the inventory system that has been fixed with this build.

For my fellow devs / nerds out there I will give a quick breakdown of the issue, which is pretty obvious looking back.

The player inv is in an array with index's of 0-1-2-3-4 etc..  When we do a drop all or transfer all we have to use a remove_index not a remove_item as the player will often have duplicate items in there inventory such as 2 full stacks of wood etc..

So we have to reverse loop and remove index's in the order of 4-3-2-1-0

However, when the player sorts there inventory for weight for example the sorted list could point back to our inventory as 2-1-4-3-0 etc.  Which when we reverse loop through to make removes we remove index 0 first causing index 1-2-3-4 to become 0-1-2-3 breaking the array when we try to look for index 4 or pointing to bad data etc.

This was easily fixed by unsorting the inventory on a drop or transfer all and putting them back to there original 0-1-2-3-4 order before we reverse through and remove index's.

Thank you to everyone for the feedback and assistance, please keep it coming.

Get Terra Melior

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.