refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)

This commit is contained in:
Francesco Borzì
2020-12-06 19:39:48 +01:00
committed by GitHub
parent d4a58700d4
commit 161302252e
82 changed files with 1565 additions and 1569 deletions
+8 -8
View File
@@ -45,26 +45,26 @@ struct Cell
y = data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
bool DiffCell(const Cell& cell) const
[[nodiscard]] bool DiffCell(const Cell& cell) const
{
return(data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y);
}
bool DiffGrid(const Cell& cell) const
[[nodiscard]] bool DiffGrid(const Cell& cell) const
{
return(data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y);
}
uint32 CellX() const { return data.Part.cell_x; }
uint32 CellY() const { return data.Part.cell_y; }
uint32 GridX() const { return data.Part.grid_x; }
uint32 GridY() const { return data.Part.grid_y; }
bool NoCreate() const { return data.Part.nocreate; }
[[nodiscard]] uint32 CellX() const { return data.Part.cell_x; }
[[nodiscard]] uint32 CellY() const { return data.Part.cell_y; }
[[nodiscard]] uint32 GridX() const { return data.Part.grid_x; }
[[nodiscard]] uint32 GridY() const { return data.Part.grid_y; }
[[nodiscard]] bool NoCreate() const { return data.Part.nocreate; }
void SetNoCreate() { data.Part.nocreate = 1; }
CellCoord GetCellCoord() const
[[nodiscard]] CellCoord GetCellCoord() const
{
return CellCoord(
data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x,
+2 -2
View File
@@ -121,7 +121,7 @@ struct CoordPair
y_coord = LIMIT - 1;
}
bool IsCoordValid() const
[[nodiscard]] bool IsCoordValid() const
{
return x_coord < LIMIT && y_coord < LIMIT;
}
@@ -133,7 +133,7 @@ struct CoordPair
return *this;
}
uint32 GetId() const
[[nodiscard]] uint32 GetId() const
{
return y_coord * LIMIT + x_coord;
}
+5 -5
View File
@@ -37,21 +37,21 @@ public:
return i_cells[x][y];
}
GridType const& GetGridType(const uint32 x, const uint32 y) const
[[nodiscard]] GridType const& GetGridType(const uint32 x, const uint32 y) const
{
ASSERT(x < N && y < N);
return i_cells[x][y];
}
uint32 GetGridId(void) const { return i_gridId; }
int32 getX() const { return i_x; }
int32 getY() const { return i_y; }
[[nodiscard]] uint32 GetGridId(void) const { return i_gridId; }
[[nodiscard]] int32 getX() const { return i_x; }
[[nodiscard]] int32 getY() const { return i_y; }
void link(GridRefManager<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> >* pTo)
{
i_Reference.link(pTo, this);
}
bool isGridObjectDataLoaded() const { return i_GridObjectDataLoaded; }
[[nodiscard]] bool isGridObjectDataLoaded() const { return i_GridObjectDataLoaded; }
void setGridObjectDataLoaded(bool pLoaded) { i_GridObjectDataLoaded = pLoaded; }
/*