Package civquest.io

Examples of civquest.io.Messages


    }

  public QuadFieldView[][] constructFieldViews(NationInfo nationInfo)
    throws RulesetException {

    Messages messages = Messages.getMessages();

        if (whichFieldView.equals("QuadIsoLayeredFieldView")) {
            return constructLayeredFV(nationInfo);
        } else {
      messages.info("QuadMap.IsoProp", "QMapFV", "FallBack",
              "No valid FieldView specified");
      messages.info("QuadMap.IsoProp", "QMapFV", "FallBack",
              "--> Using QuadIsoLayeredFieldView as an default");
            return constructLayeredFV(nationInfo);
        }   
  }
View Full Code Here


    this.quadMap = quadMap;
    }

    public void load(Registry quadMapRegistry, Registry overlapRegistry)
    throws RulesetException {
    Messages messages = Messages.getMessages();
   
    Ruleset settingsRuleset = quadMapRegistry.getRuleset("settings");
    Section gensection = settingsRuleset.getSection("general");

        Section paintingSection = settingsRuleset.getSection("painting");
        String whichWFPainterString = paintingSection.getField("whichWFPainter").getStringValue();
        if (whichWFPainterString.equals("LineEdgeWFPainter")) {
            quadMap.setWFPainter(new LineEdgeWFPainter());
    } else if (whichWFPainterString.equals("CircleWFPainter")) {
      quadMap.setWFPainter(new CircleWFPainter());
        } else if (whichWFPainterString.equals("None")) {
            quadMap.setWFPainter(null);
        } else {
      messages.info("QuadMap.Config", "QMapConf", "FallDefault", whichWFPainterString +
                               " is not a valid WorkingFieldPainter");
      messages.info("QuadMap.Config", "QMapConf", "FallDefault",
              "--> Using LineEdgeWFPainter as a default");
            quadMap.setWFPainter(new LineEdgeWFPainter());
        }

    String whichFMString = paintingSection.getField("whichFMPainter").getStringValue();
    if (whichFMString.equals("LineEdge")) {
      quadMap.setFMPainter(new LineEdgeFMPainter());
    } else if (whichWFPainterString.equals("None")) {
      quadMap.setFMPainter(null);
    } else {
      messages.info("QuadMap.Config", "QMapConf", "FallDefault", whichWFPainterString +
              " is not a valid WorkingFieldPainter");
      messages.info("QuadMap.Config", "QMapConf", "FallDefault",
              "--> Using LineEdge as a default");
            quadMap.setFMPainter(new LineEdgeFMPainter());
    }

    String whichTerrainOM = paintingSection.getField("whichTerrainOverlapManager")
      .getStringValue();

    TerrainOverlapManager omManager;
    if (whichTerrainOM.equals("Random")) {
      // hack for now
      omManager = null;
//       omManager = new RandomTerrainOverlapManager(quadMap.getGameData(),
//                             overlapRegistry);
    } else if (whichTerrainOM.equals("None")) {
      omManager = null;
    } else {
      messages.info("QuadMap.Config", "QMapConf", "FallDefault", whichTerrainOM +
                 " is not a valid TerrainOverlapManager");
      messages.info("QuadMap.Config", "QMapConf", "FallDefault",
              "--> Using RandomTerrainOverlapManager as a default!");
      omManager = new RandomTerrainOverlapManager(quadMap.getGameData(),
                            overlapRegistry);     
    }
    quadMap.setTerrainOverlapManager(omManager);
   
    Section mpSection = settingsRuleset.getSection("movePaths");
    displayMovePaths = mpSection.getField("display").getBoolValue();
    mpGestLength = mpSection.getField("gestLength").getIntValue();
    mpMarkTurnEnds = mpSection.getField("markTurnEnds").getBoolValue();
    mpTurnEndArcRadius = mpSection.getField("turnEndArcRadius").getIntValue();
    mpDisplaySpeed = mpSection.getField("displaySpeed").getBoolValue();
    String tdmString = mpSection.getField("turnDisplayMode").getStringValue();
    if (tdmString.equals("none")) {
      mpTurnDisplayMode = MP_TDM_NONE;
    } else if (tdmString.equals("relativeTurns")) {
      mpTurnDisplayMode = MP_TDM_RELATIVE_TURNS;
    } else if (tdmString.equals("absoluteTurns")) {
      mpTurnDisplayMode = MP_TDM_ABSOLUTE_TURNS;
    } else if (tdmString.equals("years")) {
      mpTurnDisplayMode = MP_TDM_YEARS;
    } else {
      messages.info("QuadMap.Config", "QMapConf", "FallDefault",
              "section movePaths, field turnDisplayMode:");
      messages.info("QuadMap.Config", "QMapConf", "FallDefault",
              "--> " + tdmString + " is no valid mode - assuming none "
              + "(display nothing)");
      mpTurnDisplayMode = MP_TDM_NONE;
    }
    mpDisplayTime = mpSection.getField("displayTime").getBoolValue();
View Full Code Here

  private void loadBufferManager(String which) {
    if (which.equals("Point")) {
      quadMap.setBufferManager(new PointBufferManager(quadMap, gridMaxStoredPixels * 4));
    } else {
      Messages messages = Messages.getMessages();
      messages.info("QuadMap.Config", "QMapConf", "FallBack",
              which + " is not a valid BufferManager!");
      messages.info("QuadMap.Config", "QMapConf", "FallBack",
              "--> Using PointBufferManager as a default...");
      quadMap.setBufferManager(new PointBufferManager(quadMap, gridMaxStoredPixels * 4));
    }
  }
 
View Full Code Here

      quadMap.setBufferManager(new PointBufferManager(quadMap, gridMaxStoredPixels * 4));
    }
  }

  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);
View Full Code Here

   * @param name image-name
   * @return Image with the given name, null if no usable image-file exists
   *        
   */
  public Image getImage(String name) {
    Messages messages = Messages.getMessages();
    if (subsetMap.get(name) != null) {
      // This shouldn't really happen
      messages.err("ImageSet", "You try to get " + name
             + " as an image although it exists also "
             + " as an subset-name!  ====> Aborting...");
      System.exit(-1);
      return null;
    } else if (imageMap.get(name) != null) {
      // The image is already stored, so no further loading is required
      return imageMap.get(name);
    } else {
      Iterator<String> iterator = new ImageNameIterator(name);
      while (iterator.hasNext()) {
        String fileName = iterator.next();
        URL loadingURL = null;
        try {
          loadingURL = LoadingSource.getLoadingSource().resolve(baseURL, fileName);
        } catch (MalformedURLException e) {
          messages.err("ImageSet", "getImage says: " + e + " => Aborting NOW!");
          System.exit(-1);
        }

        if (LoadingSource.getLoadingSource().doesPathExist(loadingURL)) {
          // See discussion getImage <--> createImage in the Java-API
View Full Code Here

  /********************** SubImageSet-stuff ******************************/
  /***********************************************************************/

  public ImageSet getSubImageSet(String name) {
    Messages messages = Messages.getMessages();
   
    // Error-handling should be implemented (case subset doesn't exist)

    ImageSet oldSubSet = subsetMap.get(name);
    if (oldSubSet != null) {
      return oldSubSet;
    else {
      try {
        ImageSet newSubSet
          = new ImageSet(LoadingSource.getLoadingSource().resolve(baseURL, name
                   + LoadingSource.getLoadingSource().getDirectorySeparator()));
        subsetMap.put(name, newSubSet);
        return newSubSet;
      } catch (MalformedURLException e) {
        messages.err("ImageSet", "getSubImageSet says: " + e + " ===> Aborting NOW!");
        System.exit(-1);
      }

      // Can never be reached - is enforced by javac...
      return null;
View Full Code Here

      Ruleset providesRuleset = gcRegistry.getRuleset("provides");
      RulesetGameChangeLoader.addDefRulesetContents(providesRuleset);     

     
    } catch (RulesetException e) {
      Messages messages = Messages.getMessages();
      messages.info("CivQuest", "GCDef", "Error: " + e);
      System.exit(-1);
    } catch (GameChangeException e) {
      Messages messages = Messages.getMessages();     
      messages.info("CivQuest", "GCDef", "Error: " + e);
      System.exit(-1);
    }
  }
View Full Code Here

    this.location = location;
  }

  public void execute() {
      notifyBefore();
      Messages messages = Messages.getMessages();
        MapData mapData = Game.getMapData();

        Field field = mapData.getField(location);
        Nation nation = Game.getGame().getNation(ownerNation);

        Iterator<Unit> unitsIt = field.getUnitIterator();
        if (unitsIt.hasNext()) {
            Unit unit = unitsIt.next();
            if (!unit.getOwner().equals(nation)) {
                messages.err("ConstructCity", "You try to build a city " +
                        "on a field where another nation's unit is located.");
                return;
            }
        }
       
        if (field.getCityOnField() != null &&
                !field.getCityOnField().getOwner().equals(nation)) {
            messages.err("ConstructCity", "You try to build a city " +
            "on a field where another nation's city is located.");
            return;
        }

        City city = new City(field, "New City");
View Full Code Here

       String prefix = FunctionFieldViewManager.FIELDVIEW_PREFIX;
       String oldFunctionName = function.getName();
       String newFunctionName   = FunctionManager.cutSuperComponentPrefix(oldFunctionName,
                                         prefix);

      Messages messages = Messages.getMessages();
                             
       if (newFunctionName == null) {
        messages.err("AbstractFieldView", "constructFVFunctionActions says: "
               + oldFunctionName + " does not start with "
               + prefix);
        messages.err("AbstractFieldView", "--> Aborting...");
         System.exit(-1);
       } else {
         FieldViewFunctionAction functionAction
           = new FieldViewFunctionAction(manager, newFunctionName);
         function.setAction(functionAction);    
View Full Code Here

    if (whichTerrainView.equals("LayeredTerrainView")) {
      return new QuadIsoLayTerrainView(position, this, quadMap,
                       registry, tilesIsoImageSet,
                       size, gameData);
    } else {
      Messages messages = Messages.getMessages();
      messages.err("QuadIsoLayeredFV", whichTerrainView
             + " is not a valid terrain-view!!!");
      messages.err("QuadIsoLayeredFV",
             "--> Using LayeredTerrainView instead");
      return new QuadIsoLayTerrainView(position, this, quadMap,
                       registry, tilesIsoImageSet,
                       size, gameData);
    }
View Full Code Here

TOP

Related Classes of civquest.io.Messages

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.