- changed default command display text to be same as 3.4 but with support to override and show queued commands up to a max of: MaxQueuedCommandDisplayCount=x where x is max queued text to show
- added ini support on linux so it by default looks for glest.ini and glestkeys.ini in /usr/share/megaglest and /usr/local/share/megaglest first
This commit is contained in:
parent
5ef1313296
commit
700e768b0f
|
@ -62,6 +62,8 @@ const char *GameConstants::path_logs_CacheLookupKey = "logs";
|
||||||
const char *Config::glest_ini_filename = "glest.ini";
|
const char *Config::glest_ini_filename = "glest.ini";
|
||||||
const char *Config::glestuser_ini_filename = "glestuser.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
|
// class Config
|
||||||
|
@ -72,31 +74,62 @@ const string defaultNotFoundValue = "~~NOT FOUND~~";
|
||||||
map<ConfigType,Config> Config::configList;
|
map<ConfigType,Config> Config::configList;
|
||||||
|
|
||||||
Config::Config() {
|
Config::Config() {
|
||||||
fileLoaded.first = false;
|
fileLoaded.first = false;
|
||||||
fileLoaded.second = false;
|
fileLoaded.second = false;
|
||||||
cfgType.first = cfgMainGame;
|
cfgType.first = cfgMainGame;
|
||||||
cfgType.second = cfgUserGame;
|
cfgType.second = cfgUserGame;
|
||||||
fileName.first = "";
|
fileName.first = "";
|
||||||
fileName.second = "";
|
fileName.second = "";
|
||||||
fileNameParameter.first = "";
|
fileNameParameter.first = "";
|
||||||
fileNameParameter.second = "";
|
fileNameParameter.second = "";
|
||||||
fileLoaded.first = false;
|
fileLoaded.first = false;
|
||||||
fileLoaded.second = false;
|
fileLoaded.second = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist) {
|
Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist) {
|
||||||
fileLoaded.first = false;
|
fileLoaded.first = false;
|
||||||
fileLoaded.second = false;
|
fileLoaded.second = false;
|
||||||
cfgType = type;
|
cfgType = type;
|
||||||
|
fileName = file;
|
||||||
fileName = file;
|
fileNameParameter = file;
|
||||||
fileNameParameter = file;
|
|
||||||
|
|
||||||
if(getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) != "") {
|
if(getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) != "") {
|
||||||
fileName.first = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.first;
|
fileName.first = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.first;
|
||||||
fileName.second = getGameReadWritePath(GameConstants::path_ini_CacheLookupKey) + fileName.second;
|
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) {
|
if(fileMustExist.first == true && fileExists(fileName.first) == false) {
|
||||||
string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
||||||
fileName.first = currentpath + fileName.first;
|
fileName.first = currentpath + fileName.first;
|
||||||
|
|
|
@ -48,6 +48,10 @@ private:
|
||||||
static const char *glest_ini_filename;
|
static const char *glest_ini_filename;
|
||||||
static const char *glestuser_ini_filename;
|
static const char *glestuser_ini_filename;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const char *glestkeys_ini_filename;
|
||||||
|
static const char *glestuserkeys_ini_filename;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Config();
|
Config();
|
||||||
Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist);
|
Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist);
|
||||||
|
|
|
@ -2169,7 +2169,7 @@ int glestMain(int argc, char** argv) {
|
||||||
// Setup hotkeys from key ini files
|
// Setup hotkeys from key ini files
|
||||||
Config &configKeys = Config::getInstance(
|
Config &configKeys = Config::getInstance(
|
||||||
std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys),
|
std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys),
|
||||||
std::pair<string,string>("glestkeys.ini","glestuserkeys.ini"),
|
std::pair<string,string>(Config::glestkeys_ini_filename,Config::glestuserkeys_ini_filename),
|
||||||
std::pair<bool,bool>(true,false));
|
std::pair<bool,bool>(true,false));
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
|
@ -235,7 +235,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
|
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
showUnitParticles = config.getBool("UnitParticles","true");
|
showUnitParticles = config.getBool("UnitParticles","true");
|
||||||
maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","3");
|
maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","1");
|
||||||
|
|
||||||
lastPos= pos;
|
lastPos= pos;
|
||||||
progress= 0;
|
progress= 0;
|
||||||
|
@ -1472,15 +1472,25 @@ string Unit::getDesc() const {
|
||||||
|
|
||||||
//command info
|
//command info
|
||||||
if(commands.empty() == false) {
|
if(commands.empty() == false) {
|
||||||
str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size());
|
|
||||||
Commands::const_iterator it= commands.begin();
|
Commands::const_iterator it= commands.begin();
|
||||||
for(unsigned int i = 0; i < min((size_t)maxQueuedCommandDisplayCount,commands.size()); ++i) {
|
for(unsigned int i = 0; i < min((size_t)maxQueuedCommandDisplayCount,commands.size()); ++i) {
|
||||||
const CommandType *ct = (*it)->getCommandType();
|
const CommandType *ct = (*it)->getCommandType();
|
||||||
if(commands.size() == 1) {
|
if(maxQueuedCommandDisplayCount == 1) {
|
||||||
str += "\n" + ct->getName();
|
str+= "\n" + ct->getName();
|
||||||
|
if(commands.size()>1){
|
||||||
|
str+="\n"+lang.get("OrdersOnQueue")+": "+intToStr(commands.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
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++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue