From: Stefan F. <ste...@us...> - 2010-04-04 22:03:01
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19412/rails/game Modified Files: MapManager.java TileI.java GameManager.java Tile.java Log Message: Adding the experimental network code. Example graphs are shown under Info on the Map Panel. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** GameManager.java 28 Mar 2010 20:14:20 -0000 1.97 --- GameManager.java 4 Apr 2010 22:02:53 -0000 1.98 *************** *** 7,10 **** --- 7,11 ---- import java.util.*; + import org.apache.log4j.Logger; import org.apache.log4j.NDC; *************** *** 55,59 **** protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = --- 56,60 ---- protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = *************** *** 656,659 **** --- 657,665 ---- } + /** Stub, can be overridden in subclasses with actual actions */ + public void newPhaseChecks (RoundI round) { + + } + public String getORId () { if (showCompositeORNumber) { *************** *** 768,771 **** --- 774,780 ---- result = true; break; + case GameAction.EXPORT: + result = export(gameAction); + break; } if (result) break; *************** *** 933,936 **** --- 942,978 ---- } + protected boolean export(GameAction exportAction) { + + String filename = exportAction.getFilepath(); + boolean result = false; + + try { + PrintWriter pw = new PrintWriter(filename); + + // write map information + MapHex[][] allHexes =mapManager.getHexes(); + + for (MapHex[] hexRow:allHexes) + for (MapHex hex:hexRow) + if (hex != null) { + pw.println(hex.getName() + "," + hex.getCurrentTile().getExternalId() + "," + + hex.getCurrentTileRotation() + "," + + hex.getOrientationName(hex.getCurrentTileRotation()) + ) ; + } + + pw.close(); + result = true; + + + } catch (IOException e) { + log.error("Save failed", e); + DisplayBuffer.add(LocalText.getText("SaveFailed", e.getMessage())); + } + + return result; + } + + /* (non-Javadoc) * @see rails.game.GameManagerI#finishShareSellingRound() *************** *** 1432,1435 **** --- 1474,1478 ---- return cm; } + } Index: TileI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileI.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TileI.java 28 Mar 2010 17:05:55 -0000 1.17 --- TileI.java 4 Apr 2010 22:02:53 -0000 1.18 *************** *** 34,37 **** --- 34,39 ---- public boolean hasTracks(int sideNumber); + public List<Track> getTracks(); + public List<Track> getTracksPerSide(int sideNumber); Index: MapManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapManager.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MapManager.java 11 Mar 2010 20:38:20 -0000 1.21 --- MapManager.java 4 Apr 2010 22:02:53 -0000 1.22 *************** *** 191,194 **** --- 191,198 ---- return hexes; } + + public List<MapHex> getHexesAsList() { + return new ArrayList<MapHex>(mHexes.values()); + } public int getMinX() { Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Tile.java 28 Mar 2010 17:05:55 -0000 1.37 --- Tile.java 4 Apr 2010 22:02:53 -0000 1.38 *************** *** 425,428 **** --- 425,432 ---- } + public List<Track> getTracks() { + return tracks; + } + public Map<Integer, List<Track>> getTracksPerStationMap() { return tracksPerStation; |