1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Merge pull request #5707 from IvanSavenko/dwelling_fix

Fixes for handling of oversized map dwellings
This commit is contained in:
Ivan Savenko
2025-05-14 11:52:40 +03:00
committed by GitHub
9 changed files with 102 additions and 3 deletions

View File

@ -121,7 +121,7 @@ const std::set<int3> & CGObjectInstance::getBlockedOffsets() const
void CGObjectInstance::setType(MapObjectID newID, MapObjectSubID newSubID)
{
auto position = visitablePos();
auto oldOffset = getVisitableOffset();
auto oldOffset = appearance->getCornerOffset();
auto &tile = cb->gameState().getMap().getTile(position);
//recalculate blockvis tiles - new appearance might have different blockmap than before
@ -144,11 +144,12 @@ void CGObjectInstance::setType(MapObjectID newID, MapObjectSubID newSubID)
// instead, appearance update & pos adjustment occurs in GiveHero::applyGs
needToAdjustOffset |= this->ID == Obj::PRISON && newID == Obj::HERO;
needToAdjustOffset |= newID == Obj::MONSTER;
needToAdjustOffset |= newID == Obj::CREATURE_GENERATOR1 || newID == Obj::CREATURE_GENERATOR2 || newID == Obj::CREATURE_GENERATOR3 || newID == Obj::CREATURE_GENERATOR4;
if(needToAdjustOffset)
{
// adjust position since object visitable offset might have changed
auto newOffset = getVisitableOffset();
auto newOffset = appearance->getCornerOffset();
pos = pos - oldOffset + newOffset;
}