1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fix terrains/roads/rivers after code synch

This commit is contained in:
nordsoft 2022-10-09 00:11:29 +04:00
parent 6d92a66fea
commit 2eb49315f5
6 changed files with 11 additions and 11 deletions

View File

@ -376,7 +376,7 @@ void MainWindow::terrainButtonClicked(TerrainId terrain)
controller.commitTerrainChange(mapLevel, terrain);
}
void MainWindow::roadOrRiverButtonClicked(std::string type, bool isRoad)
void MainWindow::roadOrRiverButtonClicked(ui8 type, bool isRoad)
{
controller.commitRoadOrRiverChange(mapLevel, type, isRoad);
}
@ -500,7 +500,7 @@ void MainWindow::loadObjectsTree()
{
QPushButton *b = new QPushButton(QString::fromStdString(road.fileName));
ui->roadLayout->addWidget(b);
connect(b, &QPushButton::clicked, this, [this, road]{ roadOrRiverButtonClicked(road.code, true); });
connect(b, &QPushButton::clicked, this, [this, road]{ roadOrRiverButtonClicked(road.id, true); });
}
//add spacer to keep terrain button on the top
ui->roadLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
@ -509,7 +509,7 @@ void MainWindow::loadObjectsTree()
{
QPushButton *b = new QPushButton(QString::fromStdString(river.fileName));
ui->riverLayout->addWidget(b);
connect(b, &QPushButton::clicked, this, [this, river]{ roadOrRiverButtonClicked(river.code, false); });
connect(b, &QPushButton::clicked, this, [this, river]{ roadOrRiverButtonClicked(river.id, false); });
}
//add spacer to keep terrain button on the top
ui->riverLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));

View File

@ -70,7 +70,7 @@ private slots:
void on_toolArea_clicked(bool checked);
void terrainButtonClicked(TerrainId terrain);
void roadOrRiverButtonClicked(std::string type, bool isRoad);
void roadOrRiverButtonClicked(ui8 type, bool isRoad);
void on_toolErase_clicked();

View File

@ -257,7 +257,7 @@ void MapController::commitTerrainChange(int level, const TerrainId & terrain)
main->mapChanged();
}
void MapController::commitRoadOrRiverChange(int level, const std::string & type, bool isRoad)
void MapController::commitRoadOrRiverChange(int level, ui8 type, bool isRoad)
{
std::vector<int3> v(_scenes[level]->selectionTerrainView.selection().begin(),
_scenes[level]->selectionTerrainView.selection().end());
@ -269,9 +269,9 @@ void MapController::commitRoadOrRiverChange(int level, const std::string & type,
_map->getEditManager()->getTerrainSelection().setSelection(v);
if(isRoad)
_map->getEditManager()->drawRoad(VLC->terrainTypeHandler->getRoadByName(type)->id, &CRandomGenerator::getDefault());
_map->getEditManager()->drawRoad(RoadId(type), &CRandomGenerator::getDefault());
else
_map->getEditManager()->drawRiver(VLC->terrainTypeHandler->getRiverByName(type)->id, &CRandomGenerator::getDefault());
_map->getEditManager()->drawRiver(RiverId(type), &CRandomGenerator::getDefault());
for(auto & t : v)
_scenes[level]->terrainView.setDirty(t);

View File

@ -30,7 +30,7 @@ public:
void sceneForceUpdate(int level);
void commitTerrainChange(int level, const TerrainId & terrain);
void commitRoadOrRiverChange(int level, const std::string & type, bool isRoad);
void commitRoadOrRiverChange(int level, ui8 type, bool isRoad);
void commitObjectErase(const CGObjectInstance* obj);
void commitObjectErase(int level);
void commitObstacleFill(int level);

View File

@ -106,7 +106,7 @@ void MapHandler::drawRoad(QPainter & painter, int x, int y, int z)
auto * tinfoUpper = map->isInTheMap(int3(x, y - 1, z)) ? &map->getTile(int3(x, y - 1, z)) : nullptr;
//TODO: use ui8 instead of string key
auto roadName = tinfo.terType->name;
auto roadName = tinfo.roadType->fileName;
if (tinfoUpper && tinfoUpper->roadType->id != Road::NO_ROAD)
{
@ -139,7 +139,7 @@ void MapHandler::drawRiver(QPainter & painter, int x, int y, int z)
return;
//TODO: use ui8 instead of string key
auto riverName = tinfo.terType->name;
auto riverName = tinfo.riverType->fileName;
if(riverImages.at(riverName).size() <= tinfo.riverDir)
return;

View File

@ -765,7 +765,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="okButtong">
<widget class="QPushButton" name="okButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>