示例#1
0
APIModVersion::APIModVersion(CharString versionstr){ // discards name split from ':', only keeps version number
    major = minor = submajor = subminor = 0;
    atleastver = false;
    
    // forget modname if it is still in the string
    if(versionstr.contains(":")){
        LinkedList<CharString> vsplit = versionstr.split(":");
        versionstr = vsplit[1];
    }
    
    this->versionstring = versionstr; // keep original string
    
    if(versionstr.startsWith(">")){
        atleastver = true;
        versionstr.shiftLeft(1);
    }
    
    if(versionstr.startsWith("v")) versionstr.shiftLeft(1);
    
    if(versionstr.contains(".")){
        LinkedList<CharString> vsplit = versionstr.split(".");
        if(vsplit[0].isValidNumber()) major = vsplit[0].getInt();
        if(vsplit[1].isValidNumber()) minor = vsplit[1].getInt();
        if(vsplit.size() >= 3 && vsplit[2].isValidNumber()) submajor = vsplit[2].getInt();
        if(vsplit.size() >= 4 && vsplit[3].isValidNumber()) subminor = vsplit[3].getInt();
    }else{
        // what? Single version number?
        if(versionstr.isValidNumber()){
            major = versionstr.getInt();
        }else{
            // dunno...
            cout << "API Mod Version could not figure out the version for " << versionstring << endl;
        }
    }
}
示例#2
0
// assigns Number from Temp String. Posts number to NumStack.
void dumpNum(char* numString, int strlen) {
    if(strlen > 0) {
        CharString* NTemp = new CharString(numString,strlen);
        numString[strlen] = 0x0;
        NumStack->push(NTemp->getInt());

        delete NTemp;
    }
}