1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Merge pull request #3486 from Alexander-Wilms/replace-redundant-types-with-auto

Replace redundant types with `auto`
This commit is contained in:
Ivan Savenko 2024-01-17 13:31:05 +02:00 committed by GitHub
commit e849e4170a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 16 additions and 16 deletions

View File

@ -327,7 +327,7 @@ ExchangeResult HeroExchangeMap::tryExchangeNoLock(const ChainActor * other)
return result;
}
HeroActor * exchanged = new HeroActor(actor, other, newArmy, ai);
auto * exchanged = new HeroActor(actor, other, newArmy, ai);
exchanged->armyCost += newArmy->armyCost;
result.actor = exchanged;
@ -342,7 +342,7 @@ HeroExchangeArmy * HeroExchangeMap::tryUpgrade(
const CGObjectInstance * upgrader,
TResources resources) const
{
HeroExchangeArmy * target = new HeroExchangeArmy();
auto * target = new HeroExchangeArmy();
auto upgradeInfo = ai->armyManager->calculateCreaturesUpgrade(army, upgrader, resources);
if(upgradeInfo.upgradeValue)
@ -393,7 +393,7 @@ HeroExchangeArmy * HeroExchangeMap::tryUpgrade(
HeroExchangeArmy * HeroExchangeMap::pickBestCreatures(const CCreatureSet * army1, const CCreatureSet * army2) const
{
HeroExchangeArmy * target = new HeroExchangeArmy();
auto * target = new HeroExchangeArmy();
auto bestArmy = ai->armyManager->getBestArmy(actor->hero, army1, army2);
for(auto & slotInfo : bestArmy)
@ -445,7 +445,7 @@ std::string DwellingActor::toString() const
CCreatureSet * DwellingActor::getDwellingCreatures(const CGDwelling * dwelling, bool waitForGrowth)
{
CCreatureSet * dwellingCreatures = new CCreatureSet();
auto * dwellingCreatures = new CCreatureSet();
for(auto & creatureInfo : dwelling->creatures)
{

View File

@ -184,7 +184,7 @@ std::shared_ptr<IImage> SDLImage::scaleFast(const Point & size) const
else
CSDL_Ext::setDefaultColorKey(scaled);//just in case
SDLImage * ret = new SDLImage(scaled, EImageBlitMode::ALPHA);
auto * ret = new SDLImage(scaled, EImageBlitMode::ALPHA);
ret->fullSize.x = (int) round((float)fullSize.x * scaleX);
ret->fullSize.y = (int) round((float)fullSize.y * scaleY);

View File

@ -139,10 +139,10 @@ void Lobby::serverCommand(const ServerCommand & command) try
int playersJoined = args[tagPoint++].toInt();
int playersTotal = args[tagPoint++].toInt();
QTableWidgetItem * sessionPlayerItem = new QTableWidgetItem(QString("%1/%2").arg(playersJoined).arg(playersTotal));
auto * sessionPlayerItem = new QTableWidgetItem(QString("%1/%2").arg(playersJoined).arg(playersTotal));
ui->sessionsTable->setItem(i, 1, sessionPlayerItem);
QTableWidgetItem * sessionProtectedItem = new QTableWidgetItem();
auto * sessionProtectedItem = new QTableWidgetItem();
bool isPrivate = (args[tagPoint++] == "True");
sessionProtectedItem->setData(Qt::UserRole, isPrivate);
if(isPrivate)

View File

@ -852,7 +852,7 @@ void CModListView::loadScreenshots()
{
// managed to load cached image
QIcon icon(pixmap);
QListWidgetItem * item = new QListWidgetItem(icon, QString(tr("Screenshot %1")).arg(ui->screenshotsList->count() + 1));
auto * item = new QListWidgetItem(icon, QString(tr("Screenshot %1")).arg(ui->screenshotsList->count() + 1));
ui->screenshotsList->addItem(item);
}
}

View File

@ -43,7 +43,7 @@ void ImageViewer::showPixmap(QPixmap & pixmap, QWidget * parent)
{
assert(!pixmap.isNull());
ImageViewer * iw = new ImageViewer(parent);
auto * iw = new ImageViewer(parent);
QSize size = pixmap.size();
size.scale(iw->calculateWindowSize(), Qt::KeepAspectRatio);

View File

@ -79,7 +79,7 @@ UpdateDialog::~UpdateDialog()
void UpdateDialog::showUpdateDialog(bool isManually)
{
UpdateDialog * dialog = new UpdateDialog(isManually);
auto * dialog = new UpdateDialog(isManually);
dialog->setAttribute(Qt::WA_DeleteOnClose);
}

View File

@ -586,7 +586,7 @@ void MainWindow::loadObjectsTree()
//adding terrains
for(auto & terrain : VLC->terrainTypeHandler->objects)
{
QPushButton *b = new QPushButton(QString::fromStdString(terrain->getNameTranslated()));
auto *b = new QPushButton(QString::fromStdString(terrain->getNameTranslated()));
ui->terrainLayout->addWidget(b);
connect(b, &QPushButton::clicked, this, [this, terrain]{ terrainButtonClicked(terrain->getId()); });
@ -601,7 +601,7 @@ void MainWindow::loadObjectsTree()
//adding roads
for(auto & road : VLC->roadTypeHandler->objects)
{
QPushButton *b = new QPushButton(QString::fromStdString(road->getNameTranslated()));
auto *b = new QPushButton(QString::fromStdString(road->getNameTranslated()));
ui->roadLayout->addWidget(b);
connect(b, &QPushButton::clicked, this, [this, road]{ roadOrRiverButtonClicked(road->getIndex(), true); });
}
@ -610,7 +610,7 @@ void MainWindow::loadObjectsTree()
//adding rivers
for(auto & river : VLC->riverTypeHandler->objects)
{
QPushButton *b = new QPushButton(QString::fromStdString(river->getNameTranslated()));
auto *b = new QPushButton(QString::fromStdString(river->getNameTranslated()));
ui->riverLayout->addWidget(b);
connect(b, &QPushButton::clicked, this, [this, river]{ roadOrRiverButtonClicked(river->getIndex(), false); });
}

View File

@ -128,7 +128,7 @@ void ObjectBrowser::startDrag(Qt::DropActions supportedActions)
if(!mimeData)
return;
QDrag *drag = new QDrag(this);
auto *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->exec(supportedActions);
}

View File

@ -85,7 +85,7 @@ public:
UnitFake & add(ui8 side)
{
UnitFake * unit = new UnitFake();
auto * unit = new UnitFake();
EXPECT_CALL(*unit, unitSide()).WillRepeatedly(Return(side));
unit->setDefaultExpectations();

View File

@ -46,7 +46,7 @@ void UnitFake::expectAnyBonusSystemCall()
UnitFake & UnitsFake::add(ui8 side)
{
UnitFake * unit = new UnitFake();
auto * unit = new UnitFake();
ON_CALL(*unit, unitSide()).WillByDefault(Return(side));
unit->redirectBonusesToFake();