Skip to content

Does not build anymore #1

@pcercuei

Description

@pcercuei

graphics.cpp calls abs(static_cast<uint>(...)), but abs() is not defined for the type uint (which makes sense).

The fix is pretty simple:

diff --git a/src/graphics.cpp b/src/graphics.cpp
index 895ca88..a2e4054 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -378,7 +378,7 @@ void CenterCamera(char override) {
                int xStoppingDistance = 0; // How much distance it will take for the camera to come to
                                          // a complete stop if it starts slowing down now.
                
-               for (uint i = abs(static_cast<uint>(cameraXVel)); i > 0; i--) {
+               for (uint i = abs(static_cast<int>(cameraXVel)); i > 0; i--) {
                        xStoppingDistance += i;
                }
                
@@ -397,7 +397,7 @@ void CenterCamera(char override) {
                int yStoppingDistance = 0; // How much distance it will take for the camera to come to
                                          // a complete stop if it starts slowing down now.
                
-               for (uint i = abs(static_cast<uint>(cameraYVel)); i > 0; i--) {
+               for (uint i = abs(static_cast<int>(cameraYVel)); i > 0; i--) {
                        yStoppingDistance += i;
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions