1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-08 22:26:51 +02:00

map editor: remove no longer needed check - getTown() return also randomTown

This commit is contained in:
godric3
2025-01-06 19:44:25 +01:00
parent 15175a267c
commit 5cfd4c9fff
3 changed files with 0 additions and 13 deletions

View File

@@ -332,11 +332,6 @@ void TownBuildingsDelegate::setEditorData(QWidget *editor, const QModelIndex &in
if(auto * ed = qobject_cast<TownBuildingsWidget *>(editor))
{
auto * ctown = town.getTown();
if(!ctown)
ctown = VLC->townh->randomTown;
if(!ctown)
throw std::runtime_error("No Town defined for type selected");
ed->addBuildings(*ctown);
}
else
@@ -366,8 +361,6 @@ void TownBuildingsDelegate::updateModelData(QAbstractItemModel * model, const QM
QStringList textList;
textList += QObject::tr("Built buildings:");
auto * ctown = town.getTown();
if(!ctown)
ctown = VLC->townh->randomTown;
for(const auto & buildingID : town.getBuildings())
{
if(buildingID == BuildingID::DEFAULT)

View File

@@ -105,10 +105,6 @@ void TownEventDialog::initResources()
void TownEventDialog::initBuildings()
{
auto * ctown = town.getTown();
if (!ctown)
ctown = VLC->townh->randomTown;
if (!ctown)
throw std::runtime_error("No Town defined for type selected");
auto allBuildings = ctown->getAllBuildings();
while (!allBuildings.empty())
{

View File

@@ -80,8 +80,6 @@ PlayerParams::PlayerParams(MapController & ctrl, int playerId, QWidget *parent)
if(auto town = dynamic_cast<CGTownInstance*>(controller.map()->objects[i].get()))
{
auto * ctown = town->getTown();
if(!ctown)
ctown = VLC->townh->randomTown;
if(ctown && town->getOwner().getNum() == playerColor)
{