- added support for dev mode paths and removed linux symlinks for game data
- bugfix for segfault on headless when client disconnects
This commit is contained in:
parent
1cacb0df27
commit
581a975209
|
@ -0,0 +1,2 @@
|
|||
DataPath=$APPLICATIONPATH/../../data/glest_game/
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../data/glest_game/maps
|
|
@ -1 +0,0 @@
|
|||
../../data/glest_game/scenarios
|
|
@ -1 +0,0 @@
|
|||
../../data/glest_game/techs
|
|
@ -1 +0,0 @@
|
|||
../../data/glest_game/tilesets
|
|
@ -1 +0,0 @@
|
|||
../../data/glest_game/tutorials
|
|
@ -0,0 +1,2 @@
|
|||
DataPath=$APPLICATIONPATH\..\..\data\glest_game\
|
||||
|
|
@ -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<string,string> &pathCache = CacheManager::getCachedItem< std::map<string,string> >(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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<bool,Socket*> getSocketInfo();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue