- moved version checking into one common method in the util file. Now all network related checks use this common method to determine version compatibility

This commit is contained in:
Mark Vejvoda
2010-10-15 17:27:00 +00:00
parent 1353f61069
commit 59c5fd2581
5 changed files with 30 additions and 19 deletions

View File

@@ -180,6 +180,7 @@ int round(float f);
//misc
bool fileExists(const string &path);
bool checkVersionComptability(string clientVersionString, string serverVersionString);
template<typename T>
void deleteValues(T beginIt, T endIt){

View File

@@ -542,4 +542,24 @@ bool fileExists(const string &path){
return false;
}
bool checkVersionComptability(string clientVersionString, string serverVersionString) {
bool compatible = (clientVersionString == serverVersionString);
if(compatible == false) {
vector<string> tokens;
vector<string> tokensServer;
Tokenize(clientVersionString,tokens,".");
Tokenize(serverVersionString,tokensServer,".");
// only check the first 3 sections with . to compare makor versions #'s
compatible = (tokens.size() >= 3 && tokensServer.size() >= 3);
for(int i = 0; compatible == true && i < 3; ++i) {
if(tokens[i] != tokensServer[i]) {
compatible = false;
}
}
}
return compatible;
}
}}//end namespace