Exemplo n.º 1
0
  /** invokes creation of clean new game environment */
  private void newGame() throws IOException {
    // starting game normally
    ui.debugMsg("Loading gwc...");
    if (gwcfile == null) throw new IOException("invalid cartridge file");

    ui.debugMsg("pre-setting properties...");
    player.rawset("CompletionCode", gwcfile.code);
    player.rawset("Name", gwcfile.member);

    ui.debugMsg("loading code...");
    byte[] lbc = gwcfile.getBytecode();

    ui.debugMsg("parsing...");
    LuaClosure closure =
        LuaPrototype.loadByteCode(new ByteArrayInputStream(lbc), state.getEnvironment());

    ui.debugMsg("calling...\n");
    state.call(closure, null, null, null);
    lbc = null;
    closure = null;
  }
Exemplo n.º 2
0
 protected Engine(CartridgeFile cf, OutputStream out) throws IOException {
   gwcfile = cf;
   savegame = cf.getSavegame();
   if (out != null) log = new PrintStream(out);
 }