colors = new int[numNations];
// traverse nations by index and store names as well as index for each nation
Map<Nation, Integer> nationIDs = new HashMap<>(numNations);
for (int i = 0; i < numNations; i++) {
Nation nation = nations.getElementAt(i);
nationIDs.put(nation, i);
names[i] = nation.getProperty(Nation.KEY_NAME);
colors[i] = nation.getColor().getRGB();
}
// traverse map and store index for each nation or Max value if ther eis no nation (sea)
for (int row = 0; row < rows; row++) {
for (int column = 0; column < columns; column++) {
Nation nation = scenario.getNationAt(new MapPosition(row, column));
if (nation != null) {
// put the nations ID
politicalMap[row][column] = nationIDs.get(nation);
} else {
// it's sea