Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Revision:
48:4078877669e4
Parent:
47:728502df3cb6
Child:
49:652438112348
--- a/source/Mapping.cpp	Wed Apr 12 13:30:44 2017 +0000
+++ b/source/Mapping.cpp	Thu Apr 13 09:18:58 2017 +0000
@@ -56,28 +56,38 @@
     uint8_t y_negative_offset = 0;
     uint8_t y_positive_offset = 0;
 
-    if(pos.x < 5) {
-        x_negative_offset = 5-pos.x;
+    if (pos.x < 5) {
+        x_negative_offset = 3 - pos.x;
+    }
+    if (pos.x > (col-5)) {
+        x_positive_offset = pos.x - (col - 4);
     }
-    if(pos.x > 195) {
-        x_positive_offset = pos.x-195;
+
+    if (pos.y < 5) {
+        y_negative_offset = 3 - pos.y; 
+    }
+    if (pos.y > (row-5)) {
+        y_positive_offset = pos.y - (row - 4);
     }
 
-    if(pos.y < 5) {
-        y_negative_offset = 5-pos.y;
-    }
-    if(pos.y > 195) {
-        y_positive_offset = pos.y-195;
-    }
-    
-    for(int y = 0 + y_negative_offset; y < 7-y_positive_offset; y++) {
-        for(int x = 0 + x_negative_offset; x < 7-x_positive_offset; x++) {
-            
-            obstacle_list[pos.x-3+x][pos.y-3+y] = obstacle_list_superpos[x][y];
+    for (int y = 0 + y_negative_offset; y < 7 - y_positive_offset; y++) {
+        for (int x = 0 + x_negative_offset; x < 7 - x_positive_offset; x++) {
+
+            obstacle_list[pos.y - 3 + y][pos.x - 3 + x] = obstacle_list_superpos[y][x];
         }
     }
 }
 
+void draw_map() {
+    for (int y = 0; y < col; y++) {
+        for (int x = 0; x < row; x++) {
+            printf("%d ", obstacle_list[y][x]);
+        }
+        printf("\n");
+    }
+    printf("\n");
+}
+
 position position_calculation(float distance,float degree,float offsetx,float offsety, float heading)
 {