diff --git a/mk/linux/glest-dev.ini b/mk/linux/glest-dev.ini new file mode 100644 index 000000000..b9b86d20b --- /dev/null +++ b/mk/linux/glest-dev.ini @@ -0,0 +1,2 @@ +DataPath=$APPLICATIONPATH/../../data/glest_game/ + diff --git a/mk/linux/maps b/mk/linux/maps deleted file mode 120000 index 9410d14ab..000000000 --- a/mk/linux/maps +++ /dev/null @@ -1 +0,0 @@ -../../data/glest_game/maps \ No newline at end of file diff --git a/mk/linux/scenarios b/mk/linux/scenarios deleted file mode 120000 index 3bdbc9f44..000000000 --- a/mk/linux/scenarios +++ /dev/null @@ -1 +0,0 @@ -../../data/glest_game/scenarios \ No newline at end of file diff --git a/mk/linux/techs b/mk/linux/techs deleted file mode 120000 index e9282ccb2..000000000 --- a/mk/linux/techs +++ /dev/null @@ -1 +0,0 @@ -../../data/glest_game/techs \ No newline at end of file diff --git a/mk/linux/tilesets b/mk/linux/tilesets deleted file mode 120000 index 0e1e5915a..000000000 --- a/mk/linux/tilesets +++ /dev/null @@ -1 +0,0 @@ -../../data/glest_game/tilesets \ No newline at end of file diff --git a/mk/linux/tutorials b/mk/linux/tutorials deleted file mode 120000 index 8f5397e4b..000000000 --- a/mk/linux/tutorials +++ /dev/null @@ -1 +0,0 @@ -../../data/glest_game/tutorials \ No newline at end of file diff --git a/mk/windoze/glest-dev.ini b/mk/windoze/glest-dev.ini new file mode 100644 index 000000000..47796a5a0 --- /dev/null +++ b/mk/windoze/glest-dev.ini @@ -0,0 +1,2 @@ +DataPath=$APPLICATIONPATH\..\..\data\glest_game\ + diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index a540037f1..65701e7ab 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -1300,6 +1300,12 @@ int setupGameItemPaths(int argc, char** argv, Config *config) { // Setup path cache for files and folders used in the game std::map &pathCache = CacheManager::getCachedItem< std::map >(GameConstants::pathCacheLookupKey); + Properties devProperties; + string devPropertyFile = Properties::getApplicationPath() + "glest-dev.ini"; + if(fileExists(devPropertyFile) == true) { + devProperties.load(devPropertyFile); + } + //GAME_ARG_DATA_PATH if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DATA_PATH]) == true) { int foundParamIndIndex = -1; @@ -1329,13 +1335,26 @@ int setupGameItemPaths(int argc, char** argv, Config *config) { } } else if(config != NULL) { - if(config->getString("DataPath","") != "") { - string customPathValue = config->getString("DataPath",""); - if(customPathValue != "") { + bool foundPath = false; + string customPathValue = ""; + + if(fileExists(devPropertyFile) == true && devProperties.hasString("DataPath") == true) { + foundPath = true; + customPathValue = devProperties.getString("DataPath",""); + } + else if(config->getString("DataPath","") != "") { + foundPath = true; + customPathValue = config->getString("DataPath",""); + } + + if(foundPath == true) { + pathCache[GameConstants::path_data_CacheLookupKey] = customPathValue; + + if(customPathValue != "") { endPathWithSlash(customPathValue); } - pathCache[GameConstants::path_data_CacheLookupKey] = config->getString("DataPath",""); + Properties::setApplicationDataPath(pathCache[GameConstants::path_data_CacheLookupKey]); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using ini specified data path [%s]\n",config->getString("DataPath","").c_str()); @@ -1390,8 +1409,21 @@ int setupGameItemPaths(int argc, char** argv, Config *config) { } } else if(config != NULL) { - if(config->getString("LogPath","") != "") { - pathCache[GameConstants::path_logs_CacheLookupKey] = config->getString("LogPath",""); + + bool foundPath = false; + string customPathValue = ""; + + if(fileExists(devPropertyFile) == true && devProperties.hasString("LogPath") == true) { + foundPath = true; + customPathValue = devProperties.getString("LogPath",""); + } + else if(config->getString("LogPath","") != "") { + foundPath = true; + customPathValue = config->getString("LogPath",""); + } + + if(foundPath == true) { + pathCache[GameConstants::path_logs_CacheLookupKey] = customPathValue; if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using ini specified logs path [%s]\n",config->getString("LogPath","").c_str()); } } diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index 93fd00dd6..7f277e946 100644 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -512,6 +512,15 @@ void ClientInterface::update() { } } +std::string ClientInterface::getIpAddress(bool mutexLock) { + string result = ""; + //MutexSafeWrapper safeMutexSlot((mutexLock == true ? mutexSocket : NULL),CODE_AT_LINE); + if(clientSocket != NULL) { + result = clientSocket->getIpAddress(); + } + return result; +} + std::string ClientInterface::getServerIpAddress() { return this->ip.getString(); } diff --git a/source/glest_game/network/client_interface.h b/source/glest_game/network/client_interface.h index 29ea701bc..75e9ef496 100644 --- a/source/glest_game/network/client_interface.h +++ b/source/glest_game/network/client_interface.h @@ -111,6 +111,7 @@ public: ClientInterface(); virtual ~ClientInterface(); + virtual std::string getIpAddress(bool mutexLock=true); virtual Socket* getSocket(bool mutexLock=true) {return clientSocket;} virtual void close(); diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index d96476561..f73236049 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -516,6 +516,15 @@ void ConnectionSlot::updateSlot(ConnectionSlotEvent *event) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } +string ConnectionSlot::getIpAddress(bool mutexLock) { + string result = ""; + MutexSafeWrapper safeMutexSlot((mutexLock == true ? mutexSocket : NULL),CODE_AT_LINE); + if(socket != NULL) { + result = socket->getIpAddress(); + } + return result; +} + void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) { try { clearThreadErrorList(); diff --git a/source/glest_game/network/connection_slot.h b/source/glest_game/network/connection_slot.h index 9e84e952b..48906fefc 100644 --- a/source/glest_game/network/connection_slot.h +++ b/source/glest_game/network/connection_slot.h @@ -205,6 +205,8 @@ public: void setName(string value) {name = value;} bool isReady() const {return ready;} + virtual std::string getIpAddress(bool mutexLock=true); + virtual Socket* getSocket(bool mutexLock=true); pair getSocketInfo(); diff --git a/source/glest_game/network/network_interface.cpp b/source/glest_game/network/network_interface.cpp index 2f77c9fd8..8ff4d2360 100644 --- a/source/glest_game/network/network_interface.cpp +++ b/source/glest_game/network/network_interface.cpp @@ -327,16 +327,6 @@ void NetworkInterface::setHighlightedCell(const MarkedCell &msg){ highlightedCellList.push_back(msg); } -std::string NetworkInterface::getIpAddress() { - std::string result = ""; - - Socket *socket = getSocket(); - if(socket != NULL) { - result = socket->getIpAddress(); - } - return result; -} - float NetworkInterface::getThreadedPingMS(std::string host) { float result = -1; diff --git a/source/glest_game/network/network_interface.h b/source/glest_game/network/network_interface.h index e00c0f55f..686c66e3e 100644 --- a/source/glest_game/network/network_interface.h +++ b/source/glest_game/network/network_interface.h @@ -223,6 +223,7 @@ public: void setNetworkPlayerFactionCRC(int index, uint32 crc); virtual Socket* getSocket(bool mutexLock=true)= 0; + virtual void close()= 0; virtual string getHumanPlayerName(int index=-1) = 0; virtual int getHumanPlayerIndex() const = 0; @@ -230,6 +231,7 @@ public: static void setDisplayMessageFunction(DisplayMessageFunction pDisplayMessage) { pCB_DisplayMessage = pDisplayMessage; } static DisplayMessageFunction getDisplayMessageFunction() { return pCB_DisplayMessage; } + virtual std::string getIpAddress(bool mutexLock=true) = 0; string getIp() const {return Socket::getIp();} string getHostName() const {return Socket::getHostName();} @@ -279,7 +281,6 @@ public: NetworkMessagePing getLastPingInfo(); double getLastPingLag(); - std::string getIpAddress(); float getThreadedPingMS(std::string host); string getNetworkGameDataSynchCheckTechMismatchReport() const {return networkGameDataSynchCheckTechMismatchReport;} diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index c6600dfc4..30171ea0c 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -1043,6 +1043,15 @@ void ServerInterface::checkForCompletedClientsUsingLoop( } } +std::string ServerInterface::getIpAddress(bool mutexLock) { + string result = ""; + //MutexSafeWrapper safeMutexSlot((mutexLock == true ? mutexSocket : NULL),CODE_AT_LINE); + //if(serverSocket != NULL) { + result = serverSocket.getIpAddress(); + //} + return result; +} + void ServerInterface::setClientLagCallbackInterface(ClientLagCallbackInterface *intf) { this->clientLagCallbackInterface = intf; } diff --git a/source/glest_game/network/server_interface.h b/source/glest_game/network/server_interface.h index ecc7870d3..3547e50ad 100644 --- a/source/glest_game/network/server_interface.h +++ b/source/glest_game/network/server_interface.h @@ -121,6 +121,7 @@ public: void setGameStats(Stats *gameStats); virtual Socket* getSocket(bool mutexLock=true) {return &serverSocket;} + virtual std::string getIpAddress(bool mutexLock=true); time_t getGameStartTime() const { return gameStartTime; }