Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

bool Agi::WagFileParser::checkAgiVersionProperty ( const WagProperty version ) const

Tests if the given property contains a valid AGI interpreter version string. A valid AGI interpreter version string is of the form "X.Y" or "X,Y" where X is a single decimal digit and Y is a string of decimal digits (At least one digit).

Parameters:
versionThe property to be tested.
Returns:
True if the given property contains a valid AGI interpreter version string, false otherwise.

Definition at line 116 of file wagparser.cpp.

References Agi::WagProperty::getCode(), Agi::WagProperty::getData(), Agi::WagProperty::getSize(), and Agi::WagProperty::PC_INTVERSION.

Referenced by convertToAgiVersionNumber(), and AgiMetaEngine::fallbackDetect().

                                                                            {
      if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property
            version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y"
            isdigit(version.getData()[0]) && // And the first character must be a digit
            (version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period

            for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits
                  if (!isdigit(version.getData()[i]))
                        return false; // Bail out if found a non-digit after the decimal point

            return true;
      } else // Didn't pass the preliminary test so fails
            return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index