diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index b943fdc76..6ff8bc0f9 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -3161,7 +3161,7 @@ void CBonusSelection::init() if (highlightedRegion == NULL) { highlightedRegion = regions.back(); - selectMap(g); + selectMap(g, true); } } else if (ourCampaign->camp->scenarios[g].conquered) //display as striped @@ -3285,29 +3285,32 @@ void CBonusSelection::loadPositionsOfGraphics() assert(idx == CGI->generaltexth->campaignMapNames.size()); } -void CBonusSelection::selectMap( int whichOne ) +void CBonusSelection::selectMap( int whichOne, bool initialSelect ) { - sInfo.difficulty = ourCampaign->camp->scenarios[whichOne].difficulty; - sInfo.mapname = ourCampaign->camp->header.filename; - sInfo.mode = StartInfo::CAMPAIGN; - sInfo.campState = ourCampaign; - ourCampaign->currentMap = whichOne; + if(initialSelect || ourCampaign->currentMap != whichOne) + { + sInfo.difficulty = ourCampaign->camp->scenarios[whichOne].difficulty; + sInfo.mapname = ourCampaign->camp->header.filename; + sInfo.mode = StartInfo::CAMPAIGN; + sInfo.campState = ourCampaign; + ourCampaign->currentMap = whichOne; - //get header - delete ourHeader; - std::string & headerStr = ourCampaign->camp->mapPieces.find(whichOne)->second; - auto buffer = reinterpret_cast(headerStr.data()); - ourHeader = CMapService::loadMapHeader(buffer, headerStr.size()).release(); + //get header + delete ourHeader; + std::string & headerStr = ourCampaign->camp->mapPieces.find(whichOne)->second; + auto buffer = reinterpret_cast(headerStr.data()); + ourHeader = CMapService::loadMapHeader(buffer, headerStr.size()).release(); - std::map names; - names[1] = settings["general"]["playerName"].String(); - updateStartInfo(ourCampaign->camp->header.filename, sInfo, ourHeader, names); - sInfo.turnTime = 0; - sInfo.difficulty = ourCampaign->camp->scenarios[whichOne].difficulty; + std::map names; + names[1] = settings["general"]["playerName"].String(); + updateStartInfo(ourCampaign->camp->header.filename, sInfo, ourHeader, names); + sInfo.turnTime = 0; + sInfo.difficulty = ourCampaign->camp->scenarios[whichOne].difficulty; - mapDesc->setTxt(ourHeader->description); + mapDesc->setTxt(ourHeader->description); - updateBonusSelection(); + updateBonusSelection(); + } } void CBonusSelection::show(SDL_Surface * to) @@ -3675,7 +3678,7 @@ void CBonusSelection::CRegion::clickLeft( tribool down, bool previousState ) } if( !down && selectable && !CSDL_Ext::isTransparent(graphics[0], GH.current->motion.x-pos.x, GH.current->motion.y-pos.y) ) { - owner->selectMap(myNumber); + owner->selectMap(myNumber, false); owner->highlightedRegion = this; parent->showAll(screen); } diff --git a/client/CPreGame.h b/client/CPreGame.h index 732bb163d..61e98e7a1 100644 --- a/client/CPreGame.h +++ b/client/CPreGame.h @@ -603,7 +603,7 @@ public: StartInfo sInfo; CDefHandler *sFlags; - void selectMap(int whichOne); + void selectMap(int whichOne, bool initialSelect); void selectBonus(int id); void init();