GetLink instruction
This commit is contained in:
@@ -29,6 +29,7 @@ public class LExecutor{
|
||||
|
||||
public LongSeq graphicsBuffer = new LongSeq();
|
||||
public StringBuilder textBuffer = new StringBuilder();
|
||||
public Building[] links = {};
|
||||
|
||||
public boolean initialized(){
|
||||
return instructions != null && vars != null && instructions.length > 0;
|
||||
@@ -161,6 +162,27 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
|
||||
public static class GetLinkI implements LInstruction{
|
||||
public int output, index;
|
||||
|
||||
public GetLinkI(int output, int index){
|
||||
this.index = index;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public GetLinkI(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
int address = exec.numi(index);
|
||||
|
||||
if(address >= 0 && address < exec.links.length){
|
||||
exec.setobj(output, exec.links[address]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ReadI implements LInstruction{
|
||||
public int target, position, output;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user