1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
This commit is contained in:
Michał W. Urbańczyk 2011-03-19 00:06:54 +00:00
parent 236ba6f1a8
commit 95efcc7cb5
4 changed files with 12 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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<CArtifactInstance*>((const_cast<const CArtifactSet*>(this))->getArt(pos));
return const_cast<CArtifactInstance*>((const_cast<const CArtifactSet*>(this))->getArt(pos, excludeLocked));
}
si32 CArtifactSet::getArtPos(int aid, bool onlyWorn /*= true*/) const

View File

@ -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)