From e10ab66631e427158cc807eda9dc223478f1fdd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Fri, 1 May 2009 16:14:29 +0000 Subject: [PATCH] Patches from Ubuntux: * clicking on "advanced options" a second time now closes the tab instead of refreshing it. * Fix position of maps names. Made the slider cursor much more responsive. Speedup the map select screen. * CPlayerInterface::delComps was not initialized. * Add a few missing inits. vcmi_missing_init.diff vcmi_infowin.diff vcmi_fix_advoptions.diff vcmi_fix_printMaps.diff --- AdventureMapButton.cpp | 1 + CPlayerInterface.cpp | 12 ++++++++---- CPlayerInterface.h | 2 +- CPreGame.cpp | 36 +++++++++++++++++++++++------------- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/AdventureMapButton.cpp b/AdventureMapButton.cpp index 38435c3fe..e9d133239 100644 --- a/AdventureMapButton.cpp +++ b/AdventureMapButton.cpp @@ -237,6 +237,7 @@ void CHighlightableButton::clickLeft( tribool down ) CHighlightableButton::CHighlightableButton( const CFunctionList &onSelect, const CFunctionList &onDeselect, const std::map &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector * add, int x, int y, int key ) { onlyOn = false; + selected = false; init(onSelect,Name,HelpBox,playerColoredButton,defName,add,x,y,key); callback2 = onDeselect; } diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 1a9d7c6ad..54d5cbc53 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -574,9 +574,10 @@ void CGarrisonInt::deactivate() deactiveteSlots(); } -CInfoWindow::CInfoWindow(std::string text, int player, int charperline, const std::vector &comps, std::vector > > &Buttons) +CInfoWindow::CInfoWindow(std::string text, int player, int charperline, const std::vector &comps, std::vector > > &Buttons, bool delComps) { ID = -1; + this->delComps = delComps; for(int i=0;i(false); heroMoveSpeed = 2; mapScrollingSpeed = 2; @@ -2434,7 +2437,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector std::vector > > pom; pom.push_back(std::pair >("IOKAY.DEF",0)); - CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom); + CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom,false); if(makingTurn && listInt.size()) { @@ -2455,7 +2458,7 @@ void CPlayerInterface::showYesNoDialog(const std::string &text, const std::vecto std::vector > > pom; pom.push_back(std::pair >("IOKAY.DEF",0)); pom.push_back(std::pair >("ICANCEL.DEF",0)); - CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom); + CInfoWindow * temp = new CInfoWindow(text,playerID,36,components,pom,DelComps); temp->delComps = DelComps; for(int i=0;ibuttons[0]->callback += onYes.funcs[i]; @@ -2830,6 +2833,7 @@ CHeroList::CHeroList(int Size) posmany = pos.y+arrup->height+1; from = 0; + selected = -1; pressed = indeterminate; } @@ -3142,7 +3146,7 @@ CTownList::CTownList(int Size, int x, int y, std::string arrupg, std::string arr pressed = indeterminate; from = 0; - + selected = -1; } void CTownList::genList() diff --git a/CPlayerInterface.h b/CPlayerInterface.h index 429b73192..8efe94fbd 100644 --- a/CPlayerInterface.h +++ b/CPlayerInterface.h @@ -377,7 +377,7 @@ public: virtual void show(SDL_Surface * to); void activate(); void deactivate(); - CInfoWindow(std::string text, int player, int charperline, const std::vector &comps, std::vector > > &Buttons); //c-tor + CInfoWindow(std::string text, int player, int charperline, const std::vector &comps, std::vector > > &Buttons, bool delComps); //c-tor CInfoWindow(); //c-tor ~CInfoWindow(); //d-tor }; diff --git a/CPreGame.cpp b/CPreGame.cpp index b618d4500..4d62074be 100644 --- a/CPreGame.cpp +++ b/CPreGame.cpp @@ -363,8 +363,8 @@ void Slider::handleIt(SDL_Event sEvent) { whereAreWe=ktory; updateSlid(); + fun(whereAreWe); } - fun(whereAreWe); } } @@ -911,12 +911,8 @@ void MapSel::printMaps(int from, int to, int at, bool abs) { if ((i-at+from) > curVector().size()-1) { - SDL_Surface * scenin = CSDL_Ext::newSurface(351,25); SDL_BlitSurface(bg,&genRect(25,351,22,(i-at)*25+115),scenin,NULL); - blitAt(scenin,24,121+(i-at)*25); - //SDL_Flip(screen); - CSDL_Ext::update(screen); - SDL_FreeSurface(scenin); + blitAt(scenin,25,121+(i-at)*25); continue; } if (sizeFilter && ((curVector()[(i-at)+from]->width) != sizeFilter)) @@ -999,11 +995,10 @@ void MapSel::printMaps(int from, int to, int at, bool abs) temp=curVector()[(i-at)+from]->lossCondition.typeOfLossCon; blitAt(Dloss->ourImages[temp].bitmap,318,2,scenin); - - blitAt(scenin,24,121+(i-at)*25); - SDL_UpdateRect(screen,24,121+(i-at)*25,scenin->w,scenin->h); + blitAt(scenin,25,121+(i-at)*25); } SDL_FreeSurface(scenin); + SDL_UpdateRect(screen, 25, 121, 351, 19*25); } int MapSel::whichWL(int nr) { @@ -1154,9 +1149,16 @@ void MapSel::init() } ourMaps.resize(pliczkiTemp.size()); boost::thread_group group; - int threads = std::max((unsigned int)1,boost::thread::hardware_concurrency()); - for(int ti=0;tiformat,0,255,255)); @@ -1709,7 +1711,13 @@ void CPreGame::showScenSel() } void CPreGame::showOptions() { - ourOptions->show(); + if (currentTab != ourOptions) + ourOptions->show(); + else + { + currentTab->hide(); + showScenSel(); + } } void CPreGame::initNewMenu() { @@ -2049,6 +2057,8 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent) StartInfo CPreGame::runLoop() { SDL_Event sEvent; + ret.turnTime = 0; + while(run) { try