- bugfix for transifex tutorial download files now loaded into UI
- updated each thread to provide its name
This commit is contained in:
parent
5cfc4d07a0
commit
5b664fb1a2
|
@ -40,6 +40,7 @@ AiInterfaceThread::AiInterfaceThread(AiInterface *aiIntf) : BaseThread() {
|
|||
this->masterController = NULL;
|
||||
this->triggerIdMutex = new Mutex();
|
||||
this->aiIntf = aiIntf;
|
||||
uniqueID = "AiInterfaceThread";
|
||||
}
|
||||
|
||||
AiInterfaceThread::~AiInterfaceThread() {
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace Glest{ namespace Game{
|
|||
CommanderNetworkThread::CommanderNetworkThread() : BaseThread() {
|
||||
this->idStatus = make_pair<int,bool>(-1,false);
|
||||
this->commanderInterface = NULL;
|
||||
uniqueID = "CommanderNetworkThread";
|
||||
}
|
||||
|
||||
CommanderNetworkThread::CommanderNetworkThread(CommanderNetworkCallbackInterface *commanderInterface) : BaseThread() {
|
||||
|
|
|
@ -1134,7 +1134,11 @@ void Game::load(int loadTypes) {
|
|||
if((loadTypes & lgt_Scenario) == lgt_Scenario) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(scenarioName.empty() == false) {
|
||||
Lang::getInstance().loadScenarioStrings(gameSettings.getScenarioDir(), scenarioName);
|
||||
|
||||
bool isTutorial = Scenario::isGameTutorial(gameSettings.getScenarioDir());
|
||||
//printf("Loading scenario gameSettings.getScenarioDir() [%s] scenarioName [%s] isTutorial: %d\n",gameSettings.getScenarioDir().c_str(),scenarioName.c_str(),isTutorial);
|
||||
|
||||
Lang::getInstance().loadScenarioStrings(gameSettings.getScenarioDir(), scenarioName, isTutorial);
|
||||
|
||||
//printf("In [%s::%s Line: %d] rootNode [%p][%s]\n",__FILE__,__FUNCTION__,__LINE__,loadGameNode,(loadGameNode != NULL ? loadGameNode->getName().c_str() : "none"));
|
||||
world.loadScenario(gameSettings.getScenarioDir(), &checksum, false,loadGameNode);
|
||||
|
@ -2451,8 +2455,10 @@ void Game::update() {
|
|||
|
||||
//printf("\nname [%s] scenarioFile [%s] results.size() = " MG_SIZE_T_SPECIFIER "\n",name.c_str(),scenarioFile.c_str(),results.size());
|
||||
//printf("[%s:%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
bool isTutorial = Scenario::isGameTutorial(scenarioFile);
|
||||
ScenarioInfo scenarioInfo;
|
||||
Scenario::loadScenarioInfo(scenarioFile, &scenarioInfo);
|
||||
Scenario::loadScenarioInfo(scenarioFile, &scenarioInfo, isTutorial);
|
||||
|
||||
//printf("[%s:%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
GameSettings gameSettings;
|
||||
|
|
|
@ -373,7 +373,6 @@ private:
|
|||
|
||||
bool switchSetupForSlots(ServerInterface *& serverInterface,
|
||||
int startIndex, int endIndex, bool onlyNetworkUnassigned);
|
||||
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -206,12 +206,20 @@ bool Lang::isUTF8Language() const {
|
|||
return is_utf8_language;
|
||||
}
|
||||
|
||||
void Lang::loadScenarioStrings(string scenarioDir, string scenarioName){
|
||||
void Lang::loadScenarioStrings(string scenarioDir, string scenarioName, bool isTutorial) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scenarioDir = [%s] scenarioName = [%s]\n",__FILE__,__FUNCTION__,__LINE__,scenarioDir.c_str(),scenarioName.c_str());
|
||||
|
||||
//printf("Loading scenario scenarioDir [%s] scenarioName [%s]\n",scenarioDir.c_str(),scenarioName.c_str());
|
||||
|
||||
// First try to find scenario lng file in userdata
|
||||
Config &config = Config::getInstance();
|
||||
vector<string> scenarioPaths = config.getPathListForType(ptScenarios);
|
||||
vector<string> scenarioPaths;
|
||||
if(isTutorial == false) {
|
||||
scenarioPaths = config.getPathListForType(ptScenarios);
|
||||
}
|
||||
else {
|
||||
scenarioPaths = config.getPathListForType(ptTutorials);
|
||||
}
|
||||
if(scenarioPaths.size() > 1) {
|
||||
string &scenarioPath = scenarioPaths[1];
|
||||
endPathWithSlash(scenarioPath);
|
||||
|
@ -242,6 +250,8 @@ void Lang::loadScenarioStrings(string scenarioDir, string scenarioName){
|
|||
|
||||
//try to load the current language first
|
||||
if(fileExists(path)) {
|
||||
//printf("#2 Loading scenario path [%s]\n",path.c_str());
|
||||
|
||||
scenarioStrings.load(path);
|
||||
}
|
||||
else{
|
||||
|
@ -252,6 +262,8 @@ void Lang::loadScenarioStrings(string scenarioDir, string scenarioName){
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||
|
||||
if(fileExists(path)){
|
||||
//printf("#3 Loading scenario path [%s]\n",path.c_str());
|
||||
|
||||
scenarioStrings.load(path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
static Lang &getInstance();
|
||||
|
||||
void loadStrings(string uselanguage, bool loadFonts=true, bool fallbackToDefault=false);
|
||||
void loadScenarioStrings(string scenarioDir, string scenarioName);
|
||||
void loadScenarioStrings(string scenarioDir, string scenarioName, bool isTutorial);
|
||||
void loadTechTreeStrings(string techTree);
|
||||
void loadTilesetStrings(string tileset);
|
||||
|
||||
|
|
|
@ -466,7 +466,8 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
|
||||
try {
|
||||
if(file != "") {
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo);
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo, isTutorial);
|
||||
|
||||
bool isNetworkScenario = false;
|
||||
for(unsigned int j = 0; isNetworkScenario == false && j < GameConstants::maxPlayers; ++j) {
|
||||
|
@ -4278,7 +4279,9 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
string scenario = gameSettings->getScenario();
|
||||
listBoxScenario.setSelectedItem(formatString(scenario));
|
||||
string file = Scenario::getScenarioPath(dirList, scenario);
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo);
|
||||
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo, isTutorial);
|
||||
|
||||
gameSettings->setScenarioDir(Scenario::getScenarioPath(dirList, scenarioInfo.name));
|
||||
|
||||
|
@ -4971,7 +4974,8 @@ void MenuStateConnectedGame::setupTilesetList(string scenario) {
|
|||
|
||||
void MenuStateConnectedGame::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
||||
//printf("Load scenario file [%s]\n",file.c_str());
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo);
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo, isTutorial);
|
||||
|
||||
//cleanupPreviewTexture();
|
||||
previewLoadDelayTimer=time(NULL);
|
||||
|
|
|
@ -668,7 +668,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
|
||||
try {
|
||||
if(file != "") {
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo);
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, &scenarioInfo, isTutorial);
|
||||
|
||||
bool isNetworkScenario = false;
|
||||
for(unsigned int j = 0; isNetworkScenario == false && j < GameConstants::maxPlayers; ++j) {
|
||||
|
@ -4207,7 +4208,8 @@ int32 MenuStateCustomGame::getNetworkPlayerStatus() {
|
|||
|
||||
void MenuStateCustomGame::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
||||
//printf("Load scenario file [%s]\n",file.c_str());
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo);
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo, isTutorial);
|
||||
|
||||
//cleanupPreviewTexture();
|
||||
previewLoadDelayTimer=time(NULL);
|
||||
|
|
|
@ -347,7 +347,8 @@ void MenuStateScenario::setScenario(int i) {
|
|||
}
|
||||
|
||||
void MenuStateScenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo);
|
||||
bool isTutorial = Scenario::isGameTutorial(file);
|
||||
Scenario::loadScenarioInfo(file, scenarioInfo, isTutorial);
|
||||
|
||||
cleanupPreviewTexture();
|
||||
previewLoadDelayTimer=time(NULL);
|
||||
|
|
|
@ -45,6 +45,7 @@ const bool debugClientInterfacePerf = false;
|
|||
|
||||
ClientInterfaceThread::ClientInterfaceThread(ClientInterface *client) : BaseThread() {
|
||||
this->clientInterface = client;
|
||||
uniqueID = "ClientInterfaceThread";
|
||||
}
|
||||
|
||||
ClientInterfaceThread::~ClientInterfaceThread() {
|
||||
|
|
|
@ -37,6 +37,7 @@ ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
|||
this->triggerIdMutex = new Mutex();
|
||||
this->slotIndex = slotIndex;
|
||||
this->slotInterface = NULL;
|
||||
uniqueID = "ConnectionSlotThread";
|
||||
//this->event = NULL;
|
||||
eventList.clear();
|
||||
eventList.reserve(100);
|
||||
|
@ -47,6 +48,7 @@ ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slot
|
|||
this->triggerIdMutex = new Mutex();
|
||||
this->slotIndex = slotIndex;
|
||||
this->slotInterface = slotInterface;
|
||||
uniqueID = "ConnectionSlotThread";
|
||||
//this->event = NULL;
|
||||
eventList.clear();
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ FactionThread::FactionThread(Faction *faction) : BaseThread() {
|
|||
this->triggerIdMutex = new Mutex();
|
||||
this->faction = faction;
|
||||
this->masterController = NULL;
|
||||
uniqueID = "FactionThread";
|
||||
}
|
||||
|
||||
FactionThread::~FactionThread() {
|
||||
|
|
|
@ -54,7 +54,8 @@ Checksum Scenario::load(const string &path) {
|
|||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingScenario","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
Scenario::loadScenarioInfo(path, &info);
|
||||
bool isTutorial = Scenario::isGameTutorial(path);
|
||||
Scenario::loadScenarioInfo(path, &info, isTutorial);
|
||||
|
||||
//parse xml
|
||||
XmlTree xmlTree;
|
||||
|
@ -153,7 +154,25 @@ string Scenario::getFunctionName(const XmlNode *scriptNode){
|
|||
return name;
|
||||
}
|
||||
|
||||
void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
||||
bool Scenario::isGameTutorial(string path) {
|
||||
bool isTutorial = false;
|
||||
Config &config = Config::getInstance();
|
||||
vector<string> tutorialPaths = config.getPathListForType(ptTutorials);
|
||||
if(tutorialPaths.empty() == false) {
|
||||
for(unsigned int tutorialIndex = 0; tutorialIndex < tutorialPaths.size(); ++tutorialIndex) {
|
||||
const string &tutorialPath = tutorialPaths[tutorialIndex];
|
||||
size_t pos = path.find( tutorialPath );
|
||||
if( pos != path.npos ) {
|
||||
isTutorial = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isTutorial;
|
||||
}
|
||||
|
||||
void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo, bool isTutorial) {
|
||||
//printf("[%s:%s] Line: %d file [%s]\n",__FILE__,__FUNCTION__,__LINE__,file.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] file [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str());
|
||||
//printf("In [%s::%s Line: %d] file [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str());
|
||||
|
@ -309,7 +328,7 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
|||
|
||||
|
||||
//look for description and append it
|
||||
lang.loadScenarioStrings(scenarioDir,scenarioName.c_str());
|
||||
lang.loadScenarioStrings(scenarioDir,scenarioName.c_str(),isTutorial);
|
||||
//string tmp_description = lang.getScenarioString("DESCRIPTION");
|
||||
string tmp_description = "";
|
||||
if(lang.hasScenarioString("DESCRIPTION") == true) {
|
||||
|
|
|
@ -135,12 +135,13 @@ public:
|
|||
|
||||
ScenarioInfo getInfo() const { return info; }
|
||||
|
||||
static bool isGameTutorial(string path);
|
||||
static string getScenarioPath(const vector<string> dir, const string &scenarioName, bool getMatchingRootScenarioPathOnly=false);
|
||||
static string getScenarioPath(const string &dir, const string &scenarioName);
|
||||
static int getScenarioPathIndex(const vector<string> dirList, const string &scenarioName);
|
||||
static string getScenarioDir(const vector<string> dir, const string &scenarioName);
|
||||
|
||||
static void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo);
|
||||
static void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo,bool isTutorial);
|
||||
static ControlType strToControllerType(const string &str);
|
||||
static string controllerTypeToStr(const ControlType &ct);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ FileCRCPreCacheThread::FileCRCPreCacheThread() : BaseThread() {
|
|||
techDataPaths.clear();
|
||||
workerThreadTechPaths.clear();
|
||||
processTechCB = NULL;
|
||||
uniqueID = "FileCRCPreCacheThread";
|
||||
}
|
||||
|
||||
FileCRCPreCacheThread::FileCRCPreCacheThread(vector<string> techDataPaths,
|
||||
|
@ -39,6 +40,7 @@ FileCRCPreCacheThread::FileCRCPreCacheThread(vector<string> techDataPaths,
|
|||
this->techDataPaths = techDataPaths;
|
||||
this->workerThreadTechPaths = workerThreadTechPaths;
|
||||
this->processTechCB = processTechCB;
|
||||
uniqueID = "FileCRCPreCacheThread";
|
||||
}
|
||||
|
||||
bool FileCRCPreCacheThread::canShutdown(bool deleteSelfIfShutdownDelayed) {
|
||||
|
@ -346,6 +348,7 @@ SimpleTaskThread::SimpleTaskThread( SimpleTaskCallbackInterface *simpleTaskInter
|
|||
bool needTaskSignal) : BaseThread(),
|
||||
simpleTaskInterface(NULL),
|
||||
overrideShutdownTask(NULL) {
|
||||
uniqueID = "SimpleTaskThread";
|
||||
this->simpleTaskInterface = simpleTaskInterface;
|
||||
this->executionCount = executionCount;
|
||||
this->millisecsBetweenExecutions = millisecsBetweenExecutions;
|
||||
|
@ -525,6 +528,7 @@ bool SimpleTaskThread::getTaskSignalled() {
|
|||
// -------------------------------------------------
|
||||
|
||||
LogFileThread::LogFileThread() : BaseThread() {
|
||||
uniqueID = "LogFileThread";
|
||||
logList.clear();
|
||||
lastSaveToDisk = time(NULL);
|
||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||
|
|
|
@ -517,6 +517,7 @@ void IRCThread::setEventDataDone(bool value) {
|
|||
}
|
||||
|
||||
IRCThread::IRCThread(const std::vector<string> &argv, IRCCallbackInterface *callbackObj) : BaseThread() {
|
||||
uniqueID = "IRCThread";
|
||||
this->argv = argv;
|
||||
this->callbackObj = callbackObj;
|
||||
ircSession = NULL;
|
||||
|
|
|
@ -242,6 +242,8 @@ FTPClientThread::FTPClientThread(int portNumber, string serverUrl,
|
|||
string fileArchiveExtractCommandParameters,
|
||||
int fileArchiveExtractCommandSuccessResult,
|
||||
string tempFilesPath) : BaseThread() {
|
||||
|
||||
uniqueID = "FTPClientThread";
|
||||
this->portNumber = portNumber;
|
||||
this->serverUrl = serverUrl;
|
||||
this->mapsPath = mapsPath;
|
||||
|
|
|
@ -74,6 +74,8 @@ FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,
|
|||
bool allowInternetTilesetFileTransfers, bool allowInternetTechtreeFileTransfers,
|
||||
int portNumber, int maxPlayers,
|
||||
FTPClientValidationInterface *ftpValidationIntf, string tempFilesPath) : BaseThread() {
|
||||
|
||||
uniqueID = "FTPServerThread";
|
||||
this->mapsPath = mapsPath;
|
||||
this->tilesetsPath = tilesetsPath;
|
||||
this->techtreesPath = techtreesPath;
|
||||
|
|
|
@ -2010,6 +2010,7 @@ BroadCastClientSocketThread::BroadCastClientSocketThread(DiscoveredServersInterf
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
discoveredServersCB = cb;
|
||||
uniqueID = "BroadCastClientSocketThread";
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
@ -2782,6 +2783,7 @@ BroadCastSocketThread::BroadCastSocketThread(int boundPort) : BaseThread() {
|
|||
mutexPauseBroadcast = new Mutex();
|
||||
setPauseBroadcast(false);
|
||||
this->boundPort = boundPort;
|
||||
uniqueID = "BroadCastSocketThread";
|
||||
//printf("new broadcast thread [%p]\n",this);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
|||
}
|
||||
public:
|
||||
ThreadGarbageCollector() : BaseThread() {
|
||||
uniqueID = "ThreadGarbageCollector";
|
||||
removeThreadFromList();
|
||||
}
|
||||
virtual ~ThreadGarbageCollector() {
|
||||
|
|
Loading…
Reference in New Issue