Skip to content

Commit

Permalink
Fix 12855 Failed to start game (#12856)
Browse files Browse the repository at this point in the history
* Fix issue 12826 (UnitSeparator#categorize:213 - java.util.ConcurrentModificationException)

PlacePanel.java
- new method updateUnitsInUnitsToPlacePanel that ensures copying the unit collection (existed already in method updateStep, but not in gameDataChanged or updateUnits)
- Cleanup: extract new methods from declaration of variable placeMapSelectionListener which are getUnitsToPlace, getScrollPaneFromChooser, getPreferredHeight and getPreferredWidth

* PlayerUnitsPanel ToDo done via redraw

Replace
invalidate(); validate(); revalidate();getParent().invalidate();
with SwingComponents.redraw(this);

* tab Players - tooltips for technologies

Smaller fixes:
- SwingConstants instead of JLable
- method setStatColumns with List.toArray
- rename gameData to gameDataSync
- introduce synchronized method TechTableModel.getDataAndInitRowMap()

* Fix 12855 Failed to start game

Example map: World War II v3 1941
UnsupportedOperationException caused by Arrays.asList (=fixed size list) followed with method call add()
  • Loading branch information
frigoref authored Aug 24, 2024
1 parent be37ef5 commit 676d230
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.Image;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -192,8 +193,11 @@ class StatTableModel extends AbstractTableModel {
}

void setStatColumns() {
final List<IStat> statsList =
Arrays.asList(new PuStat(), new ProductionStat(), new UnitsStat(), new TuvStat());
final List<IStat> statsList = new ArrayList<>();
statsList.add(new PuStat());
statsList.add(new ProductionStat());
statsList.add(new UnitsStat());
statsList.add(new TuvStat());
if (gameData.getMap().getTerritories().stream().anyMatch(Matches.territoryIsVictoryCity())) {
statsList.add(new VictoryCityStat());
}
Expand Down

0 comments on commit 676d230

Please sign in to comment.