]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/map.cpp
Added .gitignore to ignore certain files + fixed access rights on Makefile* as
[quix0rs-blobwars.git] / src / map.cpp
index e7d548f9d99ecca0036ed9daf81b48ae670a9115..45559d3959ac9d70491aafddd9bc55246a436d28 100644 (file)
@@ -298,8 +298,6 @@ void showMap(int centerX, int centerY)
        
        graphics.blit(background, 0, 0, panel, false);
        
-       int color = graphics.black;
-       
        for (int y = 0 ; y < 48 ; y++)
        {
                for (int x = 0 ; x < 64 ; x++)
@@ -317,15 +315,15 @@ void showMap(int centerX, int centerY)
        {
                for (int x = 0 ; x < 64 ; x++)
                {
-                       color = -1;
+                       int color = graphics.black;
 
                        if (map.data[x1 + x][y1 + y] == MAP_AIR)
                        {
-                               color = -1;
+                               color = graphics.black;
                        }
                        else if (map.data[x1 + x][y1 + y] == MAP_WATER)
                        {
-                               color = -1;
+                               color = graphics.black;
                        }
                        else if (map.data[x1 + x][y1 + y] == MAP_SLIME)
                        {
@@ -337,7 +335,7 @@ void showMap(int centerX, int centerY)
                        }
                        else if (map.data[x1 + x][y1 + y] >= MAP_DECORATION)
                        {
-                               color = -1;
+                               color = graphics.black;
                                
                                if (map.data[x1 + x][y1 + y - 1] == MAP_WATER)
                                {
@@ -353,7 +351,7 @@ void showMap(int centerX, int centerY)
                                color = graphics.darkGreen;
                        }
 
-                       if (color > -1)
+                       if (color != graphics.black)
                        {
                                graphics.drawRect(x * 5, y * 5, 5, 5, color, panel);
                        }
@@ -415,6 +413,9 @@ void showMap(int centerX, int centerY)
 
                if ((config.isControl(CONTROL::MAP)) || (config.isControl(CONTROL::PAUSE)) || (engine.keyState[SDL_SCANCODE_ESCAPE]))
                {
+                       engine.keyState[SDL_SCANCODE_ESCAPE] = 0;
+                       config.resetControl(CONTROL::MAP);
+                       config.resetControl(CONTROL::PAUSE);
                        break;
                }