mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Properly check if corpse was visited
Fixes two issues: - corpse without loot couldn't be marked as visited - taking loot from once visitable objects marked them as visited for all players
This commit is contained in:
parent
7ec9601acd
commit
29d6fb0f04
@ -317,16 +317,11 @@ bool CRewardableObject::wasVisited(PlayerColor player) const
|
||||
case VISIT_UNLIMITED:
|
||||
case VISIT_BONUS:
|
||||
return false;
|
||||
case VISIT_ONCE: // FIXME: hide this info deeper and return same as player?
|
||||
for (auto & visit : info)
|
||||
{
|
||||
if (visit.numOfGrants != 0)
|
||||
return true;
|
||||
}
|
||||
case VISIT_HERO:
|
||||
return false;
|
||||
case VISIT_ONCE:
|
||||
case VISIT_PLAYER:
|
||||
return vstd::contains(cb->getPlayer(player)->visitedObjects, ObjectInstanceID(id));
|
||||
case VISIT_HERO:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -826,12 +821,16 @@ void CGOnceVisitable::initObj(CRandomGenerator & rand)
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 38);
|
||||
soundID = soundBase::MYSTERY;
|
||||
blockVisit = true;
|
||||
info.resize(1);
|
||||
if(rand.nextInt(99) < 20)
|
||||
{
|
||||
info.resize(1);
|
||||
loadRandomArtifact(rand, info[0], 10, 10, 10, 0);
|
||||
info[0].message.addTxt(MetaString::ADVOB_TXT, 37);
|
||||
}
|
||||
else
|
||||
{
|
||||
info[0].message.addTxt(MetaString::ADVOB_TXT, 38);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Obj::LEAN_TO:
|
||||
|
Loading…
Reference in New Issue
Block a user