bugfix to allow admin to kick player in same slot multiple times
This commit is contained in:
parent
7acd500c08
commit
995617e91e
|
@ -499,6 +499,8 @@ void Commander::tryResumeGame(bool joinNetworkGame, bool clearCaches) const {
|
|||
}
|
||||
|
||||
void Commander::tryNetworkPlayerDisconnected(int factionIndex) const {
|
||||
//printf("tryNetworkPlayerDisconnected factionIndex: %d\n",factionIndex);
|
||||
|
||||
NetworkCommand command(this->world,nctPlayerStatusChange, factionIndex, npst_Disconnected);
|
||||
pushNetworkCommand(&command);
|
||||
}
|
||||
|
@ -905,6 +907,8 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
|
||||
GameSettings *settings = world->getGameSettingsPtr();
|
||||
if(playerStatus == npst_Disconnected) {
|
||||
//printf("Commander nctPlayerStatusChange factionIndex: %d\n",factionIndex);
|
||||
|
||||
settings->setNetworkPlayerStatuses(factionIndex,npst_Disconnected);
|
||||
|
||||
//printf("nctPlayerStatusChange -> faction->getPersonalityType() = %d index [%d] control [%d] networkstatus [%d]\n",
|
||||
|
|
|
@ -2261,9 +2261,11 @@ void Game::update() {
|
|||
server->gameSettings.setFactionControl(i,ctNetwork);
|
||||
ConnectionSlot *slot = server->getSlot(faction->getStartLocationIndex());
|
||||
server->gameSettings.setNetworkPlayerName(i,slot->getName());
|
||||
server->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
|
||||
this->gameSettings.setFactionControl(i,ctNetwork);
|
||||
this->gameSettings.setNetworkPlayerName(i,server->gameSettings.getNetworkPlayerName(i));
|
||||
this->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
}
|
||||
}
|
||||
//printf("#1 Data synch: lmap %u ltile: %d ltech: %u\n",gameSettings.getMapCRC(),gameSettings.getTilesetCRC(),gameSettings.getTechCRC());
|
||||
|
@ -2302,6 +2304,10 @@ void Game::update() {
|
|||
this->gameSettings.setFactionControl(i,ctNetwork);
|
||||
this->gameSettings.setNetworkPlayerName(i,server->gameSettings.getNetworkPlayerName(i));
|
||||
|
||||
if(this->gameSettings.getNetworkPlayerStatuses(i) == npst_Disconnected) {
|
||||
this->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
}
|
||||
|
||||
//printf("START Purging AI player for index: %d\n",i);
|
||||
masterController.clearSlaves(true);
|
||||
delete aiInterfaces[i];
|
||||
|
@ -3578,6 +3584,10 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
isSlotJoinInProgressClient = true;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("isSlotJoinInProgressClient: %d [%d] [%d][%d] [%d] [%d] [%d]\n",
|
||||
// isSlotJoinInProgressClient,faction->getPersonalityType(),faction->getIndex(),world.getThisFaction()->getIndex(),faction->getControlType(),this->gameSettings.getNetworkPlayerStatuses(i),i);
|
||||
|
||||
if(isSlotJoinInProgressClient == true ||
|
||||
(faction->getPersonalityType() != fpt_Observer &&
|
||||
world.getThisFaction()->getIndex() != faction->getIndex() &&
|
||||
|
|
|
@ -739,8 +739,18 @@ void Renderer::endGame(bool isFinalEnd) {
|
|||
this->game= NULL;
|
||||
this->gameCamera = NULL;
|
||||
|
||||
try {
|
||||
quadCache = VisibleQuadContainerCache();
|
||||
quadCache.clearFrustumData();
|
||||
}
|
||||
catch(const exception &e) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
if(isFinalEnd) {
|
||||
//delete resources
|
||||
|
|
|
@ -1041,7 +1041,10 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
int factionIndex = this->serverInterface->gameSettings.getFactionIndexForStartLocation(playerIndex);
|
||||
this->serverInterface->gameSettings.setFactionControl(factionIndex,ctNetwork);
|
||||
this->serverInterface->gameSettings.setNetworkPlayerName(factionIndex,this->name);
|
||||
//this->serverInterface->gameSettings.setNetworkPlayerStatuses(factionIndex,npst_None);
|
||||
|
||||
if(this->serverInterface->gameSettings.getNetworkPlayerStatuses(factionIndex) == npst_Disconnected) {
|
||||
this->serverInterface->gameSettings.setNetworkPlayerStatuses(factionIndex,npst_None);
|
||||
}
|
||||
|
||||
this->serverInterface->broadcastGameSetup(&this->serverInterface->gameSettings, true);
|
||||
|
||||
|
|
|
@ -533,6 +533,7 @@ bool ServerInterface::switchSlot(int fromPlayerIndex, int toPlayerIndex) {
|
|||
ConnectionSlot *tmp = slots[toPlayerIndex];
|
||||
slots[toPlayerIndex] = slots[fromPlayerIndex];
|
||||
slots[fromPlayerIndex] = tmp;
|
||||
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
PlayerIndexMessage playerIndexMessage(toPlayerIndex);
|
||||
|
|
Loading…
Reference in New Issue