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:
@@ -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)
|
||||
|
@@ -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())
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user