mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- bugfix for multi-unit selection (pressing shift does not unselect previously selected units now)
This commit is contained in:
@@ -883,13 +883,16 @@ void Gui::computeSelected(bool doubleClick){
|
||||
bool controlDown= isKeyDown(vkControl);
|
||||
|
||||
if(!shiftDown && !controlDown){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to call selection.clear()\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
selection.clear();
|
||||
}
|
||||
|
||||
if(!controlDown){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to call selection.select(units)\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
selection.select(units);
|
||||
}
|
||||
else{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] selection.unSelect(units)\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
selection.unSelect(units);
|
||||
}
|
||||
}
|
||||
|
@@ -794,8 +794,12 @@ bool isKeyDown(int virtualKey) {
|
||||
char key = static_cast<char> (virtualKey);
|
||||
const Uint8* keystate = SDL_GetKeyState(0);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
|
||||
|
||||
// kinda hack and wrong...
|
||||
if(key >= 0) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] keystate[key] = %d\n",__FILE__,__FUNCTION__,__LINE__,keystate[key]);
|
||||
|
||||
return keystate[key];
|
||||
}
|
||||
switch(key) {
|
||||
@@ -827,6 +831,7 @@ bool isKeyDown(int virtualKey) {
|
||||
std::cerr << "isKeyDown called with unknown key.\n";
|
||||
break;
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning false\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -553,6 +553,15 @@ char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) {
|
||||
case SDLK_RSHIFT:
|
||||
return vkShift;
|
||||
}
|
||||
if(keysym.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||
return vkAlt;
|
||||
}
|
||||
else if(keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
|
||||
return vkControl;
|
||||
}
|
||||
else if(keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
return vkShift;
|
||||
}
|
||||
}
|
||||
switch(keysym.sym) {
|
||||
case SDLK_PLUS:
|
||||
@@ -663,7 +672,7 @@ char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) {
|
||||
if(c == 0) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(skipSpecialKeys == false) {
|
||||
if(skipSpecialKeys == true) {
|
||||
switch(keysym.sym) {
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
@@ -675,6 +684,16 @@ char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) {
|
||||
case SDLK_RSHIFT:
|
||||
return vkShift;
|
||||
}
|
||||
|
||||
if(keysym.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||
return vkAlt;
|
||||
}
|
||||
else if(keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
|
||||
return vkControl;
|
||||
}
|
||||
else if(keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
return vkShift;
|
||||
}
|
||||
}
|
||||
|
||||
c = keysym.sym;
|
||||
|
Reference in New Issue
Block a user