diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index e327e300..342760e0 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -62,6 +62,8 @@ const char *GameConstants::path_logs_CacheLookupKey = "logs"; const char *Config::glest_ini_filename = "glest.ini"; const char *Config::glestuser_ini_filename = "glestuser.ini"; +const char *Config::glestkeys_ini_filename = "glestkeys.ini"; +const char *Config::glestuserkeys_ini_filename = "glestuserkeys.ini"; // ===================================================== // class Config @@ -72,31 +74,62 @@ const string defaultNotFoundValue = "~~NOT FOUND~~"; map Config::configList; Config::Config() { - fileLoaded.first = false; - fileLoaded.second = false; - cfgType.first = cfgMainGame; - cfgType.second = cfgUserGame; - fileName.first = ""; - fileName.second = ""; - fileNameParameter.first = ""; - fileNameParameter.second = ""; - fileLoaded.first = false; - fileLoaded.second = false; + fileLoaded.first = false; + fileLoaded.second = false; + cfgType.first = cfgMainGame; + cfgType.second = cfgUserGame; + fileName.first = ""; + fileName.second = ""; + fileNameParameter.first = ""; + fileNameParameter.second = ""; + fileLoaded.first = false; + fileLoaded.second = false; } Config::Config(std::pair type, std::pair file, std::pair fileMustExist) { - fileLoaded.first = false; - fileLoaded.second = false; - cfgType = type; - - fileName = file; - fileNameParameter = file; + fileLoaded.first = false; + fileLoaded.second = false; + cfgType = type; + fileName = file; + fileNameParameter = file; if(getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) != "") { fileName.first = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.first; fileName.second = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.second; } - +// Look in standard linux shared paths for ini files +#if defined(__linux__) + else if(cfgType.first == cfgMainGame && cfgType.second == cfgUserGame && + fileName.first == glest_ini_filename && fileName.second == glestuser_ini_filename) { + string linuxPath = "/usr/share/megaglest/"; + if(fileExists(linuxPath + fileName.first) == true) { + fileName.first = linuxPath + fileName.first; + fileName.second = linuxPath + fileName.second; + } + else { + linuxPath = "/usr/local/share/megaglest/"; + if(fileExists(linuxPath + fileName.first) == true) { + fileName.first = linuxPath + fileName.first; + fileName.second = linuxPath + fileName.second; + } + } + } + else if(cfgType.first == cfgMainKeys && cfgType.second == cfgUserKeys && + fileName.first == glestkeys_ini_filename && fileName.second == glestuserkeys_ini_filename) { + string linuxPath = "/usr/share/megaglest/"; + if(fileExists(linuxPath + fileName.first) == true) { + fileName.first = linuxPath + fileName.first; + fileName.second = linuxPath + fileName.second; + } + else { + linuxPath = "/usr/local/share/megaglest/"; + if(fileExists(linuxPath + fileName.first) == true) { + fileName.first = linuxPath + fileName.first; + fileName.second = linuxPath + fileName.second; + } + } + } +#endif if(fileMustExist.first == true && fileExists(fileName.first) == false) { string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath()); fileName.first = currentpath + fileName.first; diff --git a/source/glest_game/global/config.h b/source/glest_game/global/config.h index 350b529e..b2d7f539 100644 --- a/source/glest_game/global/config.h +++ b/source/glest_game/global/config.h @@ -48,6 +48,10 @@ private: static const char *glest_ini_filename; static const char *glestuser_ini_filename; +public: + static const char *glestkeys_ini_filename; + static const char *glestuserkeys_ini_filename; + protected: Config(); Config(std::pair type, std::pair file, std::pair fileMustExist); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 1f11155f..bdf5f635 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2169,7 +2169,7 @@ int glestMain(int argc, char** argv) { // Setup hotkeys from key ini files Config &configKeys = Config::getInstance( std::pair(cfgMainKeys,cfgUserKeys), - std::pair("glestkeys.ini","glestuserkeys.ini"), + std::pair(Config::glestkeys_ini_filename,Config::glestuserkeys_ini_filename), std::pair(true,false)); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 9826d4ef..cf6e01c7 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -235,7 +235,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType Config &config= Config::getInstance(); showUnitParticles = config.getBool("UnitParticles","true"); - maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","3"); + maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","1"); lastPos= pos; progress= 0; @@ -1472,15 +1472,25 @@ string Unit::getDesc() const { //command info if(commands.empty() == false) { - str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size()); Commands::const_iterator it= commands.begin(); for(unsigned int i = 0; i < min((size_t)maxQueuedCommandDisplayCount,commands.size()); ++i) { const CommandType *ct = (*it)->getCommandType(); - if(commands.size() == 1) { - str += "\n" + ct->getName(); + if(maxQueuedCommandDisplayCount == 1) { + str+= "\n" + ct->getName(); + if(commands.size()>1){ + str+="\n"+lang.get("OrdersOnQueue")+": "+intToStr(commands.size()); + } } else { - str += "\n#" + intToStr(i+1) + " " + ct->getName(); + if(commands.size() == 1) { + str += "\n" + ct->getName(); + } + else { + if(i == 0) { + str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size()); + } + str += "\n#" + intToStr(i+1) + " " + ct->getName(); + } } it++; }