aboutsummaryrefslogtreecommitdiff
path: root/src/mazerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mazerator.cpp')
-rw-r--r--src/mazerator.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/mazerator.cpp b/src/mazerator.cpp
index 81960af..a884bbd 100644
--- a/src/mazerator.cpp
+++ b/src/mazerator.cpp
@@ -65,9 +65,9 @@ int main(int argc, char *argv[])
BoundsOpts default_maze_bounds = {DEFAULT_MAZE_WIDTH, DEFAULT_MAZE_HEIGHT};
- app_options.maze_bounds(std::make_shared<Bounds>(default_maze_bounds));
+ app_options.maze_bounds = std::make_shared<Bounds>(default_maze_bounds);
- app_options.wall(DEFAULT_MAZE_WALL);
+ app_options.wall = DEFAULT_MAZE_WALL;
std::unique_ptr<unsigned int> start_x = nullptr;
std::unique_ptr<unsigned int> start_y = nullptr;
@@ -79,13 +79,13 @@ int main(int argc, char *argv[])
{
case 'w':
{
- app_options.maze_bounds()->width(
+ app_options.maze_bounds->width(
static_cast<unsigned int>(std::stoul(optarg, nullptr, NUMBER_BASE)));
break;
}
case 'h':
{
- app_options.maze_bounds()->height(
+ app_options.maze_bounds->height(
static_cast<unsigned int>(std::stoul(optarg, nullptr, NUMBER_BASE)));
break;
}
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
}
case 'W':
{
- app_options.wall(optarg);
+ app_options.wall = optarg;
break;
}
case 's':
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
unsigned int seed = 0;
parse_uint_arg(&seed, arg, true);
- app_options.random_gen(std::make_shared<RandomNumberGenerator>(seed));
+ app_options.random_gen = std::make_shared<RandomNumberGenerator>(seed);
break;
}
case 0:
@@ -152,30 +152,30 @@ int main(int argc, char *argv[])
}
}
- if (app_options.random_gen() == nullptr)
+ if (app_options.random_gen == nullptr)
{
- app_options.random_gen(std::make_shared<RandomNumberGenerator>());
+ app_options.random_gen = std::make_shared<RandomNumberGenerator>();
}
if (start_x == nullptr)
{
- start_x = std::make_unique<unsigned int>(app_options.random_gen()->in_range(
- 0, app_options.maze_bounds()->width() - 1U));
+ start_x = std::make_unique<unsigned int>(
+ app_options.random_gen->in_range(0, app_options.maze_bounds->width() - 1U));
}
if (start_y == nullptr)
{
- start_y = std::make_unique<unsigned int>(app_options.random_gen()->in_range(
- 0, app_options.maze_bounds()->height() - 1U));
+ start_y = std::make_unique<unsigned int>(
+ app_options.random_gen->in_range(0, app_options.maze_bounds->height() - 1U));
}
Vector2Opts start_coords = {.x = *start_x, .y = *start_y};
- app_options.start_coords(std::make_shared<Vector2>(start_coords));
+ app_options.start_coords = std::make_shared<Vector2>(start_coords);
try
{
- app_options.maze_bounds()->verify_coords(*app_options.start_coords());
+ app_options.maze_bounds->verify_coords(*app_options.start_coords);
}
catch (const char *error)
{
@@ -183,5 +183,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- app_start(app_options);
+ auto app = App(app_options);
+
+ app.run();
}