mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 19:04:00 +02:00
Comparison of version numbers allows non integer characters too
This is used to check compatibility of saved games typically. Only the leading digits are used as minor version now.
This commit is contained in:
@@ -819,9 +819,20 @@ int getMajor(string version){
|
|||||||
|
|
||||||
int getMinor(string version){
|
int getMinor(string version){
|
||||||
vector<string> parts=split(version.substr(1),".");
|
vector<string> parts=split(version.substr(1),".");
|
||||||
|
if(parts.size()>2 && parts[1] != ""){
|
||||||
if(parts.size()>2 && parts[1] != "" && IsNumeric(parts[1].c_str(),false))
|
string resultStr="";
|
||||||
return strToInt(parts[1]);
|
for (int i = 0; i < (int)parts[1].length(); ++i) {
|
||||||
|
// just add leading numbers
|
||||||
|
if(IsNumeric((resultStr+parts[1][i]).c_str(),false) )
|
||||||
|
resultStr += parts[1][i];
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(resultStr=="")
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return strToInt(resultStr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user