- added many new things and fixed a number of bugs (too tried to mention them all)

This commit is contained in:
Mark Vejvoda
2010-06-24 01:23:18 +00:00
parent a842909e7d
commit 1d4f47718c
23 changed files with 444 additions and 47 deletions

View File

@@ -61,7 +61,8 @@ ServerInterface::ServerInterface(){
switchSetupRequests[i]= NULL;
}
serverSocket.setBlock(false);
serverSocket.bind(Config::getInstance().getInt("ServerPort",intToStr(GameConstants::serverPort).c_str()));
//serverSocket.bind(Config::getInstance().getInt("ServerPort",intToStr(GameConstants::serverPort).c_str()));
serverSocket.setBindPort(Config::getInstance().getInt("ServerPort",intToStr(GameConstants::serverPort).c_str()));
}
ServerInterface::~ServerInterface(){
@@ -85,6 +86,10 @@ void ServerInterface::addSlot(int playerIndex){
assert(playerIndex>=0 && playerIndex<GameConstants::maxPlayers);
if(serverSocket.isPortBound() == false) {
serverSocket.bind(serverSocket.getBindPort());
}
delete slots[playerIndex];
slots[playerIndex]= new ConnectionSlot(this, playerIndex);
updateListen();
@@ -681,11 +686,10 @@ void ServerInterface::quitGame(bool userManuallyQuit)
{
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
if(userManuallyQuit == true)
{
string sQuitText = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " has chosen to leave the game!";
NetworkMessageText networkMessageText(sQuitText,getHostName(),-1);
broadcastMessage(&networkMessageText, -1);
if(userManuallyQuit == true) {
//string sQuitText = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " has chosen to leave the game!";
//NetworkMessageText networkMessageText(sQuitText,getHostName(),-1);
//broadcastMessage(&networkMessageText, -1);
}
NetworkMessageQuit networkMessageQuit;