*
* Filename: display.c
*
- * Description: Routines to handle the display
+ * Description: Routines to handle the display
*
* Version: 1.0
* Created: 15/03/2017 20:06:11
mvprintw(y+7, x, " | |");
}
-/* there's only nine valid (y, x) 2-uplets for this two shapes
+/* there's only nine valid (y, x) 2-uplets for this two shapes
* that are : - base_y, base_x +1
* - base_y, base_x + 6
- * - base_y, base_x + 11
- * - base_y + 3, base_x + 1
- * - base_y + 6, base_x + 1
- * - base_y + 3, base_x + 6
- * - base_y + 3, base_x + 11
- * - base_y + 6, base_x + 6
- * - base_y + 6, base_x + 11
+ * - base_y, base_x + 11
+ * - base_y + 3, base_x + 1
+ * - base_y + 6, base_x + 1
+ * - base_y + 3, base_x + 6
+ * - base_y + 3, base_x + 11
+ * - base_y + 6, base_x + 6
+ * - base_y + 6, base_x + 11
* The added (y, x) couple values can be {0, 3, 6}x{1, 6, 11}
*/
} else if (y > 1 && y <= 3) {
return (remap_y(y - 1) + 3);
} else {
- /* FIXME: return an error value like -1
- * but for now there a bug somewhere */
- return 6;
+ return -1;
}
}
} else if (x > 1 && x <= 3) {
return (remap_x(x - 1) + 5);
} else {
- /* FIXME: return an error value like -1
- * but for now there a bug somewhere */
- return 11;
+ return -1;
}
}
void print_coordinates(coordinates_t coordinates_array[], int base_y, int base_x) {
unsigned i = 0;
- while ((coordinates_array + i)->y != 0 && (coordinates_array + i)->x != 0) {
+ while ((coordinates_array + i)->y != 0 && (coordinates_array + i)->x != 0 && \
+ i < MAX_COORDINATES) {
if ((coordinates_array + i)->type == 0) {
print_o(base_y + remap_y((coordinates_array + i)->y), base_x + remap_x((coordinates_array + i)->x));
} else {