From: <ev...@us...> - 2010-10-11 17:19:08
|
Revision: 1442 http://rails.svn.sourceforge.net/rails/?rev=1442&view=rev Author: evos Date: 2010-10-11 17:19:02 +0000 (Mon, 11 Oct 2010) Log Message: ----------- Check company order after each turn. If changed, recreate ORPanel. Modified Paths: -------------- trunk/18xx/rails/ui/swing/ORUIManager.java Modified: trunk/18xx/rails/ui/swing/ORUIManager.java =================================================================== --- trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-11 17:18:21 UTC (rev 1441) +++ trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-11 17:19:02 UTC (rev 1442) @@ -1433,6 +1433,9 @@ if (oRound.getOperatingCompanyIndex() != orCompIndex) { if (orCompIndex >= 0) orPanel.finishORCompanyTurn(orCompIndex); + + // Check if sequence has changed + checkORCompanySequence(companies, oRound.getOperatingCompanies()); setORCompanyTurn(oRound.getOperatingCompanyIndex()); } @@ -1669,6 +1672,18 @@ } + /** Redraw the ORPanel if the company operating order has changed */ + protected void checkORCompanySequence (PublicCompanyI[] oldCompanies, List<PublicCompanyI> newCompanies) { + for (int i=0; i<newCompanies.size(); i++) { + if (newCompanies.get(i) != oldCompanies[i]) { + log.debug("Detected a OR company sequence change: "+oldCompanies[i].getName() + +" becomes "+newCompanies.get(i).getName()); + } + orPanel.recreate(oRound); + return; + } + } + public void setORCompanyTurn(int orCompIndex) { this.orCompIndex = orCompIndex; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |