mirror of
https://github.com/glest/glest-source.git
synced 2025-08-19 22:51:24 +02:00
- threading bugfixes from the client join menu
This commit is contained in:
@@ -45,13 +45,14 @@ const string MenuStateJoinGame::serverFileName= "servers.ini";
|
|||||||
MenuStateJoinGame::MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect, Ip serverIp):
|
MenuStateJoinGame::MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect, Ip serverIp):
|
||||||
MenuState(program, mainMenu, "join-game")
|
MenuState(program, mainMenu, "join-game")
|
||||||
{
|
{
|
||||||
|
abortAutoFind = false;
|
||||||
|
autoConnectToServer = false;
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||||
networkManager.end();
|
networkManager.end();
|
||||||
networkManager.init(nrClient);
|
networkManager.init(nrClient);
|
||||||
abortAutoFind = false;
|
|
||||||
|
|
||||||
serversSavedFile = serverFileName;
|
serversSavedFile = serverFileName;
|
||||||
if(getGameReadWritePath() != "") {
|
if(getGameReadWritePath() != "") {
|
||||||
serversSavedFile = getGameReadWritePath() + serversSavedFile;
|
serversSavedFile = getGameReadWritePath() + serversSavedFile;
|
||||||
@@ -147,6 +148,7 @@ void MenuStateJoinGame::DiscoveredServers(std::vector<string> serverList) {
|
|||||||
//serverList.push_back("test2");
|
//serverList.push_back("test2");
|
||||||
//
|
//
|
||||||
|
|
||||||
|
autoConnectToServer = false;
|
||||||
buttonAutoFindServers.setEnabled(true);
|
buttonAutoFindServers.setEnabled(true);
|
||||||
if(serverList.size() > 0) {
|
if(serverList.size() > 0) {
|
||||||
string bestIPMatch = "";
|
string bestIPMatch = "";
|
||||||
@@ -167,7 +169,7 @@ void MenuStateJoinGame::DiscoveredServers(std::vector<string> serverList) {
|
|||||||
listBoxFoundServers.setItems(serverList);
|
listBoxFoundServers.setItems(serverList);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
connectToServer();
|
autoConnectToServer = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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__);
|
||||||
@@ -431,6 +433,10 @@ void MenuStateJoinGame::update()
|
|||||||
|
|
||||||
//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__);
|
||||||
}
|
}
|
||||||
|
else if(autoConnectToServer == true) {
|
||||||
|
autoConnectToServer = false;
|
||||||
|
connectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
if(clientInterface->getLaunchGame()) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - D\n",__FILE__,__FUNCTION__);
|
if(clientInterface->getLaunchGame()) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - D\n",__FILE__,__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,7 @@ private:
|
|||||||
|
|
||||||
string serversSavedFile;
|
string serversSavedFile;
|
||||||
bool abortAutoFind;
|
bool abortAutoFind;
|
||||||
|
bool autoConnectToServer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect= false, Ip serverIp= Ip());
|
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect= false, Ip serverIp= Ip());
|
||||||
|
@@ -1202,11 +1202,9 @@ void ClientSocket::stopBroadCastClientThread() {
|
|||||||
|
|
||||||
if(broadCastClientThread != NULL) {
|
if(broadCastClientThread != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
BaseThread::shutdownAndWait(broadCastClientThread);
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
delete broadCastClientThread;
|
delete broadCastClientThread;
|
||||||
broadCastClientThread = NULL;
|
broadCastClientThread = NULL;
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
@@ -1446,14 +1444,15 @@ void BroadCastClientSocketThread::execute() {
|
|||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
setRunningStatus(false);
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Broadcast Client thread is exiting\n");
|
|
||||||
|
|
||||||
// Here we callback into the implementer class
|
// Here we callback into the implementer class
|
||||||
if(discoveredServersCB != NULL) {
|
if(discoveredServersCB != NULL) {
|
||||||
discoveredServersCB->DiscoveredServers(foundServers);
|
discoveredServersCB->DiscoveredServers(foundServers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Broadcast Client thread is exiting\n");
|
||||||
|
setRunningStatus(false);
|
||||||
|
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1482,11 +1481,9 @@ void ServerSocket::stopBroadCastThread() {
|
|||||||
|
|
||||||
if(broadCastThread != NULL) {
|
if(broadCastThread != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
BaseThread::shutdownAndWait(broadCastThread);
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
delete broadCastThread;
|
delete broadCastThread;
|
||||||
broadCastThread = NULL;
|
broadCastThread = NULL;
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
Reference in New Issue
Block a user