Skip to content

Commit

Permalink
use const auto& in suggested places
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Jan 14, 2023
1 parent 434d84c commit 3191a61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (o->second->cell)
{
auto d = discoveredCells.find(o->second->cell->cellId);
const auto& d = discoveredCells.find(o->second->cell->cellId);
if (d != discoveredCells.end())
{
o = player.visibleCell->objects.erase(o);
Expand All @@ -604,7 +604,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (c->second->cell)
{
auto d = discoveredCells.find(c->second->cell->cellId);
const auto& d = discoveredCells.find(c->second->cell->cellId);
if (d != discoveredCells.end())
{
c = player.visibleCell->checkpoints.erase(c);
Expand All @@ -628,7 +628,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (r->second->cell)
{
auto d = discoveredCells.find(r->second->cell->cellId);
const auto& d = discoveredCells.find(r->second->cell->cellId);
if (d != discoveredCells.end())
{
r = player.visibleCell->raceCheckpoints.erase(r);
Expand All @@ -652,7 +652,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (m->second->cell)
{
auto d = discoveredCells.find(m->second->cell->cellId);
const auto& d = discoveredCells.find(m->second->cell->cellId);
if (d != discoveredCells.end())
{
m = player.visibleCell->mapIcons.erase(m);
Expand All @@ -676,7 +676,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (t->second->cell)
{
auto d = discoveredCells.find(t->second->cell->cellId);
const auto& d = discoveredCells.find(t->second->cell->cellId);
if (d != discoveredCells.end())
{
t = player.visibleCell->textLabels.erase(t);
Expand All @@ -700,7 +700,7 @@ void Grid::processDiscoveredCellsForPlayer(Player &player, std::vector<SharedCel
{
if (a->second->cell)
{
auto d = discoveredCells.find(a->second->cell->cellId);
const auto& d = discoveredCells.find(a->second->cell->cellId);
if (d != discoveredCells.end())
{
a = player.visibleCell->areas.erase(a);
Expand Down
2 changes: 1 addition & 1 deletion src/utility/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace Utility
template<typename T>
inline int getFirstValueInContainer(const std::unordered_set<T> &container)
{
auto i = container.begin();
const auto& i = container.begin();
if (i != container.end())
{
return *i;
Expand Down

0 comments on commit 3191a61

Please sign in to comment.