bugfix for preselection in map combobox

Maps were not only loaded as preview.
This commit is contained in:
titiger 2019-11-07 00:12:15 +01:00
parent 010b1f4f72
commit 5cb0eab085
4 changed files with 28 additions and 6 deletions

View File

@ -2190,6 +2190,15 @@ string MenuStateConnectedGame::getCurrentMapFile(){
return "";
}
string MenuStateConnectedGame::getPreselectedMapFile(){
int i=listBoxMapFilter.getSelectedItemIndex();
int mapIndex=comboBoxMap.getPreselectedItemIndex();
if(playerSortedMaps[i].empty() == false) {
return playerSortedMaps[i].at(mapIndex);
}
return "";
}
void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, string scenario) {
vector<string> results;
Config &config = Config::getInstance();
@ -2649,10 +2658,10 @@ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms) {
comboBoxMap.mouseDown(x, y);
}
comboBoxMap.mouseMove(x, y);
if (lastPreviewedMapFile != getCurrentMapFile()) {
loadMapInfo(Config::getMapPath(getCurrentMapFile(), "", false), &mapInfo, true, false);
if (lastPreviewedMapFile != getPreselectedMapFile()) {
loadMapInfo(Config::getMapPath(getPreselectedMapFile(), "", false), &mapInfo, true, false);
labelMapInfo.setText(mapInfo.desc);
lastPreviewedMapFile = getCurrentMapFile();
lastPreviewedMapFile = getPreselectedMapFile();
}
}

View File

@ -306,6 +306,8 @@ private:
void switchToNextMapGroup(const int direction);
void switchToMapGroup(int filterIndex);
string getCurrentMapFile();
string getPreselectedMapFile();
void copyToGameSettings(GameSettings *gameSettings);
void reloadFactions(bool keepExistingSelectedItem,string scenario);
void PlayNow(bool saveGame);

View File

@ -2129,10 +2129,10 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms) {
if (ms->get(mbLeft)) {
comboBoxMap.mouseDown(x, y);
}
if(lastPreviewedMapFile!=getCurrentMapFile()){
loadMapInfo(Config::getMapPath(getCurrentMapFile(), "", false), &mapInfo, true, false);
if(lastPreviewedMapFile!=getPreselectedMapFile()){
loadMapInfo(Config::getMapPath(getPreselectedMapFile(), "", false), &mapInfo, true, false);
labelMapInfo.setText(mapInfo.desc);
lastPreviewedMapFile=getCurrentMapFile();
lastPreviewedMapFile=getPreselectedMapFile();
}
}
@ -4826,6 +4826,15 @@ void MenuStateCustomGame::switchToNextMapGroup(const int direction){
}
string MenuStateCustomGame::getCurrentMapFile(){
int i=listBoxMapFilter.getSelectedItemIndex();
int mapIndex=comboBoxMap.getSelectedItemIndex();
if(playerSortedMaps[i].empty() == false) {
return playerSortedMaps[i].at(mapIndex);
}
return "";
}
string MenuStateCustomGame::getPreselectedMapFile(){
int i=listBoxMapFilter.getSelectedItemIndex();
int mapIndex=comboBoxMap.getPreselectedItemIndex();
if(playerSortedMaps[i].empty() == false) {

View File

@ -283,6 +283,8 @@ private:
void updateAllResourceMultiplier();
void updateResourceMultiplier(const int index);
string getCurrentMapFile();
string getPreselectedMapFile();
void setActiveInputLabel(GraphicLabel *newLable);
string getHumanPlayerName(int index=-1);