Skip to content

Commit cbbaeb5

Browse files
committed
Engine: fixed unintended int->uint cast in MaskRouteFinder
This fixes negative coordinates overflow.
1 parent 35dcccc commit cbbaeb5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Engine/ac/route_finder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ bool MaskRouteFinder::FindRoute(std::vector<Point> &path, int srcx, int srcy, in
6363
return true;
6464
}
6565

66-
void MaskRouteFinder::SetWalkableArea(const AGS::Common::Bitmap *walkablearea, uint32_t coord_scale)
66+
void MaskRouteFinder::SetWalkableArea(const AGS::Common::Bitmap *walkablearea, int coord_scale)
6767
{
6868
_walkablearea = walkablearea;
6969
assert(coord_scale > 0);
70-
_coordScale = std::max(1u, coord_scale);
70+
_coordScale = std::max(1, coord_scale);
7171
OnSetWalkableArea();
7272
}
7373

Engine/ac/route_finder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class MaskRouteFinder : public IRouteFinder
6363
// Assign a walkable mask, and an optional coordinate scale factor which will be used
6464
// to convert (divide) input coordinates, and resulting path back (multiply).
6565
// Note that this may make routefinder to generate additional data, taking more time.
66-
void SetWalkableArea(const AGS::Common::Bitmap *walkablearea, uint32_t coord_scale = 1);
66+
void SetWalkableArea(const AGS::Common::Bitmap *walkablearea, int coord_scale = 1);
6767

6868
protected:
6969
// Update the implementation after a new walkable area is set
@@ -75,7 +75,7 @@ class MaskRouteFinder : public IRouteFinder
7575
bool exact_dest, bool ignore_walls) = 0;
7676

7777
const Common::Bitmap *_walkablearea = nullptr;
78-
uint32_t _coordScale = 1;
78+
int _coordScale = 1;
7979
};
8080

8181

0 commit comments

Comments
 (0)