From: Stefan F. <ste...@us...> - 2010-05-11 21:47:29
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv14662/rails/game Modified Files: TrainType.java MapHex.java Station.java Tile.java Log Message: Added VertexVisitedSets and RevenueBonuses, several other improvements to the RC Index: TrainType.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainType.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** TrainType.java 4 Mar 2010 22:08:09 -0000 1.31 --- TrainType.java 11 May 2010 21:47:21 -0000 1.32 *************** *** 497,499 **** --- 497,503 ---- b.append(text); } + + public String toString() { + return name; + } } Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Tile.java 4 Apr 2010 22:02:53 -0000 1.38 --- Tile.java 11 May 2010 21:47:21 -0000 1.39 *************** *** 127,131 **** if (stationTags != null) { tracksPerStation = new HashMap<Integer, List<Track>>(); ! String sid, type; int number, value, slots, position; Station station; --- 127,131 ---- if (stationTags != null) { tracksPerStation = new HashMap<Integer, List<Track>>(); ! String sid, type, cityName; int number, value, slots, position; Station station; *************** *** 149,155 **** slots = stationTag.getAttributeAsInteger("slots", 0); position = stationTag.getAttributeAsInteger("position", 0); station = new Station(this, number, sid, type, value, slots, ! position); stations.add(station); stationMap.put(sid, station); --- 149,156 ---- slots = stationTag.getAttributeAsInteger("slots", 0); position = stationTag.getAttributeAsInteger("position", 0); + cityName = stationTag.getAttributeAsString("city"); station = new Station(this, number, sid, type, value, slots, ! position, cityName); stations.add(station); stationMap.put(sid, station); Index: MapHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapHex.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** MapHex.java 15 Apr 2010 19:49:02 -0000 1.43 --- MapHex.java 11 May 2010 21:47:21 -0000 1.44 *************** *** 8,11 **** --- 8,12 ---- import org.apache.log4j.Logger; + import rails.algorithms.RevenueBonusTemplate; import rails.game.action.LayTile; import rails.game.model.ModelObject; *************** *** 108,111 **** --- 109,115 ---- /** Tokens that are not bound to a Station (City), such as Bonus tokens */ protected List<TokenI> offStationTokens; + + /** Storage of revenueBonus that are bound to the hex */ + protected List<RevenueBonusTemplate> revenueBonuses = null; protected MapManager mapManager = null; *************** *** 193,197 **** setBlockedForTokenLays(tag.getAttributeAsBoolean("unlaidHomeBlocksTokens", false)); } ! } --- 197,209 ---- setBlockedForTokenLays(tag.getAttributeAsBoolean("unlaidHomeBlocksTokens", false)); } ! ! // revenue bonus ! List<Tag> bonusTags = tag.getChildren("RevenueBonus"); ! if (bonusTags != null) { ! revenueBonuses = new ArrayList<RevenueBonusTemplate>(); ! for (Tag bonusTag:bonusTags) { ! revenueBonuses.add(new RevenueBonusTemplate(bonusTag)); ! } ! } } *************** *** 892,895 **** --- 904,917 ---- return mCities.get(cityNumber); } + + public City getRelatedCity(Station station) { + City foundCity = null; + for (City city:mCities.values()) { + if (station == city.getRelatedStation()) { + foundCity = city; + } + } + return foundCity; + } public void addHome(PublicCompanyI company, int cityNumber) { *************** *** 1037,1040 **** --- 1059,1066 ---- } + public List<RevenueBonusTemplate> getRevenueBonuses() { + return revenueBonuses; + } + public boolean equals(MapHex hex) { if (hex.getName().equals(getName()) && hex.row == row Index: Station.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Station.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Station.java 25 Sep 2009 19:13:01 -0000 1.11 --- Station.java 11 May 2010 21:47:21 -0000 1.12 *************** *** 31,34 **** --- 31,35 ---- private TileI tile; private int position; + private String cityName; private int x; private int y; *************** *** 55,59 **** public Station(TileI tile, int number, String id, String type, int value, ! int slots, int position) { this.tile = tile; this.number = number; --- 56,60 ---- public Station(TileI tile, int number, String id, String type, int value, ! int slots, int position, String cityName) { this.tile = tile; this.number = number; *************** *** 63,66 **** --- 64,68 ---- this.baseSlots = slots; this.position = position; + this.cityName = cityName; convertPosition(); // log.debug(toString()+": x="+x+" y="+y); *************** *** 71,74 **** --- 73,80 ---- + tile.getName(); } + + public String getCityName() { + return cityName; + } /** |