P
P3k
Guest
Hey,
I didn't want to necro this post: https://www.ff7catalog.com/posts/212469/ so thought I'd make a new one.
I hope anyone can help me understand specifically what NFITC1 means about the bubble sort and field / battle condition.
If I do the bubble sort based on the field condition, I do not get the same results as the game.
Can someone please explain how NFITC1's answer would function? Do I check the condition once then BS from there or am i missing something?
Here's my code;
Code: [Select]
Cheers
I didn't want to necro this post: https://www.ff7catalog.com/posts/212469/ so thought I'd make a new one.
I hope anyone can help me understand specifically what NFITC1 means about the bubble sort and field / battle condition.
If I do the bubble sort based on the field condition, I do not get the same results as the game.
Can someone please explain how NFITC1's answer would function? Do I check the condition once then BS from there or am i missing something?
Here's my code;
Code: [Select]
Code:
for (var i = player.inventory.items.Length; i > 0; i--){ for (var j = player.inventory.items.Length - 1; j >= 0; j--) { if (j != 0) { var i1 = player.inventory.items[j]; var i2 = player.inventory.items[j - 1]; var swapID = ShouldSwap(i1, i2); if (swapID == 1) { player.inventory.items[j] = i2; player.inventory.items[j - 1] = i1; } } }}private static int ShouldSwap( Player.PlayerInventory.InventoryItem item1, Player.PlayerInventory.InventoryItem item2){ if (item1.sortTag.Contains(SortingTag.Field)) { return item2.sortTag.Contains(SortingTag.Field) ?0 : 1; } else { return item2.sortTag.Contains(SortingTag.Field) ?-1 : 0; }}
Last edited: