From: Erik V. <ev...@us...> - 2009-08-30 15:07:05
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26397/rails/ui/swing/hexmap Modified Files: GUITile.java Log Message: Enabled village downgrading (as in 1856) Index: GUITile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUITile.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GUITile.java 26 Oct 2008 20:35:53 -0000 1.12 --- GUITile.java 30 Aug 2009 15:06:48 -0000 1.13 *************** *** 68,73 **** /** ! * Rotate right (clockwise) until a valid orientation is found. TODO: ! * Currently only impassable hex sides are taken into account. * * @param initial: First rotation to try. Should be 0 for the initial tile --- 68,72 ---- /** ! * Rotate right (clockwise) until a valid orientation is found. * * @param initial: First rotation to try. Should be 0 for the initial tile *************** *** 133,148 **** // Old track ending in a station // All old tracks ending the same/different ! // stations ! // must keep doing so. ! /* ! * for (Track newTrack : newTracks) { if ! * (newTrack.getEndPoint(tempTileSide) < 0 == ! * oldTrack.getEndPoint(prevTileSide) < 0) { // ! * OK, this old track is preserved continue old; } } ! */ ! log.debug("[" + i + "," + j + "] Found " + oldTrack.getEndPoint(prevTileSide)); ! oldCities.put(prevTileSide, oldTrack.getEndPoint(prevTileSide)); } } --- 132,158 ---- // Old track ending in a station // All old tracks ending the same/different ! // stations must keep doing so (except when ! // downgrading to plain track, as in 1856) ! if (tile.hasStations()) { ! log.debug("[" + i + "," + j + "] Found " + oldTrack.getEndPoint(prevTileSide)); ! oldCities.put(prevTileSide, oldTrack.getEndPoint(prevTileSide)); + } else { + log.debug ("downgrading..."); + // Assume there are only two exits + // (this is the only known case for downgrading: + // #3->#7, #4->#9, #58->#8. + // Find the other new exit + int otherNewEndPoint = newTracks.get(0).getEndPoint(tempTileSide); + // Calculate the corresponding old tile side number + int otherOldEndPoint = (otherNewEndPoint - tempRot + prevTileRotation +6 ) % 6; + // That old tile side must have track too + if (prevTile.getTracksPerSide(otherOldEndPoint) == null + && prevTile.getTracksPerSide(otherOldEndPoint).isEmpty()) { + continue rot; + } + + } } } |