From 4e4536b474f75efbc9042aa750ce7548bbcd8cb2 Mon Sep 17 00:00:00 2001 From: heinezen Date: Sun, 2 Jun 2024 05:10:49 +0200 Subject: [PATCH] Fix compiler warnings. --- libopenage/gamestate/terrain.cpp | 6 +++--- libopenage/pathfinding/pathfinder.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libopenage/gamestate/terrain.cpp b/libopenage/gamestate/terrain.cpp index 8625c0b727..e7d078f2c5 100644 --- a/libopenage/gamestate/terrain.cpp +++ b/libopenage/gamestate/terrain.cpp @@ -45,7 +45,7 @@ Terrain::Terrain(const util::Vector2s &size, current_offset.ne += chunk_size[0]; // Wrap around to the next row - if (current_offset.ne == size[0]) { + if (current_offset.ne == static_cast(size[0])) { current_offset.ne = 0; current_offset.se += chunk_size[1]; } @@ -61,12 +61,12 @@ Terrain::Terrain(const util::Vector2s &size, } // Check terrain boundaries - if (current_offset.ne > size[0]) { + if (current_offset.ne > static_cast(size[0])) { throw error::Error{ERR << "Width of chunk " << chunk->get_offset() << " exceeds terrain width: " << chunk_size[0] << " (max width: " << size[0] << ")"}; } - else if (current_offset.se > size[1]) { + else if (current_offset.se > static_cast(size[1])) { throw error::Error{ERR << "Height of chunk " << chunk->get_offset() << " exceeds terrain height: " << chunk_size[1] << " (max height: " << size[1] << ")"}; diff --git a/libopenage/pathfinding/pathfinder.cpp b/libopenage/pathfinding/pathfinder.cpp index 37e049c3e9..b734f4a304 100644 --- a/libopenage/pathfinding/pathfinder.cpp +++ b/libopenage/pathfinding/pathfinder.cpp @@ -29,8 +29,8 @@ const Path Pathfinder::get_path(const PathRequest &request) { auto grid_height = grid_size[1] * sector_size; if (request.target.ne < 0 or request.target.se < 0 - or request.target.ne >= grid_width - or request.target.se >= grid_height) { + or request.target.ne >= static_cast(grid_width) + or request.target.se >= static_cast(grid_height)) { log::log(DBG << "Path not found (start = " << request.start << "; target = " << request.target << ")"); log::log(DBG << "Target is out of bounds."); return Path{request.grid_id, PathResult::OUT_OF_BOUNDS, {}};