mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Use API identical to std classes where possible
This commit is contained in:
@@ -115,7 +115,7 @@ void Object::Instance::setAnyTemplate()
|
||||
{
|
||||
auto templates = VLC->objtypeh->getHandlerFor(dObject.ID, dObject.subID)->getTemplates();
|
||||
if(templates.empty())
|
||||
throw rmgException(boost::to_string(boost::format("Did not find any graphics for object (%d,%d)") % dObject.ID % dObject.subID));
|
||||
throw rmgException(boost::str(boost::format("Did not find any graphics for object (%d,%d)") % dObject.ID % dObject.subID));
|
||||
|
||||
dObject.appearance = templates.front();
|
||||
dAccessibleAreaCache.clear();
|
||||
@@ -128,7 +128,7 @@ void Object::Instance::setTemplate(TerrainId terrain)
|
||||
if (templates.empty())
|
||||
{
|
||||
auto terrainName = VLC->terrainTypeHandler->getById(terrain)->getNameTranslated();
|
||||
throw rmgException(boost::to_string(boost::format("Did not find graphics for object (%d,%d) at %s") % dObject.ID % dObject.subID % terrainName));
|
||||
throw rmgException(boost::str(boost::format("Did not find graphics for object (%d,%d) at %s") % dObject.ID % dObject.subID % terrainName));
|
||||
}
|
||||
dObject.appearance = templates.front();
|
||||
dAccessibleAreaCache.clear();
|
||||
@@ -328,7 +328,7 @@ void rmg::Object::setGuardedIfMonster(const Instance& object)
|
||||
void Object::Instance::finalize(RmgMap & map)
|
||||
{
|
||||
if(!map.isOnMap(getPosition(true)))
|
||||
throw rmgException(boost::to_string(boost::format("Position of object %d at %s is outside the map") % dObject.id % getPosition(true).toString()));
|
||||
throw rmgException(boost::str(boost::format("Position of object %d at %s is outside the map") % dObject.id % getPosition(true).toString()));
|
||||
|
||||
//If no specific template was defined for this object, select any matching
|
||||
if (!dObject.appearance)
|
||||
@@ -337,7 +337,7 @@ void Object::Instance::finalize(RmgMap & map)
|
||||
auto templates = VLC->objtypeh->getHandlerFor(dObject.ID, dObject.subID)->getTemplates(terrainType->getId());
|
||||
if (templates.empty())
|
||||
{
|
||||
throw rmgException(boost::to_string(boost::format("Did not find graphics for object (%d,%d) at %s (terrain %d)") % dObject.ID % dObject.subID % getPosition(true).toString() % terrainType));
|
||||
throw rmgException(boost::str(boost::format("Did not find graphics for object (%d,%d) at %s (terrain %d)") % dObject.ID % dObject.subID % getPosition(true).toString() % terrainType));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -346,12 +346,12 @@ void Object::Instance::finalize(RmgMap & map)
|
||||
}
|
||||
|
||||
if (dObject.isVisitable() && !map.isOnMap(dObject.visitablePos()))
|
||||
throw rmgException(boost::to_string(boost::format("Visitable tile %s of object %d at %s is outside the map") % dObject.visitablePos().toString() % dObject.id % dObject.pos.toString()));
|
||||
throw rmgException(boost::str(boost::format("Visitable tile %s of object %d at %s is outside the map") % dObject.visitablePos().toString() % dObject.id % dObject.pos.toString()));
|
||||
|
||||
for(const auto & tile : dObject.getBlockedPos())
|
||||
{
|
||||
if(!map.isOnMap(tile))
|
||||
throw rmgException(boost::to_string(boost::format("Tile %s of object %d at %s is outside the map") % tile.toString() % dObject.id % dObject.pos.toString()));
|
||||
throw rmgException(boost::str(boost::format("Tile %s of object %d at %s is outside the map") % tile.toString() % dObject.id % dObject.pos.toString()));
|
||||
}
|
||||
|
||||
for(const auto & tile : getBlockedArea().getTilesVector())
|
||||
|
||||
Reference in New Issue
Block a user