Update of /cvsroot/rails/18xx/rails/game
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6277/rails/game
Modified Files:
MapManager.java MapHex.java
Log Message:
Display bars to show impassable hex sides
Index: MapHex.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/game/MapHex.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** MapHex.java 2 Nov 2009 23:30:36 -0000 1.29
--- MapHex.java 6 Nov 2009 20:23:53 -0000 1.30
***************
*** 79,82 ****
--- 79,83 ----
*/
protected String impassable = null;
+ protected List<Integer> impassableSides;
protected List<City> cities;
***************
*** 183,187 ****
--- 184,201 ----
mCities.put(c.getNumber(), c);
}
+ }
+
+ public void addImpassableSide (int orientation) {
+ if (impassableSides == null) impassableSides = new ArrayList<Integer>(4);
+ impassableSides.add(orientation%6);
+ log.debug("+++Hex "+name+" is impassable on side "+(orientation%6));
+ }
+ public List<Integer> getImpassableSides () {
+ return impassableSides;
+ }
+
+ public boolean isImpassable (MapHex neighbour) {
+ return impassable != null && impassable.indexOf(neighbour.getName()) > -1;
}
Index: MapManager.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/game/MapManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** MapManager.java 2 Nov 2009 23:30:36 -0000 1.12
--- MapManager.java 6 Nov 2009 20:23:53 -0000 1.13
***************
*** 103,110 ****
// Initialise the neighbours
- /**
- * TODO: impassable hexsides. TODO: blank sides of fixed and offboard
- * preprinted tiles.
- */
for (i = 0; i <= maxX; i++) {
for (j = 0; j <= maxY; j++) {
--- 103,106 ----
***************
*** 127,130 ****
--- 123,130 ----
nb.setNeighbor(k + 3, hex);
}
+ if (hex.isImpassable(nb) || nb.isImpassable(hex)) {
+ hex.addImpassableSide(k);
+ //nb.addImpassableSide(k+3);
+ }
}
|