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

Fixes for handling of oversized map dwellings

- Marked large version of H3 Unicorn's Glade as not usable for random
dwelling replacement
- Shifted oversized dwellings - that have at most 2x2 as blocked tile,
but have non-blocked tile column will now be placed correctly
- This fixes incorrect random dwelling replacement of the only oversized
H3 dwelling - Portal of Glory
- Game will now detect & report invalid dwelling templates from mods
- Updated docs to clarify dwellings format
This commit is contained in:
Ivan Savenko
2025-05-12 17:50:36 +03:00
parent 29207c0b0f
commit cb70cc48d6
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;
}