From 75eeac06df9805a3f4c286a8fc34418e2f679561 Mon Sep 17 00:00:00 2001 From: Jan Mrna Date: Sat, 4 Oct 2025 17:10:40 +0200 Subject: [PATCH] Removed unused coded, fix compiler warnings --- cpp/src/math.hpp | 118 ------------------------------------ cpp/src/pathfinder/base.cpp | 2 +- cpp/src/user_input.cpp | 1 - 3 files changed, 1 insertion(+), 120 deletions(-) diff --git a/cpp/src/math.hpp b/cpp/src/math.hpp index 5d214b0..a6a3400 100644 --- a/cpp/src/math.hpp +++ b/cpp/src/math.hpp @@ -259,121 +259,3 @@ struct TilePosHash { } }; -// old stuff - TODO delete - -// constexpr double EQUALITY_LIMIT = 1e-6; -// template struct Vec2D { -// public: -// Vec2D() = default; -// ~Vec2D() = default; -// -// template -// Vec2D(Vec2D other) { -// this->x = static_cast(other.x); -// this->y = static_cast(other.y); -// } -// -// Vec2D& operator+=(const Vec2D &other) { -// x += other.x; -// y += other.y; -// return *this; -// } -// -// template -// requires std::is_arithmetic_v -// Vec2D& operator/=(U k) { -// this->x /= static_cast(k); -// this->y /= static_cast(k); -// return *this; -// } -// -// friend Vec2D operator+(const Vec2D &a, const Vec2D &b) { -// return Vec2D{a.x + b.x, a.y + b.y}; -// } -// -// friend Vec2D operator-(const Vec2D &a, const Vec2D &b) { -// return Vec2D{a.x - b.x, a.y - b.y}; -// } -// -// template -// requires std::is_arithmetic_v -// friend Vec2D operator*(U k, const Vec2D &v) -// { -// return Vec2D{k * v.x, k * v.y}; -// } -// -// template -// requires std::is_arithmetic_v -// friend Vec2D operator/(const Vec2D &v, U k) -// { -// return Vec2D{v.x / k, v.y / k}; -// } -// -// friend bool operator==(const Vec2D &a, const Vec2D &b) { -// if constexpr (std::is_integral_v) { -// return a.x == b.x && a.y == b.y; -// } else if constexpr (std::is_floating_point_v) { -// return a.distance(b) < EQUALITY_LIMIT; -// } else { -// static_assert("Unhandled comparison"); -// } -// } -// -// Vec2D operator*(float b) const { return Vec2D{b * x, b * y}; } -// -// T distance_squared(const Vec2D &other) const { -// T dx = x - other.x; -// T dy = y - other.y; -// return dx * dx + dy * dy; -// } -// -// T distance(const Vec2D &other) const -// requires std::floating_point -// { -// return sqrt(distance_squared(other)); -// } -// -// void normalize() -// requires std::floating_point -// { -// auto length = sqrt(x * x + y * y); -// if (length < EQUALITY_LIMIT) { -// x = y = 0; -// } else { -// x /= length; -// y /= length; -// } -// } -// -// Vec2D normalized() -// requires std::floating_point -// { -// Vec2D v(*this); -// v.normalize(); -// return v; -// } -// -// Vec2D orthogonal() const -// { -// Vec2D v(*this); -// -// std::swap(v.x, v.y); -// v.x = -v.x; -// return v; -// } -// -// template Vec2D(std::initializer_list list) { -// assert(list.size() == 2); -// auto first_element = *list.begin(); -// auto second_element = *(list.begin() + 1); -// x = static_cast(first_element); -// y = static_cast(second_element); -// } -// -// T x, y; -// -// friend std::ostream &operator<<(std::ostream &os, const Vec2D &obj) { -// os << "( " << obj.x << ", " << obj.y << ")"; -// return os; -// } -// }; diff --git a/cpp/src/pathfinder/base.cpp b/cpp/src/pathfinder/base.cpp index 5468672..cccaf5b 100644 --- a/cpp/src/pathfinder/base.cpp +++ b/cpp/src/pathfinder/base.cpp @@ -13,7 +13,7 @@ PathFinderBase::PathFinderBase(const Map* map) : m_Map(map) {} // LinearPathFinder also lives here, since it is too small to get it's // own implementation file -Path LinearPathFinder::CalculatePath(WorldPos start, WorldPos end) +Path LinearPathFinder::CalculatePath(WorldPos, WorldPos end) // first argument (start pos) not used { auto path = Path{end}; return path; diff --git a/cpp/src/user_input.cpp b/cpp/src/user_input.cpp index 46a6cdb..2c252f3 100644 --- a/cpp/src/user_input.cpp +++ b/cpp/src/user_input.cpp @@ -21,7 +21,6 @@ std::expected UserInput::Init() { return {}; } const std::vector &UserInput::GetActions() { m_Actions.clear(); - static WorldPos move_direction = {0.0f, 0.0f}; SDL_Event event; while (SDL_PollEvent(&event)) {