improved turtle defrag

This commit is contained in:
Niklas Kapelle 2024-01-28 16:13:09 +01:00
parent c9e0ceef32
commit ce0e89f5b3
Signed by: niklas
GPG Key ID: 4EB651B36D841D16

View File

@ -128,7 +128,7 @@ class InvManager {
var topIndex = slots.length - 1; var topIndex = slots.length - 1;
for (k => slot in slots) { for (k => slot in slots) {
if (topIndex <= k) { if (topIndex < k) {
return; return;
} }
@ -138,8 +138,11 @@ class InvManager {
return; return;
} }
while (true) { var loopProtect = 20;
if (topIndex <= k) {
while (loopProtect > 0) {
loopProtect--;
if (topIndex < k) {
return; return;
} }