1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added workaround for random objects on water, fixes 1828

This commit is contained in:
Ivan Savenko 2014-08-09 13:48:38 +03:00
parent 05d8fad314
commit c0e4591bc7

View File

@ -191,7 +191,10 @@ void CGObjectInstance::setType(si32 ID, si32 subID)
//recalculate blockvis tiles - new appearance might have different blockmap than before
cb->gameState()->map->removeBlockVisTiles(this, true);
auto handler = VLC->objtypeh->getHandlerFor(ID, subID);
appearance = handler->getTemplates(tile.terType).at(0);
if (!handler->getTemplates(tile.terType).empty())
appearance = handler->getTemplates(tile.terType)[0];
else
appearance = handler->getTemplates()[0]; // get at least some appearance since alternative is crash
cb->gameState()->map->addBlockVisTiles(this);
}