}
}
void setUpFunctions(Registry quadRegistry) throws RulesetException {
Messages messages = Messages.getMessages();
FunctionManager functionManager = quadMap.getFunctionManager();
QuadMap.Mode mode = quadMap.getMode();
String functionSection = null;
switch (mode) {
case GAME:
functionSection = "game";
break;
case SCENARIO:
functionSection = "scenario";
break;
}
try {
// Set up functions defined by quadMap itself
RulesetFunctionLoader.addFunctions(functionManager,
quadRegistry.toSwifuRegistry().
getRuleset("functions").
getSection(functionSection));
} catch (InvalidInputEventException e) {
messages.err("QuadMap.Config", "civquest.swing.quadmap.Configuration.load says: ");
messages.err("QuadMap.Config", "Input-event " + e.getEvent() + " (assigned to"
+ " function " + e.getFunction() + ") has "
+ "invalid syntax!");
messages.err("QuadMap.Config", "===> CivQuest will abort now!");
System.exit(-1);
} catch (NoSuchFunctionActionException e) {
messages.err("QuadMap.Config", "civquest.swing.quadmap.Configuration.load says: ");
messages.err("QuadMap.Config", "Nothing known about function " + e.getFunction());
messages.err("QuadMap.Config", "===> CivQuest will abort now!");
System.exit(-1);
} catch (InvalidParameterException e) {
messages.err("QuadMap.Config", "civquest.swing.quadmap.Configuration.load says: ");
messages.err("QuadMap.Config", "There is a problem with the parameters: "
+ e.getMessage());
messages.err("QuadMap.Config", "===> CivQuest will abort now!");
System.exit(-1);
} catch (InvalidRulesetException e) {
messages.err("QuadMap.Config", "civquest.swing.quadmap.Configuration.load says: ");
messages.err("QuadMap.Config", "The structure of the ruleset-section specifying " +
"the functions is invalid!");
messages.err("QuadMap.Config", "Reason: " + e);
messages.err("QuadMap.Config", "===> CivQuest will abort now!");
System.exit(-1);
} catch (FunctionException e) {
// All exceptions that can occur at this time (2004-09-13) are catched above -
// this catch-block is necessary because of the interface-declaration
messages.err("QuadMap.Config", "civquest.swing.quadmap.Configuration.load says: ");
messages.err("QuadMap.Config", "Some error occured: " + e);
messages.err("QuadMap.Config", "===> CivQuest will abort now!");
System.exit(-1);
}
functionManager.activateAllFunctions(quadMap);
}