mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 03:14:00 +02:00
- attempt to fix client timeout issues in client connected menu when downloading files
- in lobby hold SHIFT + a letter when clicking a map, tileset or techtree and it jumps to the first found item of that letter
This commit is contained in:
@@ -450,23 +450,50 @@ bool GraphicListBox::mouseMove(int x, int y){
|
|||||||
graphButton2.mouseMove(x, y);
|
graphButton2.mouseMove(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicListBox::mouseClick(int x, int y){
|
bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
||||||
if(this->getVisible() == false) {
|
if(this->getVisible() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!items.empty()){
|
if(!items.empty()) {
|
||||||
bool b1= graphButton1.mouseClick(x, y);
|
bool b1= graphButton1.mouseClick(x, y);
|
||||||
bool b2= graphButton2.mouseClick(x, y);
|
bool b2= graphButton2.mouseClick(x, y);
|
||||||
|
|
||||||
if(b1){
|
if(b1) {
|
||||||
selectedItemIndex--;
|
bool bFound = false;
|
||||||
|
if(advanceToItemStartingWith != "") {
|
||||||
|
for(unsigned int i = 0; i < items.size(); ++i) {
|
||||||
|
string item = items[i];
|
||||||
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
|
bFound = true;
|
||||||
|
selectedItemIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(bFound == false) {
|
||||||
|
selectedItemIndex--;
|
||||||
|
}
|
||||||
if(selectedItemIndex<0){
|
if(selectedItemIndex<0){
|
||||||
selectedItemIndex=items.size()-1;
|
selectedItemIndex=items.size()-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(b2){
|
else if(b2) {
|
||||||
selectedItemIndex++;
|
bool bFound = false;
|
||||||
|
if(advanceToItemStartingWith != "") {
|
||||||
|
for(unsigned int i = 0; i < items.size(); ++i) {
|
||||||
|
string item = items[i];
|
||||||
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
|
bFound = true;
|
||||||
|
selectedItemIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(bFound == false) {
|
||||||
|
selectedItemIndex++;
|
||||||
|
}
|
||||||
if(selectedItemIndex>=items.size()){
|
if(selectedItemIndex>=items.size()){
|
||||||
selectedItemIndex=0;
|
selectedItemIndex=0;
|
||||||
}
|
}
|
||||||
|
@@ -249,7 +249,7 @@ public:
|
|||||||
virtual void setY(int y);
|
virtual void setY(int y);
|
||||||
|
|
||||||
virtual bool mouseMove(int x, int y);
|
virtual bool mouseMove(int x, int y);
|
||||||
virtual bool mouseClick(int x, int y);
|
virtual bool mouseClick(int x, int y, string advanceToItemStartingWith="");
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
@@ -2052,17 +2052,21 @@ void MenuStateConnectedGame::update() {
|
|||||||
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__);
|
||||||
|
|
||||||
clientInterface->updateLobby();
|
clientInterface->updateLobby();
|
||||||
MutexSafeWrapper safeMutexFTPProgress((ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
|
||||||
if(fileFTPProgressList.empty() == true) {
|
if(clientInterface->isConnected() &&
|
||||||
Lang &lang= Lang::getInstance();
|
pingCount >= 3 && clientInterface->getLastPingLag() >= (GameConstants::networkPingInterval * 3)) {
|
||||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
MutexSafeWrapper safeMutexFTPProgress((ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
||||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
if(fileFTPProgressList.empty() == true) {
|
||||||
//string playerNameStr = getHumanPlayerName();
|
Lang &lang= Lang::getInstance();
|
||||||
clientInterface->sendTextMessage(lang.get("ConnectionTimedOut",languageList[i]),-1,false,languageList[i]);
|
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||||
sleep(1);
|
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||||
clientInterface->close();
|
//string playerNameStr = getHumanPlayerName();
|
||||||
|
clientInterface->sendTextMessage(lang.get("ConnectionTimedOut",languageList[i]),-1,false,languageList[i]);
|
||||||
|
sleep(1);
|
||||||
|
clientInterface->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pingCount++;
|
pingCount++;
|
||||||
|
@@ -1026,7 +1026,13 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(activeInputLabel!=NULL && !(activeInputLabel->mouseClick(x,y))){
|
string advanceToItemStartingWith = "";
|
||||||
|
if(Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) {
|
||||||
|
wchar_t lastKey = Shared::Platform::Window::extractLastKeyPressed();
|
||||||
|
//printf("lastKey = %d [%c]\n",lastKey,lastKey);
|
||||||
|
advanceToItemStartingWith = lastKey;
|
||||||
|
}
|
||||||
|
if(activeInputLabel!=NULL && !(activeInputLabel->mouseClick(x,y))){
|
||||||
setActiveInputLabel(NULL);
|
setActiveInputLabel(NULL);
|
||||||
}
|
}
|
||||||
if(buttonReturn.mouseClick(x,y) || serverInitError == true) {
|
if(buttonReturn.mouseClick(x,y) || serverInitError == true) {
|
||||||
@@ -1054,7 +1060,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
else if(buttonRestoreLastSettings.mouseClick(x,y) && buttonRestoreLastSettings.getEnabled()) {
|
else if(buttonRestoreLastSettings.mouseClick(x,y) && buttonRestoreLastSettings.getEnabled()) {
|
||||||
RestoreLastGameSettings();
|
RestoreLastGameSettings();
|
||||||
}
|
}
|
||||||
else if(listBoxMap.mouseClick(x, y)){
|
else if(listBoxMap.mouseClick(x, y,advanceToItemStartingWith)){
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n", getCurrentMapFile().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n", getCurrentMapFile().c_str());
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
||||||
@@ -1169,7 +1175,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
else if (listBoxAdvanced.mouseClick(x, y)) {
|
else if (listBoxAdvanced.mouseClick(x, y)) {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
else if(listBoxTileset.mouseClick(x, y)) {
|
else if(listBoxTileset.mouseClick(x, y,advanceToItemStartingWith)) {
|
||||||
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
||||||
|
|
||||||
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
@@ -1204,7 +1210,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||||||
lastSetChangedGameSettings = time(NULL);
|
lastSetChangedGameSettings = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(listBoxTechTree.mouseClick(x, y)){
|
else if(listBoxTechTree.mouseClick(x, y,advanceToItemStartingWith)){
|
||||||
reloadFactions(false,(checkBoxScenario.getValue() == true ? scenarioFiles[listBoxScenario.getSelectedItemIndex()] : ""));
|
reloadFactions(false,(checkBoxScenario.getValue() == true ? scenarioFiles[listBoxScenario.getSelectedItemIndex()] : ""));
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__));
|
||||||
|
@@ -138,6 +138,7 @@ public:
|
|||||||
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);
|
static bool isKeyStateModPressed(int mod);
|
||||||
|
static wchar_t extractLastKeyPressed();
|
||||||
|
|
||||||
Window();
|
Window();
|
||||||
virtual ~Window();
|
virtual ~Window();
|
||||||
|
@@ -1131,4 +1131,44 @@ bool Window::isKeyStateModPressed(int mod) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t Window::extractLastKeyPressed() {
|
||||||
|
wchar_t c = SDLK_UNKNOWN;
|
||||||
|
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||||
|
if(keystate.unicode > 0) {
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,keystate.unicode,keystate.mod);
|
||||||
|
|
||||||
|
c = keystate.unicode;
|
||||||
|
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||||
|
// c = SDLKey(c & 0xFF);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//c = toupper(c);
|
||||||
|
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||||
|
}
|
||||||
|
if(c == SDLK_UNKNOWN) {
|
||||||
|
c = keystate.sym;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||||
|
|
||||||
|
//c = (SDLKey)(c & 0xFF);
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||||
|
|
||||||
|
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||||
|
string inputKeyName = SDL_GetKeyName(keystate.sym);
|
||||||
|
|
||||||
|
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||||
|
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||||
|
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
Reference in New Issue
Block a user