Skip to content

Commit

Permalink
refactor(state): made const
Browse files Browse the repository at this point in the history
  • Loading branch information
ms0g committed Sep 18, 2024
1 parent 3bf6cc8 commit d6fcfb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/world/states.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace state {

static std::vector<glm::vec3> cube = {
static const std::vector<glm::vec3> cube = {
{0.0f, -1.0f, 0.0f},
{1.0f, -1.0f, 0.0f},
{0.0f, -1.0f, 1.0f},
Expand All @@ -17,7 +17,7 @@ static std::vector<glm::vec3> cube = {
{1.0f, 0.0f, 1.0f},
};

static std::vector<glm::vec3> oscCube = {
static const std::vector<glm::vec3> oscCube = {
{0.0f, 0.0f, 0.0f},
{1.0f, 0.0f, 0.0f},
{2.0f, 0.0f, 0.0f},
Expand Down
4 changes: 2 additions & 2 deletions src/world/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ void World::reset() {
setState(mCurrentState);
}

void World::setState(std::vector<glm::vec3>& state) {
void World::setState(const std::vector<glm::vec3>& state) {
if (mCurrentState != state)
mCurrentState = std::move(state);
mCurrentState = state;

for (auto& pos: mCurrentState) {
mAliveCells.emplace(key::createFromPosition(pos), Cell{pos});
Expand Down
2 changes: 1 addition & 1 deletion src/world/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class World {

void reset();

void setState(std::vector<glm::vec3>& state);
void setState(const std::vector<glm::vec3>& state);

void draw(glm::mat4 view, glm::mat4 projection);

Expand Down

0 comments on commit d6fcfb8

Please sign in to comment.