|
From: <ev...@us...> - 2011-02-11 22:53:33
|
Revision: 1484
http://rails.svn.sourceforge.net/rails/?rev=1484&view=rev
Author: evos
Date: 2011-02-11 22:53:26 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
Fixed ConcurrentModificationException in laying yellow tile in 1851 Phase 3.
Modified Paths:
--------------
trunk/18xx/rails/game/OperatingRound.java
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-02-08 19:52:24 UTC (rev 1483)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-02-11 22:53:26 UTC (rev 1484)
@@ -473,13 +473,18 @@
log.debug("No more normal tile lays allowed");
//currentNormalTileLays.clear();// Shouldn't be needed anymore ??
} else {
+ List<String> coloursToRemove = new ArrayList<String>();
for (String key:tileLaysPerColour.viewKeySet()) {
if (colour.equals(key)) {
- tileLaysPerColour.put(colour, oldAllowedNumber-1);
+ tileLaysPerColour.put(key, oldAllowedNumber-1);
} else {
- tileLaysPerColour.remove(colour);
+ coloursToRemove.add(key);
}
}
+ // Two-step removal to prevent ConcurrentModificatioonException.
+ for (String key : coloursToRemove) {
+ tileLaysPerColour.remove(key);
+ }
log.debug((oldAllowedNumber - 1) + " additional " + colour
+ " tile lays allowed; no other colours");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|