From af2b1331e303b42a909868dcfe24fe7eaa0eedb4 Mon Sep 17 00:00:00 2001 From: JM <crewgan@pop-os.localdomain> Date: Sat, 21 May 2022 13:09:35 +0200 Subject: [PATCH] =?UTF-8?q?Warnings=20retir=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/draw.c | 6 +++--- src/field.c | 5 +++-- src/field.h | 11 ----------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/draw.c b/src/draw.c index 41f1417..ae3ffd9 100644 --- a/src/draw.c +++ b/src/draw.c @@ -4,9 +4,9 @@ #include "field.h" void gfx_draw_line(struct gfx_context_t *ctxt, coordinates_t p0, coordinates_t p1, uint32_t color) { - int dx = abs(p1.column - p0.column); + int dx = abs((int)p1.column - (int)p0.column); int sx = p0.column < p1.column ? 1 : -1; - int dy = -abs(p1.row - p0.row); + int dy = -abs((int)p1.row - (int)p0.row); int sy = p0.row < p1.row ? 1 : -1; int error = dx + dy; @@ -50,7 +50,7 @@ void gfx_draw_circle(struct gfx_context_t *ctxt, coordinates c, uint32_t r, uint if(d >= 2*x){ d = d-2*x-1; x++; - }else if(d < 2 * (r-y)){ + }else if(d < 2 * ((int)r-y)){ d = d + 2*y-1; y--; }else { diff --git a/src/field.c b/src/field.c index 356c8db..ec6f1e2 100644 --- a/src/field.c +++ b/src/field.c @@ -1,5 +1,6 @@ #include <stdbool.h> #include <stdlib.h> +#include <time.h> #include "draw.h" #include "field.h" @@ -41,10 +42,10 @@ double compute_delta_x(){ } bool is_in_screen(coordinates_t pos){ - if(pos.column > WID || pos.column < 0) + if(pos.column > WID) return false; - if(pos.row > HEI || pos.row < 0) + if(pos.row > HEI) return false; return true; diff --git a/src/field.h b/src/field.h index 6266ea3..34dd513 100644 --- a/src/field.h +++ b/src/field.h @@ -18,17 +18,6 @@ bool compute_e(charge_t c, vec2 p, double eps, vec2 *e); // Return false if for some qiP, norm(qiP) < eps bool compute_total_normalized_e(charge_t *charges, int num_charges, vec2 p, double eps, vec2 *e); -// Compute and then draw all the points belonging to a field line, -// starting from pos0. -// Returns false if pos0 is not a valid position -// (for example if pos0 is too close to a charge). -static bool draw_field_line(struct gfx_context_t *ctxt, charge_t *charges, int num_charges, double dx, vec2 pos0, double x0, double x1, double y0, double y1); - -// Draw all the charges -// A circle with minus sign for negative charges -// A circle with a plus sign for positive charges -static void draw_charges(struct gfx_context_t *context, charge_t *charges, int num_charges, double x0, double x1, double y0, double y1); - void draw_everything( struct gfx_context_t *ctxt, charge_t *charges, -- GitLab