mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +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))
|
if(auto * ed = qobject_cast<TownBuildingsWidget *>(editor))
|
||||||
{
|
{
|
||||||
auto * ctown = town.getTown();
|
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);
|
ed->addBuildings(*ctown);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -366,8 +361,6 @@ void TownBuildingsDelegate::updateModelData(QAbstractItemModel * model, const QM
|
|||||||
QStringList textList;
|
QStringList textList;
|
||||||
textList += QObject::tr("Built buildings:");
|
textList += QObject::tr("Built buildings:");
|
||||||
auto * ctown = town.getTown();
|
auto * ctown = town.getTown();
|
||||||
if(!ctown)
|
|
||||||
ctown = VLC->townh->randomTown;
|
|
||||||
for(const auto & buildingID : town.getBuildings())
|
for(const auto & buildingID : town.getBuildings())
|
||||||
{
|
{
|
||||||
if(buildingID == BuildingID::DEFAULT)
|
if(buildingID == BuildingID::DEFAULT)
|
||||||
|
@@ -105,10 +105,6 @@ void TownEventDialog::initResources()
|
|||||||
void TownEventDialog::initBuildings()
|
void TownEventDialog::initBuildings()
|
||||||
{
|
{
|
||||||
auto * ctown = town.getTown();
|
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();
|
auto allBuildings = ctown->getAllBuildings();
|
||||||
while (!allBuildings.empty())
|
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()))
|
if(auto town = dynamic_cast<CGTownInstance*>(controller.map()->objects[i].get()))
|
||||||
{
|
{
|
||||||
auto * ctown = town->getTown();
|
auto * ctown = town->getTown();
|
||||||
if(!ctown)
|
|
||||||
ctown = VLC->townh->randomTown;
|
|
||||||
|
|
||||||
if(ctown && town->getOwner().getNum() == playerColor)
|
if(ctown && town->getOwner().getNum() == playerColor)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user