From b57fb0ff39a1b4cc757f8db90b534ac1b9be7b9e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 28 Sep 2011 15:51:13 +0000 Subject: [PATCH] - validation so admin client connected to headless server cannot change his 'control type' because this would invalidate his connection. --- source/glest_game/menu/menu_state_connected_game.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 2126ed804..aa0b5bef3 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1191,9 +1191,16 @@ void MenuStateConnectedGame::mouseClickAdmin(int x, int y, MouseButton mouseButt //} //ensure thet only 1 human player is present - if(listBoxControls[i].mouseClick(x, y)) { + int oldSelectedIndex = listBoxControls[i].getSelectedItemIndex(); + if(clientInterface != NULL && clientInterface->getGameSettings() != NULL && + clientInterface->getGameSettings()->getThisFactionIndex() != i && + listBoxControls[i].mouseClick(x, y)) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(listBoxControls[i].getSelectedItemIndex() == ctNetworkUnassigned) { + listBoxControls[i].mouseClick(x, y); + } + //look for human players // int humanIndex1= -1; // int humanIndex2= -1;