X-Git-Url: https://git.piment-noir.org/?p=TD_C.git;a=blobdiff_plain;f=TP_13%2Fexo2%2Flib%2Fdisplay.c;h=72bd0f5f37e071b639d7da69ac025f0d21956eb4;hp=c04b51b1feb5e4ae0dfebbd2d258503e362d3891;hb=98edfbe1c6a32654f9985239ae1a5d05c74e6a0f;hpb=91ba44d96d13bbc427aa64a63a529f0330467638 diff --git a/TP_13/exo2/lib/display.c b/TP_13/exo2/lib/display.c index c04b51b..72bd0f5 100644 --- a/TP_13/exo2/lib/display.c +++ b/TP_13/exo2/lib/display.c @@ -68,9 +68,11 @@ static int remap_y(int y) { if (y == 1) { return 0; - } else if (y == 2) { - return 3; - } else { + } 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; } } @@ -79,9 +81,11 @@ static int remap_x(int x) { if (x == 1) { return 1; - } else if (x == 2) { - return 6; + } 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; } }