mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-16 02:47:36 +02:00
Fix compilation errors
This commit is contained in:
parent
5ce0f7c4e0
commit
82d6a6350c
@ -198,3 +198,4 @@ CObjectSelection & CMapEditManager::getObjectSelection()
|
||||
CMapUndoManager & CMapEditManager::getUndoManager()
|
||||
{
|
||||
return undoManager;
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ void ObstacleProxy::collectPossibleObstacles(const Terrain & terrain)
|
||||
{
|
||||
for(auto temp : handler->getTemplates())
|
||||
{
|
||||
if(temp.canBePlacedAt(terrain) && temp.getBlockMapOffset().valid())
|
||||
obstaclesBySize[temp.getBlockedOffsets().size()].push_back(temp);
|
||||
if(temp->canBePlacedAt(terrain) && temp->getBlockMapOffset().valid())
|
||||
obstaclesBySize[temp->getBlockedOffsets().size()].push_back(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,6 @@ void ObstacleProxy::placeObject(CMapEditManager * manager, rmg::Object & object)
|
||||
{
|
||||
manager->insertObject(&instance->object());
|
||||
}
|
||||
//manager->placeObject(*objIter->first, false, false);
|
||||
}
|
||||
|
||||
int ObstacleProxy::getWeightedObjects(const int3 & tile, const CMap * map, CRandomGenerator & rand, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects)
|
||||
@ -80,9 +79,9 @@ int ObstacleProxy::getWeightedObjects(const int3 & tile, const CMap * map, CRand
|
||||
auto shuffledObstacles = possibleObstacles[i].second;
|
||||
RandomGeneratorUtil::randomShuffle(shuffledObstacles, rand);
|
||||
|
||||
for(auto & temp : shuffledObstacles)
|
||||
for(auto temp : shuffledObstacles)
|
||||
{
|
||||
auto handler = VLC->objtypeh->getHandlerFor(temp.id, temp.subid);
|
||||
auto handler = VLC->objtypeh->getHandlerFor(temp->id, temp->subid);
|
||||
auto obj = handler->create(temp);
|
||||
allObjects.emplace_back(*obj);
|
||||
rmg::Object * rmgObject = &allObjects.back();
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
protected:
|
||||
int getWeightedObjects(const int3 & tile, const CMap * map, CRandomGenerator & rand, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects);
|
||||
|
||||
typedef std::vector<ObjectTemplate> ObstacleVector;
|
||||
typedef std::vector<std::shared_ptr<const ObjectTemplate>> ObstacleVector;
|
||||
std::map<int, ObstacleVector> obstaclesBySize;
|
||||
typedef std::pair<int, ObstacleVector> ObstaclePair;
|
||||
std::vector<ObstaclePair> possibleObstacles;
|
||||
|
@ -127,10 +127,10 @@ void Graphics::loadHeroAnimations()
|
||||
{
|
||||
for(auto & elem : CGI->heroh->classes.objects)
|
||||
{
|
||||
for (auto & templ : VLC->objtypeh->getHandlerFor(Obj::HERO, elem->getIndex())->getTemplates())
|
||||
for (auto templ : VLC->objtypeh->getHandlerFor(Obj::HERO, elem->getIndex())->getTemplates())
|
||||
{
|
||||
if (!heroAnimations.count(templ.animationFile))
|
||||
heroAnimations[templ.animationFile] = loadHeroAnimation(templ.animationFile);
|
||||
if (!heroAnimations.count(templ->animationFile))
|
||||
heroAnimations[templ->animationFile] = loadHeroAnimation(templ->animationFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,21 +293,21 @@ std::shared_ptr<Animation> Graphics::getAnimation(const CGObjectInstance* obj)
|
||||
return getAnimation(obj->appearance);
|
||||
}
|
||||
|
||||
std::shared_ptr<Animation> Graphics::getAnimation(const ObjectTemplate & info)
|
||||
std::shared_ptr<Animation> Graphics::getAnimation(const std::shared_ptr<const ObjectTemplate> info)
|
||||
{
|
||||
//the only(?) invisible object
|
||||
if(info.id == Obj::EVENT)
|
||||
if(info->id == Obj::EVENT)
|
||||
{
|
||||
return std::shared_ptr<Animation>();
|
||||
}
|
||||
|
||||
if(info.animationFile.empty())
|
||||
if(info->animationFile.empty())
|
||||
{
|
||||
logGlobal->warn("Def name for obj (%d,%d) is empty!", info.id, info.subid);
|
||||
logGlobal->warn("Def name for obj (%d,%d) is empty!", info->id, info->subid);
|
||||
return std::shared_ptr<Animation>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Animation> ret = mapObjectAnimations[info.animationFile];
|
||||
std::shared_ptr<Animation> ret = mapObjectAnimations[info->animationFile];
|
||||
|
||||
//already loaded
|
||||
if(ret)
|
||||
@ -316,8 +316,8 @@ std::shared_ptr<Animation> Graphics::getAnimation(const ObjectTemplate & info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = std::make_shared<Animation>(info.animationFile);
|
||||
mapObjectAnimations[info.animationFile] = ret;
|
||||
ret = std::make_shared<Animation>(info->animationFile);
|
||||
mapObjectAnimations[info->animationFile] = ret;
|
||||
|
||||
ret->preload();
|
||||
return ret;
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
void blueToPlayersAdv(QImage * sur, PlayerColor player); //replaces blue interface colour with a color of player
|
||||
|
||||
std::shared_ptr<Animation> getAnimation(const CGObjectInstance * obj);
|
||||
std::shared_ptr<Animation> getAnimation(const ObjectTemplate & info);
|
||||
std::shared_ptr<Animation> getAnimation(const std::shared_ptr<const ObjectTemplate> info);
|
||||
};
|
||||
|
||||
extern Graphics * graphics;
|
||||
|
@ -103,7 +103,7 @@ void Initializer::initialize(CGTownInstance * o)
|
||||
if(!o) return;
|
||||
|
||||
const std::vector<std::string> castleLevels{"village", "fort", "citadel", "castle", "capitol"};
|
||||
int lvl = vstd::find_pos(castleLevels, o->appearance.stringID);
|
||||
int lvl = vstd::find_pos(castleLevels, o->appearance->stringID);
|
||||
o->builtBuildings.insert(BuildingID::DEFAULT);
|
||||
if(lvl > -1) o->builtBuildings.insert(BuildingID::TAVERN);
|
||||
if(lvl > 0) o->builtBuildings.insert(BuildingID::FORT);
|
||||
|
@ -381,7 +381,7 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool useCust
|
||||
auto templ = templates[templateId];
|
||||
|
||||
//selecting file
|
||||
const std::string & afile = templ.editorAnimationFile.empty() ? templ.animationFile : templ.editorAnimationFile;
|
||||
const std::string & afile = templ->editorAnimationFile.empty() ? templ->animationFile : templ->editorAnimationFile;
|
||||
|
||||
//creating picture
|
||||
QPixmap preview(128, 128);
|
||||
@ -402,8 +402,8 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool useCust
|
||||
QJsonObject data{{"id", QJsonValue(ID)},
|
||||
{"subid", QJsonValue(secondaryID)},
|
||||
{"template", QJsonValue(templateId)},
|
||||
{"animationEditor", QString::fromStdString(templ.editorAnimationFile)},
|
||||
{"animation", QString::fromStdString(templ.animationFile)},
|
||||
{"animationEditor", QString::fromStdString(templ->editorAnimationFile)},
|
||||
{"animation", QString::fromStdString(templ->animationFile)},
|
||||
{"preview", jsonFromPixmap(preview)}};
|
||||
|
||||
//create object to extract name
|
||||
@ -422,7 +422,7 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool useCust
|
||||
{
|
||||
if(useCustomName)
|
||||
itemType->setText(translated);
|
||||
auto * item = new QStandardItem(QIcon(preview), QString::fromStdString(templ.stringID));
|
||||
auto * item = new QStandardItem(QIcon(preview), QString::fromStdString(templ->stringID));
|
||||
item->setData(data);
|
||||
itemType->appendRow(item);
|
||||
}
|
||||
@ -992,13 +992,13 @@ void MainWindow::on_actionUpdate_appearance_triggered()
|
||||
if(handler->isStaticObject())
|
||||
{
|
||||
staticObjects.insert(obj);
|
||||
if(obj->appearance.canBePlacedAt(terrain))
|
||||
if(obj->appearance->canBePlacedAt(terrain))
|
||||
{
|
||||
controller.scene(mapLevel)->selectionObjectsView.deselectObject(obj);
|
||||
continue;
|
||||
}
|
||||
|
||||
for(auto & offset : obj->appearance.getBlockedOffsets())
|
||||
for(auto & offset : obj->appearance->getBlockedOffsets())
|
||||
controller.scene(mapLevel)->selectionTerrainView.select(obj->pos + offset);
|
||||
}
|
||||
else
|
||||
@ -1006,7 +1006,7 @@ void MainWindow::on_actionUpdate_appearance_triggered()
|
||||
auto app = handler->getOverride(terrain, obj);
|
||||
if(!app)
|
||||
{
|
||||
if(obj->appearance.canBePlacedAt(terrain))
|
||||
if(obj->appearance->canBePlacedAt(terrain))
|
||||
continue;
|
||||
|
||||
auto templates = handler->getTemplates(terrain);
|
||||
@ -1018,7 +1018,7 @@ void MainWindow::on_actionUpdate_appearance_triggered()
|
||||
app = templates.front();
|
||||
}
|
||||
auto tiles = controller.mapHandler()->getTilesUnderObject(obj);
|
||||
obj->appearance = app.get();
|
||||
obj->appearance = app;
|
||||
controller.mapHandler()->invalidate(tiles);
|
||||
controller.mapHandler()->invalidate(obj);
|
||||
controller.scene(mapLevel)->selectionObjectsView.deselectObject(obj);
|
||||
|
@ -214,8 +214,8 @@ bool MapHandler::compareObjectBlitOrder(const CGObjectInstance * a, const CGObje
|
||||
return true;
|
||||
if (!b)
|
||||
return false;
|
||||
if (a->appearance.printPriority != b->appearance.printPriority)
|
||||
return a->appearance.printPriority > b->appearance.printPriority;
|
||||
if (a->appearance->printPriority != b->appearance->printPriority)
|
||||
return a->appearance->printPriority > b->appearance->printPriority;
|
||||
|
||||
if(a->pos.y != b->pos.y)
|
||||
return a->pos.y < b->pos.y;
|
||||
|
@ -40,7 +40,7 @@ bool ObjectBrowser::filterAcceptsRow(int source_row, const QModelIndex & source_
|
||||
auto factory = VLC->objtypeh->getHandlerFor(objId, objSubId);
|
||||
auto templ = factory->getTemplates()[templateId];
|
||||
|
||||
result = result & templ.canBePlacedAt(terrain);
|
||||
result = result & templ->canBePlacedAt(terrain);
|
||||
|
||||
//text filter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user