From 95efcc7cb5db5f0d1d05d1f8ef2412297bbed756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sat, 19 Mar 2011 00:06:54 +0000 Subject: [PATCH] Fixed #305, #707, #708. --- client/CAdvmapInterface.cpp | 1 + client/GUIClasses.cpp | 6 +++++- lib/CObjectHandler.cpp | 8 ++++---- lib/CObjectHandler.h | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/client/CAdvmapInterface.cpp b/client/CAdvmapInterface.cpp index 76245d7aa..5119f099b 100644 --- a/client/CAdvmapInterface.cpp +++ b/client/CAdvmapInterface.cpp @@ -2097,6 +2097,7 @@ CAdventureOptions::CAdventureOptions() graphics->blueToPlayersAdv(bg->bg, LOCPLINT->playerID); pos = bg->center(); exit = new AdventureMapButton("","",boost::bind(&CGuiHandler::popIntTotally, &GH, this), 204, 313, "IOK6432.DEF",SDLK_RETURN); + exit->assignedKeys.insert(SDLK_ESCAPE); //scenInfo = new AdventureMapButton("","", boost::bind(&CGuiHandler::popIntTotally, &GH, this), 24, 24, "ADVINFO.DEF",SDLK_i); scenInfo = new AdventureMapButton("","", boost::bind(&CGuiHandler::popIntTotally, &GH, this), 24, 198, "ADVINFO.DEF",SDLK_i); diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index b600e1df6..ad4b2bfde 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -4705,7 +4705,7 @@ void CArtPlace::deactivate() void CArtPlace::showAll(SDL_Surface *to) { - if (ourArt && !picked && ourArt == ourOwner->curHero->getArt(slotID)) //last condition is needed for disassembling -> artifact may be gone, but we don't know yet TODO: real, nice solution + if (ourArt && !picked && ourArt == ourOwner->curHero->getArt(slotID, false)) //last condition is needed for disassembling -> artifact may be gone, but we don't know yet TODO: real, nice solution { int graphic = locked ? 145 : ourArt->artType->id; blitAt(graphics->artDefs->ourImages[graphic].bitmap, pos.x, pos.y, to); @@ -5289,6 +5289,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact assert(commonInfo->src.AOH); CCS->curh->dragAndDropCursor(graphics->artDefs->ourImages[dst.getArt()->artType->id].bitmap); markPossibleSlots(dst.getArt()); + updateParentWindow(); } } else if(src.slot >= Arts::BACKPACK_START && src.slot < commonInfo->src.slotID && src.hero == commonInfo->src.AOH->curHero) //artifact taken from before currently picked one @@ -5296,6 +5297,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact int fixedSlot = src.hero->getArtPos(commonInfo->src.art); commonInfo->src.slotID--; assert(commonInfo->src.valid()); + updateParentWindow(); } else { @@ -5791,6 +5793,8 @@ CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio) SDL_FreeSurface(back); pos = genRect(background->h, background->w, (conf.cc.resx - background->w) / 2, (conf.cc.resy - background->h) / 2); quitb = new AdventureMapButton(CGI->generaltexth->allTexts[599], "", boost::bind(&CGuiHandler::popIntTotally, &GH, this), pos.x+670, pos.y+538, "IOK6432.DEF", SDLK_RETURN); + quitb->assignedKeys.insert(SDLK_ESCAPE); + resdatabar = new CResDataBar("ZRESBAR.bmp", pos.x+3, pos.y+575, 32, 2, 85, 85); resdatabar->pos.x = pos.x+3; resdatabar->pos.y = pos.y+575; diff --git a/lib/CObjectHandler.cpp b/lib/CObjectHandler.cpp index 4ce4ff67a..27b4019a1 100644 --- a/lib/CObjectHandler.cpp +++ b/lib/CObjectHandler.cpp @@ -6945,20 +6945,20 @@ void CGUniversity::onHeroVisit(const CGHeroInstance * h) const cb->sendAndApply(&ow); } -const CArtifactInstance* CArtifactSet::getArt(ui16 pos) const +const CArtifactInstance* CArtifactSet::getArt(ui16 pos, bool excludeLocked /*= true*/) const { if(const ArtSlotInfo *si = getSlot(pos)) { - if(si->artifact && !si->locked) + if(si->artifact && (!excludeLocked || !si->locked)) return si->artifact; } return NULL; } -CArtifactInstance* CArtifactSet::getArt(ui16 pos) +CArtifactInstance* CArtifactSet::getArt(ui16 pos, bool excludeLocked /*= true*/) { - return const_cast((const_cast(this))->getArt(pos)); + return const_cast((const_cast(this))->getArt(pos, excludeLocked)); } si32 CArtifactSet::getArtPos(int aid, bool onlyWorn /*= true*/) const diff --git a/lib/CObjectHandler.h b/lib/CObjectHandler.h index c11a6e1eb..b3c5b2657 100644 --- a/lib/CObjectHandler.h +++ b/lib/CObjectHandler.h @@ -274,8 +274,8 @@ public: void eraseArtSlot(ui16 slot); const ArtSlotInfo *getSlot(ui16 pos) const; - const CArtifactInstance* getArt(ui16 pos) const; //NULL - no artifact - CArtifactInstance* getArt(ui16 pos); //NULL - no artifact + const CArtifactInstance* getArt(ui16 pos, bool excludeLocked = true) const; //NULL - no artifact + CArtifactInstance* getArt(ui16 pos, bool excludeLocked = true); //NULL - no artifact si32 getArtPos(int aid, bool onlyWorn = true) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned) si32 getArtPos(const CArtifactInstance *art) const; bool hasArt(ui32 aid, bool onlyWorn = false) const; //checks if hero possess artifact of given id (either in backack or worn)