first working version of "game hints" displayed while loading. ( still missing language support and techtree specific hint support )

This commit is contained in:
Titus Tscharntke
2012-06-17 22:52:30 +00:00
parent f5e8a523e3
commit dc99918cfe
5 changed files with 63 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
#include "util.h"
#include "platform_common.h"
#include "platform_util.h"
#include "randomgen.h"
#ifdef WIN32
#include <shlwapi.h>
@@ -416,6 +417,21 @@ const string Properties::getString(const string &key, const char *defaultValueIf
}
}
const string Properties::getRandomString(const bool realrandom) const{
PropertyMap::const_iterator it;
int max=getPropertyCount();
int randomIndex=-1;
if(realrandom == true){
randomIndex=rand()%max;
}
else{
RandomGen randgen;
randomIndex=randgen.randRange(0,max);
}
string s=getString(randomIndex);
return (s != "" ? s : "nothing found");
}
bool Properties::hasString(const string &key) const {
PropertyMap::const_iterator it;
it= propertyMap.find(key);
@@ -451,9 +467,6 @@ string Properties::toString(){
return rStr;
}
bool Properties::getBool(const char *key, const char *defaultValueIfNotFound) const{
try{
return strToBool(getString(key,defaultValueIfNotFound));