diff options
-rw-r--r-- | src/maze.tpp | 6 | ||||
-rw-r--r-- | src/mazerator.cpp | 4 | ||||
-rw-r--r-- | src/stack.hpp | 6 | ||||
-rw-r--r-- | src/stack.tpp | 2 | ||||
-rw-r--r-- | src/utils.cpp | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/maze.tpp b/src/maze.tpp index 6c4fd71..84c273e 100644 --- a/src/maze.tpp +++ b/src/maze.tpp @@ -111,8 +111,10 @@ void matrix_to_maze(Matrix<Element> *matrix, std::shared_ptr<Vector2> start_pos, visited_pos_cnt++; - auto random_dist = - std::uniform_int_distribution<unsigned int>(0U, neighbours.size() - 1UL); + auto random_dist = std::uniform_int_distribution<unsigned short>( + 0U, + static_cast<unsigned short>(neighbours.size()) - 1U + ); auto next_pos = neighbours[random_dist(random_gen)]; diff --git a/src/mazerator.cpp b/src/mazerator.cpp index f74f952..a82bbaf 100644 --- a/src/mazerator.cpp +++ b/src/mazerator.cpp @@ -8,7 +8,7 @@ #include <random> #include <string> -void optarg_error(char arg, std::string error) +void optarg_error(int arg, std::string error) { std::cout << "Error: Invalid option argument for -" << arg << ". " << error << std::endl; @@ -33,7 +33,7 @@ void validate_start_coords(unsigned int start_x, unsigned int start_y, unsigned * @param arg The command-line argument character * @param check_zero Whether or not to make sure that the result is not zero */ -void parse_uint_arg(unsigned int *num_dst, char arg, bool check_zero = false) +void parse_uint_arg(unsigned int *num_dst, int arg, bool check_zero = false) { try { diff --git a/src/stack.hpp b/src/stack.hpp index b156242..d5c1bdb 100644 --- a/src/stack.hpp +++ b/src/stack.hpp @@ -1,5 +1,4 @@ -#ifndef STACK_HPP -#define STACK_HPP +#pragma once #include <vector> @@ -15,7 +14,7 @@ public: * * @param capacity The capacity of the stack */ - Stack(int capacity); + Stack(unsigned long capacity); /** * Pushes a item onto the stack. @@ -40,4 +39,3 @@ private: #include "stack.tpp" -#endif diff --git a/src/stack.tpp b/src/stack.tpp index 958d6ca..405d493 100644 --- a/src/stack.tpp +++ b/src/stack.tpp @@ -3,7 +3,7 @@ #include <stdexcept> template <typename Item> -Stack<Item>::Stack(int capacity) +Stack<Item>::Stack(unsigned long capacity) { _items.reserve(capacity); } diff --git a/src/utils.cpp b/src/utils.cpp index 30ff4ec..480c31f 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -27,8 +27,8 @@ unsigned int str_to_uint(std::string str) if (waste_pos != str.length()) throw "Not a number"; - if (num > (unsigned long)UINT_MAX) + if (num > UINT_MAX) throw "Out of range"; - return (unsigned int)num; + return static_cast<unsigned int>(num); } |