mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
AGS: Fixed potential use of uninitialized vars
From upstream 17235c31bad1df1cc23f46c7617023ab62e52e21
This commit is contained in:
parent
85684cbae6
commit
741405aa3f
@ -231,23 +231,23 @@ void invalidate_rect_on_surf(int x1, int y1, int x2, int y2, DirtyRects &rects)
|
||||
dirtyRow[a].numSpans++;
|
||||
} else {
|
||||
// didn't fit in an existing span, and there are none spare
|
||||
int nearestDist = 99999, nearestWas = -1, extendLeft = false;
|
||||
int tleft, tright;
|
||||
int nearestDist = 99999, nearestWas = -1, extendLeft = 0;
|
||||
// find the nearest span, and enlarge that to include this rect
|
||||
for (s = 0; s < dirtyRow[a].numSpans; s++) {
|
||||
tleft = dirtyRow[a].span[s].x1 - x2;
|
||||
int tleft = dirtyRow[a].span[s].x1 - x2;
|
||||
if ((tleft > 0) && (tleft < nearestDist)) {
|
||||
nearestDist = tleft;
|
||||
nearestWas = s;
|
||||
extendLeft = 1;
|
||||
}
|
||||
tright = x1 - dirtyRow[a].span[s].x2;
|
||||
int tright = x1 - dirtyRow[a].span[s].x2;
|
||||
if ((tright > 0) && (tright < nearestDist)) {
|
||||
nearestDist = tright;
|
||||
nearestWas = s;
|
||||
extendLeft = 0;
|
||||
}
|
||||
}
|
||||
assert(nearestWas >= 0);
|
||||
if (extendLeft)
|
||||
dirtyRow[a].span[nearestWas].x1 = x1;
|
||||
else
|
||||
|
@ -110,19 +110,18 @@ void get_lastcpos(int &lastcx_, int &lastcy_) {
|
||||
|
||||
int find_nearest_walkable_area(Bitmap *tempw, int fromX, int fromY, int toX, int toY, int destX, int destY, int granularity) {
|
||||
assert(tempw != nullptr);
|
||||
|
||||
int ex, ey, nearest = 99999, thisis, nearx = 0, neary = 0;
|
||||
if (fromX < 0) fromX = 0;
|
||||
if (fromY < 0) fromY = 0;
|
||||
if (toX >= tempw->GetWidth()) toX = tempw->GetWidth() - 1;
|
||||
if (toY >= tempw->GetHeight()) toY = tempw->GetHeight() - 1;
|
||||
|
||||
for (ex = fromX; ex < toX; ex += granularity) {
|
||||
for (ey = fromY; ey < toY; ey += granularity) {
|
||||
int nearest = 99999, nearx = -1, neary = -1;
|
||||
for (int ex = fromX; ex < toX; ex += granularity) {
|
||||
for (int ey = fromY; ey < toY; ey += granularity) {
|
||||
if (tempw->GetScanLine(ey)[ex] != 232)
|
||||
continue;
|
||||
|
||||
thisis = (int)::sqrt((double)((ex - destX) * (ex - destX) + (ey - destY) * (ey - destY)));
|
||||
int thisis = (int)::sqrt((double)((ex - destX) * (ex - destX) + (ey - destY) * (ey - destY)));
|
||||
if (thisis < nearest) {
|
||||
nearest = thisis;
|
||||
nearx = ex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user