* @param gameDataAccessor new game-data, required to be != null
*/
public void newData(GameDataAccessor gameDataAccessor) {
// marking/unmarking?
Messages messages = Messages.getMessages();
assert gameDataAccessor != null;
this.gameDataAccessor = gameDataAccessor;
// hack to make it run in 0.0.22
if (gameDataToNationInfo.containsKey(gameDataAccessor)
&& gameDataAccessor == Game.getGame()) {
gameDataToNationInfo.remove(gameDataAccessor);
}
if (gameDataToNationInfo.containsKey(gameDataAccessor)) {
nationInfo = gameDataToNationInfo.get(gameDataAccessor);
scroll(nationInfo.getShowPosition(), getShowSize());
} else {
try {
nationInfo = new NationInfo(gameDataAccessor, this);
java.util.List<Section> listenerSections
= properties.getListenerSectionsForParent();
Iterator<Section> iterator = listenerSections.listIterator();
while (iterator.hasNext()) {
Section currSection = iterator.next();
try {
RulesetGameChangeLoader.addListener(currSection,
nationInfo);
} catch (GameChangeException e) {
messages.err("QuadMap.IsoProp", "Error "
+ "when setting up listeners: " + e);
System.exit(-1);
}
}
gameDataToNationInfo.put(gameDataAccessor, nationInfo);
bufferManager.registerNation(gameDataAccessor);
if (!fvFunctionsActivated) {
Set<Function> fieldViewFunctions
= nationInfo.getOneFieldViewFunctions();
FunctionManager
.addSuperComponentPrefix(fieldViewFunctions,
FunctionFieldViewManager.
FIELDVIEW_PREFIX);
AbstractFieldView
.constructFVFunctionActions(fieldViewFunctions, this);
functionManager.addFunctions(fieldViewFunctions);
functionManager.deactivateAllFunctions(this);
functionManager.activateAllFunctions(this);
fvFunctionsActivated = true;
}
} catch (InvalidInputEventException e) {
messages.err("QuadMap", "civquest.swing.quadmap.QuadMap." +
"newData says: ");
messages.err("QuadMap", "Input-event " + e.getEvent()
+ " (assigned to"
+ " function " + e.getFunction() + ") has "
+ "invalid syntax!");
messages.err("QuadMap", "===> CivQuest will abort now!");
System.exit(-1);
} catch (InvalidParameterException e) {
messages.err("QuadMap", "civquest.swing.quadmap.QuadMap.newData says: ");
messages.err("QuadMap", "There is a problem with the parameters: "
+ e.getMessage());
messages.err("QuadMap", "===> CivQuest will abort now!");
System.exit(-1);
} catch (InvalidRulesetException e) {
messages.err("QuadMap", "civquest.swing.quadmap.QuadMap.newData says: ");
messages.err("QuadMap", "The structure of the ruleset-section specifying " +
"the functions is invalid!");
messages.err("QuadMap", "Reason: " + e);
messages.err("QuadMap", "===> CivQuest will abort now!");
System.exit(-1);
} catch (FunctionException e) {
messages.err("QuadMap", "civquest.swing.quadmap.QuadMap.newData says: ");
messages.err("QuadMap", "Some error occured: " + e);
messages.err("QuadMap", "===> CivQuest will abort now!");
System.exit(-1);
} catch (RulesetException e) {
e.printStackTrace();
String message = "There was an error related to ruleset-loading:\n "