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;
|
import lib.HomeContext;
|
||||||
|
|
||||||
class Startup {
|
class Startup {
|
||||||
public static function main() {
|
public static function main() {
|
||||||
var main = new HomeContext();
|
if (MainTerm.instance.isColor()) {
|
||||||
|
var main = new HomeContext();
|
||||||
|
|
||||||
main.run();
|
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;
|
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,12 @@ class InvManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
var loopProtect = 20;
|
||||||
if (topIndex <= k) {
|
|
||||||
|
while (loopProtect > 0) {
|
||||||
|
loopProtect--;
|
||||||
|
|
||||||
|
if (topIndex < k) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +160,9 @@ class InvManager {
|
|||||||
Log.error("Failed to transfer items");
|
Log.error("Failed to transfer items");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update invState
|
|
||||||
var topState = invState.get(slots[topIndex]);
|
var topState = invState.get(slots[topIndex]);
|
||||||
topState.count += transferCount;
|
topState.count += transferCount;
|
||||||
invState.set(topIndex, topState);
|
invState.set(slots[topIndex], topState);
|
||||||
|
|
||||||
var botState = invState.get(slot);
|
var botState = invState.get(slot);
|
||||||
botState.count -= transferCount;
|
botState.count -= transferCount;
|
||||||
@@ -171,6 +174,10 @@ class InvManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loopProtect < 0) {
|
||||||
|
Log.silly("Loopprotection triggerd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user