mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 03:14:00 +02:00
- if holding ctrl while click to change the player type we will change all non human slots to the same player control type
This commit is contained in:
@@ -1240,10 +1240,22 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
//printf("listBoxControls[i].mouseClick(x, y) is TRUE i = %d newcontrol = %d\n",i,listBoxControls[i].getSelectedItemIndex());
|
//printf("listBoxControls[i].mouseClick(x, y) is TRUE i = %d newcontrol = %d\n",i,listBoxControls[i].getSelectedItemIndex());
|
||||||
|
|
||||||
|
int slotsToChangeStart = i;
|
||||||
|
int slotsToChangeEnd = i;
|
||||||
|
// If control is pressed while changing player types then change all other slots to same type
|
||||||
|
if(Window::isKeyStateModPressed(KMOD_CTRL) == true) {
|
||||||
|
slotsToChangeStart = 0;
|
||||||
|
slotsToChangeEnd = mapInfo.players-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int index = slotsToChangeStart; index <= slotsToChangeEnd; ++index) {
|
||||||
|
if(index != i) {
|
||||||
|
listBoxControls[index].setSelectedItemIndex(listBoxControls[i].getSelectedItemIndex());
|
||||||
|
}
|
||||||
// Skip over networkunassigned
|
// Skip over networkunassigned
|
||||||
if(listBoxControls[i].getSelectedItemIndex() == ctNetworkUnassigned &&
|
if(listBoxControls[index].getSelectedItemIndex() == ctNetworkUnassigned &&
|
||||||
selectedControlItemIndex != ctNetworkUnassigned) {
|
selectedControlItemIndex != ctNetworkUnassigned) {
|
||||||
listBoxControls[i].mouseClick(x, y);
|
listBoxControls[index].mouseClick(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//look for human players
|
//look for human players
|
||||||
@@ -1265,14 +1277,14 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
|
|
||||||
//no human
|
//no human
|
||||||
if(humanIndex1 == -1 && humanIndex2 == -1) {
|
if(humanIndex1 == -1 && humanIndex2 == -1) {
|
||||||
listBoxControls[i].setSelectedItemIndex(ctHuman);
|
listBoxControls[index].setSelectedItemIndex(ctHuman);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] i = %d, labelPlayerNames[i].getText() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,labelPlayerNames[i].getText().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] i = %d, labelPlayerNames[i].getText() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,index,labelPlayerNames[index].getText().c_str());
|
||||||
|
|
||||||
//printf("humanIndex1 = %d humanIndex2 = %d i = %d listBoxControls[i].getSelectedItemIndex() = %d\n",humanIndex1,humanIndex2,i,listBoxControls[i].getSelectedItemIndex());
|
//printf("humanIndex1 = %d humanIndex2 = %d i = %d listBoxControls[i].getSelectedItemIndex() = %d\n",humanIndex1,humanIndex2,i,listBoxControls[i].getSelectedItemIndex());
|
||||||
}
|
}
|
||||||
//2 humans
|
//2 humans
|
||||||
else if(humanIndex1 != -1 && humanIndex2 != -1) {
|
else if(humanIndex1 != -1 && humanIndex2 != -1) {
|
||||||
int closeSlotIndex = (humanIndex1 == i ? humanIndex2: humanIndex1);
|
int closeSlotIndex = (humanIndex1 == index ? humanIndex2: humanIndex1);
|
||||||
int humanSlotIndex = (closeSlotIndex == humanIndex1 ? humanIndex2 : humanIndex1);
|
int humanSlotIndex = (closeSlotIndex == humanIndex1 ? humanIndex2 : humanIndex1);
|
||||||
|
|
||||||
string origPlayName = labelPlayerNames[closeSlotIndex].getText();
|
string origPlayName = labelPlayerNames[closeSlotIndex].getText();
|
||||||
@@ -1293,7 +1305,8 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
needToSetChangedGameSettings = true;
|
needToSetChangedGameSettings = true;
|
||||||
lastSetChangedGameSettings = time(NULL);
|
lastSetChangedGameSettings = time(NULL);
|
||||||
}
|
}
|
||||||
updateResourceMultiplier(i);
|
updateResourceMultiplier(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(buttonClearBlockedPlayers.mouseClick(x, y)) {
|
else if(buttonClearBlockedPlayers.mouseClick(x, y)) {
|
||||||
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
||||||
|
@@ -135,6 +135,7 @@ public:
|
|||||||
static const bool getIsFullScreen() { return isFullScreen; }
|
static const bool getIsFullScreen() { return isFullScreen; }
|
||||||
static void setIsFullScreen(bool value) { isFullScreen = value; }
|
static void setIsFullScreen(bool value) { isFullScreen = value; }
|
||||||
//static SDL_keysym getKeystate() { return keystate; }
|
//static SDL_keysym getKeystate() { return keystate; }
|
||||||
|
static bool isKeyStateModPressed(int mod);
|
||||||
|
|
||||||
Window();
|
Window();
|
||||||
virtual ~Window();
|
virtual ~Window();
|
||||||
|
@@ -1022,4 +1022,13 @@ bool isAllowedInputTextKey(SDLKey key) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::isKeyStateModPressed(int mod) {
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("isKeyStateModPressed mod = %d, keystate.mod = %d, keystate.mod & mod = %d\n",mod,keystate.mod,(keystate.mod & mod));
|
||||||
|
|
||||||
|
if(keystate.mod & mod) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
Reference in New Issue
Block a user