1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Merge remote-tracking branch 'remotes/origin/develop' into feature/VCMIMapFormat1

Conflicts:
	lib/CArtHandler.h
	lib/mapObjects/MiscObjects.cpp
This commit is contained in:
AlexVinS
2016-01-24 15:39:41 +03:00
27 changed files with 432 additions and 181 deletions

View File

@ -183,7 +183,7 @@ std::set<int3> CGObjectInstance::getBlockedPos() const
{
for(int h=0; h<getHeight(); ++h)
{
if (appearance.isBlockedAt(w, h))
if(appearance.isBlockedAt(w, h))
ret.insert(int3(pos.x - w, pos.y - h, pos.z));
}
}
@ -205,7 +205,13 @@ 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);
if (!handler->getTemplates(tile.terType).empty())
if(!handler)
{
logGlobal->errorStream() << boost::format(
"Unknown object type %d:%d at %s") % ID % subID % visitablePos();
return;
}
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
@ -410,9 +416,9 @@ int3 IBoatGenerator::bestLocation() const
for (auto & offset : offsets)
{
if (const TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offset, false)) //tile is in the map
if(const TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offset, false)) //tile is in the map
{
if (tile->terType == ETerrainType::WATER && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
if(tile->terType == ETerrainType::WATER && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
return o->pos + offset;
}
}