From 4581c30b207e1efa8217f6ae26e62f75961afaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sun, 24 May 2009 23:21:55 +0000 Subject: [PATCH] * VCMI won't try to calculate path when clicking terrain on the other map level then that of currently selected hero (caused hangs) * Mines / Resource Silos won't give income in the first turn * Double click on hero slot during stack splitting won't crash * Fixed problems with updating buttons / minimap --- client/AdventureMapButton.cpp | 8 ++++---- client/CAdvmapInterface.cpp | 9 +++++---- client/CCastleInterface.cpp | 2 ++ client/CMT.cpp | 4 +++- client/CPlayerInterface.cpp | 3 +++ client/GUIClasses.cpp | 15 +++++++-------- client/SDL_Extensions.h | 2 +- hch/CObjectHandler.cpp | 3 +++ lib/IGameCallback.h | 2 +- lib/VCMI_lib.vcproj | 16 ++++++++-------- 10 files changed, 37 insertions(+), 27 deletions(-) diff --git a/client/AdventureMapButton.cpp b/client/AdventureMapButton.cpp index 275d42a3f..74df78a85 100644 --- a/client/AdventureMapButton.cpp +++ b/client/AdventureMapButton.cpp @@ -68,7 +68,7 @@ void AdventureMapButton::clickLeft (boost::logic::tribool down) state=1; else state=0; - show(screen2); + show(screenBuf); if (actOnDown && down) { pressedL=state; @@ -198,7 +198,7 @@ void AdventureMapButton::block( ui8 on ) blocked = on; state = 0; bitmapOffset = on ? 2 : 0; - show(screen2); + show(screenBuf); } void CHighlightableButton::select(bool on) @@ -224,7 +224,7 @@ void CHighlightableButton::clickLeft( tribool down ) state=1; else state = selected ? 3 : 0; - show(screen2); + show(screenBuf); if (pressedL && (down==false)) { pressedL=state; @@ -350,7 +350,7 @@ void CSlider::mouseMoved (const SDL_MouseMotionEvent & sEvent) void CSlider::redrawSlider() { - slider.show(screen2); + slider.show(screenBuf); } void CSlider::moveLeft() diff --git a/client/CAdvmapInterface.cpp b/client/CAdvmapInterface.cpp index 2f4ac1320..99487fe00 100644 --- a/client/CAdvmapInterface.cpp +++ b/client/CAdvmapInterface.cpp @@ -481,7 +481,7 @@ void CTerrainRect::clickLeft(tribool down) LOCPLINT->moveHero(currentHero,*currentPath); LOCPLINT->pim->lock(); } - else //remove old path and find a new one + else if(mp.z == currentHero->pos.z) //remove old path and find a new one if we clicked on the map level on which hero is present { int3 bufpos = currentHero->getPosition(false); CPath *& pathForCurhero = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].second; @@ -1282,16 +1282,16 @@ void CAdvMapInt::fswitchLevel() { position.z--; underground.curimg=0; - underground.show(screen2); + underground.show(screenBuf); } else { underground.curimg=1; position.z++; - underground.show(screen2); + underground.show(screenBuf); } updateScreen = true; - minimap.draw(screen2); + minimap.draw(screenBuf); } void CAdvMapInt::fshowQuestlog() { @@ -1355,6 +1355,7 @@ void CAdvMapInt::activate() active--; return; } + screenBuf = screen; LOCPLINT->statusbar = &statusbar; kingOverview.activate(); underground.activate(); diff --git a/client/CCastleInterface.cpp b/client/CCastleInterface.cpp index 252d4e337..1a72aaf09 100644 --- a/client/CCastleInterface.cpp +++ b/client/CCastleInterface.cpp @@ -260,6 +260,8 @@ void CHeroGSlot::clickLeft(boost::logic::tribool down) CHeroGSlot *other = upg ? &owner->hslotup : &owner->hslotdown; if(!down) { + owner->garr->splitting = false; + owner->garr->highlighted = NULL; if(hero && highlight) { highlight = false; diff --git a/client/CMT.cpp b/client/CMT.cpp index 863e2d132..60affcafe 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -57,7 +57,9 @@ */ std::string NAME = NAME_VER + std::string(" (client)"); //application name -SDL_Surface *screen = NULL, *screen2 = NULL; //main screen surface and hlp surface (used to store not-active interfaces layer) +SDL_Surface *screen = NULL, //main screen surface + *screen2 = NULL,//and hlp surface (used to store not-active interfaces layer) + *screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed std::queue events; boost::mutex eventsM; diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 81f4bddfb..834437e09 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1663,6 +1663,9 @@ void CPlayerInterface::popIntTotally( IShowActivable *top ) void CPlayerInterface::pushInt( IShowActivable *newInt ) { + //a new interface will be present, we'll need to use buffer surface (unless it's advmapint that will alter screenBuf on activate anyway) + screenBuf = screen2; + if(listInt.size()) listInt.front()->deactivate(); listInt.push_front(newInt); diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index d0117ccf9..fd1f2d9ef 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +//#include #include #include #include @@ -1425,7 +1425,6 @@ void CTownList::mouseMoved (const SDL_MouseMotionEvent & sEvent) void CTownList::clickLeft(tribool down) { - SDL_Surface *dst = (LOCPLINT->topInt()==LOCPLINT->adventureInt ? screen : screen2); if (down) { /***************************ARROWS*****************************************/ @@ -1433,7 +1432,7 @@ void CTownList::clickLeft(tribool down) { if(from>0) { - blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y,dst); + blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y,screenBuf); pressed = true; } return; @@ -1442,7 +1441,7 @@ void CTownList::clickLeft(tribool down) { if(items.size()-from > SIZE) { - blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y,dst); + blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y,screenBuf); pressed = false; } return; @@ -1468,7 +1467,7 @@ void CTownList::clickLeft(tribool down) return; if (pressed) //up { - blitAt(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y,dst); + blitAt(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y,screenBuf); pressed = indeterminate; if (!down) { @@ -1476,12 +1475,12 @@ void CTownList::clickLeft(tribool down) if (from<0) from=0; - draw(dst); + draw(screenBuf); } } else if (!pressed) //down { - blitAt(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y,dst); + blitAt(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y,screenBuf); pressed = indeterminate; if (!down) { @@ -1489,7 +1488,7 @@ void CTownList::clickLeft(tribool down) //if (fromgetDate() == 1) + return; + if (tempOwner == NEUTRAL_PLAYER) return; int vv = 1; diff --git a/lib/IGameCallback.h b/lib/IGameCallback.h index f4060dfd4..34ae542ef 100644 --- a/lib/IGameCallback.h +++ b/lib/IGameCallback.h @@ -41,7 +41,7 @@ public: virtual int getOwner(int heroID); virtual int getResource(int player, int which); - virtual int getDate(int mode=0); + virtual int getDate(int mode=0); ////mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month virtual const CGObjectInstance* getObj(int objid); virtual const CGHeroInstance* getHero(int objid); virtual const CGTownInstance* getTown(int objid); diff --git a/lib/VCMI_lib.vcproj b/lib/VCMI_lib.vcproj index aa4b8c7dc..6c88a1c41 100644 --- a/lib/VCMI_lib.vcproj +++ b/lib/VCMI_lib.vcproj @@ -282,6 +282,10 @@ RelativePath="..\hch\CDefObjInfoHandler.cpp" > + + @@ -314,6 +318,10 @@ RelativePath=".\IGameCallback.cpp" > + + @@ -429,14 +437,6 @@ > - - - -