Skip to content

Commit

Permalink
Fix compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Jun 2, 2024
1 parent c2453eb commit 7fcfdf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libopenage/gamestate/terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<coord::tile_t>(size[0])) {
current_offset.ne = 0;
current_offset.se += chunk_size[1];
}
Expand All @@ -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<coord::tile_t>(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<coord::tile_t>(size[1])) {
throw error::Error{ERR << "Height of chunk " << chunk->get_offset()
<< " exceeds terrain height: " << chunk_size[1]
<< " (max height: " << size[1] << ")"};
Expand Down
4 changes: 2 additions & 2 deletions libopenage/pathfinding/pathfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<coord::tile_t>(grid_width)
or request.target.se >= static_cast<coord::tile_t>(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, {}};
Expand Down

0 comments on commit 7fcfdf9

Please sign in to comment.