Compare commits
3 Commits
c9e0ceef32
...
64f4304626
| Author | SHA1 | Date | |
|---|---|---|---|
|
64f4304626
|
|||
|
8cd105b84c
|
|||
|
ce0e89f5b3
|
@@ -1,9 +1,20 @@
|
||||
import kernel.ui.WindowManager;
|
||||
import kernel.ps.ProcessManager;
|
||||
import kernel.binstore.BinStore;
|
||||
import kernel.MainTerm;
|
||||
import lib.HomeContext;
|
||||
|
||||
class Startup {
|
||||
public static function main() {
|
||||
if (MainTerm.instance.isColor()) {
|
||||
var main = new HomeContext();
|
||||
|
||||
main.run();
|
||||
} else {
|
||||
var term = BinStore.instantiate("terminal");
|
||||
var pid = ProcessManager.run(term, {});
|
||||
var ctx = WindowManager.getContextByPID(pid);
|
||||
WindowManager.focusContextToOutput(ctx[0], "main");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class InvManager {
|
||||
var topIndex = slots.length - 1;
|
||||
|
||||
for (k => slot in slots) {
|
||||
if (topIndex <= k) {
|
||||
if (topIndex < k) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,8 +138,12 @@ class InvManager {
|
||||
return;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (topIndex <= k) {
|
||||
var loopProtect = 20;
|
||||
|
||||
while (loopProtect > 0) {
|
||||
loopProtect--;
|
||||
|
||||
if (topIndex < k) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,10 +160,9 @@ class InvManager {
|
||||
Log.error("Failed to transfer items");
|
||||
}
|
||||
|
||||
// Update invState
|
||||
var topState = invState.get(slots[topIndex]);
|
||||
topState.count += transferCount;
|
||||
invState.set(topIndex, topState);
|
||||
invState.set(slots[topIndex], topState);
|
||||
|
||||
var botState = invState.get(slot);
|
||||
botState.count -= transferCount;
|
||||
@@ -171,6 +174,10 @@ class InvManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (loopProtect < 0) {
|
||||
Log.silly("Loopprotection triggerd");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user