Beispiel #1
0
    @Override
    protected void load(final Iff iff) {
      iff.enterForm();
      iff.enterChunk();
      final int paramCount = iff.readInt();
      iff.exitChunk();
      for (int i = 0; i < paramCount; ++i) {
        iff.enterChunk();
        final String parameterName = iff.readString();

        if ("type".equalsIgnoreCase(parameterName)) {
          type.loadFromIff(objectTemplateList, iff);
        } else if ("effectiveness".equalsIgnoreCase(parameterName)) {
          effectiveness.loadFromIff(objectTemplateList, iff);
        } else {
          LOGGER.trace("Unexpected parameter {}", parameterName);
        }

        iff.exitChunk();
      }
      iff.exitForm();
    }
  @Override
  protected void load(final Iff iff) {
    if (iff.getCurrentName() != TAG_SHAREDFACTORYOBJECTTEMPLATE) {
      super.load(iff);
      return;
    }

    iff.enterForm();
    templateVersion = iff.getCurrentName();

    if (templateVersion == Tag.TAG_DERV) {
      iff.enterForm();
      iff.enterChunk();
      final String baseFilename = iff.readString();
      iff.exitChunk();
      final ObjectTemplate base = objectTemplateList.fetch(baseFilename);
      Preconditions.checkNotNull(base, "was unable to load base template %s", baseFilename);
      if (baseData == base && base != null) {
        base.releaseReference();
      } else {
        if (baseData != null) baseData.releaseReference();
        baseData = base;
      }
      iff.exitForm();
      templateVersion = iff.getCurrentName();
    }

    iff.enterForm();
    iff.enterChunk();
    final int paramCount = iff.readInt();
    iff.exitChunk();
    iff.exitForm();

    super.load(iff);
    iff.exitForm();
  }
Beispiel #3
0
  @Override
  protected void load(final Iff iff) {
    if (iff.getCurrentName() != TAG_SERVERARMORTEMPLATE) {
      return;
    }

    iff.enterForm();
    templateVersion = iff.getCurrentName();

    if (templateVersion == Tag.TAG_DERV) {
      iff.enterForm();
      iff.enterChunk();
      final String baseFilename = iff.readString();
      iff.exitChunk();
      final ObjectTemplate base = objectTemplateList.fetch(baseFilename);
      Preconditions.checkNotNull(base, "was unable to load base template %s", baseFilename);
      if (baseData == base && base != null) {
        base.releaseReference();
      } else {
        if (baseData != null) baseData.releaseReference();
        baseData = base;
      }
      iff.exitForm();
      templateVersion = iff.getCurrentName();
    }

    iff.enterForm();
    iff.enterChunk();
    final int paramCount = iff.readInt();
    iff.exitChunk();
    for (int i = 0; i < paramCount; ++i) {
      iff.enterChunk();
      final String parameterName = iff.readString();

      if ("rating".equalsIgnoreCase(parameterName)) {
        rating.loadFromIff(objectTemplateList, iff);
      } else if ("integrity".equalsIgnoreCase(parameterName)) {
        integrity.loadFromIff(objectTemplateList, iff);
      } else if ("effectiveness".equalsIgnoreCase(parameterName)) {
        effectiveness.loadFromIff(objectTemplateList, iff);
      } else if ("specialProtection".equalsIgnoreCase(parameterName)) {
        specialProtection.clear();
        specialProtectionAppend = iff.readBoolean();
        int listCount = iff.readInt();
        for (int j = 0; j < listCount; ++j) {
          final StructParam<ObjectTemplate> newData = new StructParam<ObjectTemplate>();
          newData.loadFromIff(objectTemplateList, iff);
          specialProtection.add(newData);
        }
        specialProtectionLoaded = true;
      } else if ("vulnerability".equalsIgnoreCase(parameterName)) {
        vulnerability.loadFromIff(objectTemplateList, iff);
      } else if ("encumbrance".equalsIgnoreCase(parameterName)) {
        int listCount = iff.readInt();
        int j;
        for (j = 0; j < 3 && j < listCount; ++j)
          encumbrance[j].loadFromIff(objectTemplateList, iff);
        for (; j < listCount; ++j) {
          final IntegerParam dummy = new IntegerParam();
          dummy.loadFromIff(objectTemplateList, iff);
        }
      } else {
        LOGGER.trace("Unexpected parameter {}", parameterName);
      }

      iff.exitChunk();
    }
    iff.exitForm();
  }