/** Creates a default game. */ public GameInfo() { props.setPlayerClass(new Hashtable()); props.setPlayerColor(new Hashtable()); }
/** Sends the game description over the net */ public void sendNetworkDescription(SocketAnalyser sa) throws IOException { sa.reply("GINF"); // sends if running sa.reply("GRUN " + ((gamestarted) ? "1" : "0")); // sending players int n = players.size(); Player p; Color c; for (int i = 0; i < n; i++) { p = (Player) players.get(i); c = p.getColor(); sa.reply( "PLYR " + sa.stringEncode(p.getName()) + "," + c.getRed() + "," + c.getGreen() + "," + c.getBlue()); } // sending props sa.reply( "PRCF " + sa.stringEncode( props .getCircuitFileName() .substring(cirkuit.remote.server.Server.getCircuitFolder().length()))); sa.reply("PRGR " + props.getGrid()); sa.reply("PRMS " + props.getMinusSpeed()); sa.reply("PRPS " + props.getPlusSpeed()); sa.reply("PRCR " + props.getCrashRadius()); sa.reply("PRMA " + (int) Math.toDegrees(props.getMaxAngle())); sa.reply("PRRD " + ((props.getRedDots()) ? "1" : "0")); sa.reply("PRIC " + ((props.getIsCrash()) ? "1" : "0")); sa.reply("PRMD " + props.getMode()); sa.reply("PRTN " + props.getTurn()); sa.reply("PRTC " + props.getTrace()); // sending circuit // I uncommented it because on the client side it wasn't implemented if (circuitFileName == null || !props.getCircuitFileName().equals(circuitFileName)) { circuit.load(props.getCircuitFileName()); } sa.reply("CINF"); sa.reply(circuit.toString()); sa.reply("CINE"); sa.reply("GINE"); }