From: Erik V. <ev...@us...> - 2010-05-15 16:36:17
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5643/rails/game/specific/_1835 Modified Files: FoldIntoPrussian.java OperatingRound_1835.java Log Message: Rewritten code to assign next operating company to avoid the OperatingCompanyIndex state object. This was continually causing problems. Also partial implementation of 18EU bankruptcy; game currently hangs if this occurs. Index: OperatingRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/OperatingRound_1835.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OperatingRound_1835.java 8 May 2010 14:33:32 -0000 1.8 --- OperatingRound_1835.java 15 May 2010 16:36:09 -0000 1.9 *************** *** 170,175 **** int index = 0; ! int operatingCompanyIndex = operatingCompanyIndexObject.intValue(); ! for (PublicCompanyI company : getOperatingCompanies()) { if (index > operatingCompanyIndex && company.hasStockPrice() --- 170,175 ---- int index = 0; ! int operatingCompanyIndex = getOperatingCompanyIndex(); ! for (PublicCompanyI company : setOperatingCompanies()) { if (index > operatingCompanyIndex && company.hasStockPrice() *************** *** 185,192 **** } // Insert PR at the found index (possibly at the end) ! List<PublicCompanyI> companies ! = new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray)); ! companies.add(index, prussian); ! operatingCompanyArray = companies.toArray(new PublicCompanyI[0]); log.debug("PR will operate at order position "+index); --- 185,189 ---- } // Insert PR at the found index (possibly at the end) ! operatingCompanies.add(index, prussian); log.debug("PR will operate at order position "+index); Index: FoldIntoPrussian.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/FoldIntoPrussian.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FoldIntoPrussian.java 7 May 2010 20:03:48 -0000 1.2 --- FoldIntoPrussian.java 15 May 2010 16:36:09 -0000 1.3 *************** *** 81,84 **** --- 81,86 ---- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + + CompanyI company; in.defaultReadObject(); *************** *** 94,98 **** foldedCompanies = new ArrayList<CompanyI>(); for (String name : foldedCompanyNames.split(",")) { ! foldedCompanies.add(cmgr.getPublicCompany(name)); } } --- 96,102 ---- foldedCompanies = new ArrayList<CompanyI>(); for (String name : foldedCompanyNames.split(",")) { ! company = cmgr.getPublicCompany(name); ! if (company == null) company = cmgr.getPrivateCompany(name); ! if (company != null) foldedCompanies.add(company); } } |