Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds mini-map pentagram #6968

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Source/engine/render/automap_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,20 @@ void DrawMapLineSteepSW(const Surface &out, Point from, int width, std::uint8_t
*/
void DrawMapFreeLine(const Surface &out, Point from, Point to, uint8_t colorIndex)
{
int dx = std::abs(to.x - from.x);
int dy = std::abs(to.y - from.y);
int sx = from.x < to.x ? 1 : -1;
int sy = from.y < to.y ? 1 : -1;
const int dx = std::abs(to.x - from.x);
const int dy = std::abs(to.y - from.y);
const int sx = from.x < to.x ? 1 : -1;
const int sy = from.y < to.y ? 1 : -1;
int err = dx - dy;

while (true) {
out.SetPixel(from, colorIndex);
SetMapPixel(out, from, colorIndex);

if (from.x == to.x && from.y == to.y) {
break;
}

int e2 = 2 * err;
const int e2 = 2 * err;
if (e2 > -dy) {
err -= dy;
from.x += sx;
Expand Down
Loading