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:
commit
e849e4170a
@ -327,7 +327,7 @@ ExchangeResult HeroExchangeMap::tryExchangeNoLock(const ChainActor * other)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeroActor * exchanged = new HeroActor(actor, other, newArmy, ai);
|
auto * exchanged = new HeroActor(actor, other, newArmy, ai);
|
||||||
|
|
||||||
exchanged->armyCost += newArmy->armyCost;
|
exchanged->armyCost += newArmy->armyCost;
|
||||||
result.actor = exchanged;
|
result.actor = exchanged;
|
||||||
@ -342,7 +342,7 @@ HeroExchangeArmy * HeroExchangeMap::tryUpgrade(
|
|||||||
const CGObjectInstance * upgrader,
|
const CGObjectInstance * upgrader,
|
||||||
TResources resources) const
|
TResources resources) const
|
||||||
{
|
{
|
||||||
HeroExchangeArmy * target = new HeroExchangeArmy();
|
auto * target = new HeroExchangeArmy();
|
||||||
auto upgradeInfo = ai->armyManager->calculateCreaturesUpgrade(army, upgrader, resources);
|
auto upgradeInfo = ai->armyManager->calculateCreaturesUpgrade(army, upgrader, resources);
|
||||||
|
|
||||||
if(upgradeInfo.upgradeValue)
|
if(upgradeInfo.upgradeValue)
|
||||||
@ -393,7 +393,7 @@ HeroExchangeArmy * HeroExchangeMap::tryUpgrade(
|
|||||||
|
|
||||||
HeroExchangeArmy * HeroExchangeMap::pickBestCreatures(const CCreatureSet * army1, const CCreatureSet * army2) const
|
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);
|
auto bestArmy = ai->armyManager->getBestArmy(actor->hero, army1, army2);
|
||||||
|
|
||||||
for(auto & slotInfo : bestArmy)
|
for(auto & slotInfo : bestArmy)
|
||||||
@ -445,7 +445,7 @@ std::string DwellingActor::toString() const
|
|||||||
|
|
||||||
CCreatureSet * DwellingActor::getDwellingCreatures(const CGDwelling * dwelling, bool waitForGrowth)
|
CCreatureSet * DwellingActor::getDwellingCreatures(const CGDwelling * dwelling, bool waitForGrowth)
|
||||||
{
|
{
|
||||||
CCreatureSet * dwellingCreatures = new CCreatureSet();
|
auto * dwellingCreatures = new CCreatureSet();
|
||||||
|
|
||||||
for(auto & creatureInfo : dwelling->creatures)
|
for(auto & creatureInfo : dwelling->creatures)
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,7 @@ std::shared_ptr<IImage> SDLImage::scaleFast(const Point & size) const
|
|||||||
else
|
else
|
||||||
CSDL_Ext::setDefaultColorKey(scaled);//just in case
|
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.x = (int) round((float)fullSize.x * scaleX);
|
||||||
ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
|
ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
|
||||||
|
@ -139,10 +139,10 @@ void Lobby::serverCommand(const ServerCommand & command) try
|
|||||||
|
|
||||||
int playersJoined = args[tagPoint++].toInt();
|
int playersJoined = args[tagPoint++].toInt();
|
||||||
int playersTotal = 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);
|
ui->sessionsTable->setItem(i, 1, sessionPlayerItem);
|
||||||
|
|
||||||
QTableWidgetItem * sessionProtectedItem = new QTableWidgetItem();
|
auto * sessionProtectedItem = new QTableWidgetItem();
|
||||||
bool isPrivate = (args[tagPoint++] == "True");
|
bool isPrivate = (args[tagPoint++] == "True");
|
||||||
sessionProtectedItem->setData(Qt::UserRole, isPrivate);
|
sessionProtectedItem->setData(Qt::UserRole, isPrivate);
|
||||||
if(isPrivate)
|
if(isPrivate)
|
||||||
|
@ -852,7 +852,7 @@ void CModListView::loadScreenshots()
|
|||||||
{
|
{
|
||||||
// managed to load cached image
|
// managed to load cached image
|
||||||
QIcon icon(pixmap);
|
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);
|
ui->screenshotsList->addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ void ImageViewer::showPixmap(QPixmap & pixmap, QWidget * parent)
|
|||||||
{
|
{
|
||||||
assert(!pixmap.isNull());
|
assert(!pixmap.isNull());
|
||||||
|
|
||||||
ImageViewer * iw = new ImageViewer(parent);
|
auto * iw = new ImageViewer(parent);
|
||||||
|
|
||||||
QSize size = pixmap.size();
|
QSize size = pixmap.size();
|
||||||
size.scale(iw->calculateWindowSize(), Qt::KeepAspectRatio);
|
size.scale(iw->calculateWindowSize(), Qt::KeepAspectRatio);
|
||||||
|
@ -79,7 +79,7 @@ UpdateDialog::~UpdateDialog()
|
|||||||
|
|
||||||
void UpdateDialog::showUpdateDialog(bool isManually)
|
void UpdateDialog::showUpdateDialog(bool isManually)
|
||||||
{
|
{
|
||||||
UpdateDialog * dialog = new UpdateDialog(isManually);
|
auto * dialog = new UpdateDialog(isManually);
|
||||||
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
}
|
||||||
|
@ -586,7 +586,7 @@ void MainWindow::loadObjectsTree()
|
|||||||
//adding terrains
|
//adding terrains
|
||||||
for(auto & terrain : VLC->terrainTypeHandler->objects)
|
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);
|
ui->terrainLayout->addWidget(b);
|
||||||
connect(b, &QPushButton::clicked, this, [this, terrain]{ terrainButtonClicked(terrain->getId()); });
|
connect(b, &QPushButton::clicked, this, [this, terrain]{ terrainButtonClicked(terrain->getId()); });
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ void MainWindow::loadObjectsTree()
|
|||||||
//adding roads
|
//adding roads
|
||||||
for(auto & road : VLC->roadTypeHandler->objects)
|
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);
|
ui->roadLayout->addWidget(b);
|
||||||
connect(b, &QPushButton::clicked, this, [this, road]{ roadOrRiverButtonClicked(road->getIndex(), true); });
|
connect(b, &QPushButton::clicked, this, [this, road]{ roadOrRiverButtonClicked(road->getIndex(), true); });
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ void MainWindow::loadObjectsTree()
|
|||||||
//adding rivers
|
//adding rivers
|
||||||
for(auto & river : VLC->riverTypeHandler->objects)
|
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);
|
ui->riverLayout->addWidget(b);
|
||||||
connect(b, &QPushButton::clicked, this, [this, river]{ roadOrRiverButtonClicked(river->getIndex(), false); });
|
connect(b, &QPushButton::clicked, this, [this, river]{ roadOrRiverButtonClicked(river->getIndex(), false); });
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void ObjectBrowser::startDrag(Qt::DropActions supportedActions)
|
|||||||
if(!mimeData)
|
if(!mimeData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDrag *drag = new QDrag(this);
|
auto *drag = new QDrag(this);
|
||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
drag->exec(supportedActions);
|
drag->exec(supportedActions);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
UnitFake & add(ui8 side)
|
UnitFake & add(ui8 side)
|
||||||
{
|
{
|
||||||
UnitFake * unit = new UnitFake();
|
auto * unit = new UnitFake();
|
||||||
EXPECT_CALL(*unit, unitSide()).WillRepeatedly(Return(side));
|
EXPECT_CALL(*unit, unitSide()).WillRepeatedly(Return(side));
|
||||||
unit->setDefaultExpectations();
|
unit->setDefaultExpectations();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void UnitFake::expectAnyBonusSystemCall()
|
|||||||
|
|
||||||
UnitFake & UnitsFake::add(ui8 side)
|
UnitFake & UnitsFake::add(ui8 side)
|
||||||
{
|
{
|
||||||
UnitFake * unit = new UnitFake();
|
auto * unit = new UnitFake();
|
||||||
ON_CALL(*unit, unitSide()).WillByDefault(Return(side));
|
ON_CALL(*unit, unitSide()).WillByDefault(Return(side));
|
||||||
unit->redirectBonusesToFake();
|
unit->redirectBonusesToFake();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user