mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
two patches/pull requests from janisozaur
- replace our custom bmap with std::map::at() - compile fixes for editor
This commit is contained in:
@@ -686,13 +686,13 @@ void CArtifactInstance::init()
|
||||
id = static_cast<ArtifactInstanceID>(ArtifactID::NONE); //to be randomized
|
||||
setNodeType(ARTIFACT_INSTANCE);
|
||||
}
|
||||
|
||||
ArtifactPosition CArtifactInstance::firstAvailableSlot(const CArtifactSet *h) const
|
||||
{
|
||||
for(auto slot : artType->possibleSlots[h->bearerType()])
|
||||
{
|
||||
if(canBePutAt(h, slot)) //if(artType->fitsAt(h->artifWorn, slot))
|
||||
{
|
||||
|
||||
ArtifactPosition CArtifactInstance::firstAvailableSlot(const CArtifactSet *h) const
|
||||
{
|
||||
for(auto slot : artType->possibleSlots.at(h->bearerType()))
|
||||
{
|
||||
if(canBePutAt(h, slot)) //if(artType->fitsAt(h->artifWorn, slot))
|
||||
{
|
||||
//we've found a free suitable slot.
|
||||
return slot;
|
||||
}
|
||||
@@ -1092,13 +1092,13 @@ bool CArtifactSet::hasArt(ui32 aid, bool onlyWorn /*= false*/) const
|
||||
return getArtPos(aid, onlyWorn) != ArtifactPosition::PRE_FIRST;
|
||||
}
|
||||
|
||||
const ArtSlotInfo * CArtifactSet::getSlot(ArtifactPosition pos) const
|
||||
{
|
||||
if(vstd::contains(artifactsWorn, pos))
|
||||
return &artifactsWorn[pos];
|
||||
if(pos >= ArtifactPosition::AFTER_LAST )
|
||||
{
|
||||
int backpackPos = (int)pos - GameConstants::BACKPACK_START;
|
||||
const ArtSlotInfo * CArtifactSet::getSlot(ArtifactPosition pos) const
|
||||
{
|
||||
if(vstd::contains(artifactsWorn, pos))
|
||||
return &artifactsWorn.at(pos);
|
||||
if(pos >= ArtifactPosition::AFTER_LAST )
|
||||
{
|
||||
int backpackPos = (int)pos - GameConstants::BACKPACK_START;
|
||||
if(backpackPos < 0 || backpackPos >= artifactsInBackpack.size())
|
||||
return nullptr;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user