aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2022-03-10 15:05:32 +0000
committerepoch <epoch@enzo.thebackupbox.net>2022-03-10 15:05:32 +0000
commit49d54d7582bdcbdcff5637e72e9f29bb5cc571bd (patch)
tree46548a61a1e6cf96e0155e58e797ab2c9e56a339
parent905e3c77725ecdc3a6658d69c9a2a73a0513b6ce (diff)
downloadhackvr-49d54d7582bdcbdcff5637e72e9f29bb5cc571bd.tar.gz
hackvr-49d54d7582bdcbdcff5637e72e9f29bb5cc571bd.zip
added a sanity check
-rw-r--r--src/graphics_c2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/graphics_c2.c b/src/graphics_c2.c
index c4c9193..571075a 100644
--- a/src/graphics_c2.c
+++ b/src/graphics_c2.c
@@ -1,4 +1,6 @@
#include "common.h"
+#include <stdlib.h> //free()
+#include <string.h> //strdup()
#include "math.h"
#include "graphics_cs.h"
#include "graphics_c3.h"
@@ -39,6 +41,15 @@ void draw_c2_shape(c2_s_t s) {
// if(cn_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline.
if(epoch_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline.
set_ansi_color(7);
+ if(!s.id || !global.active) printf("# ERROR. shape is midding id.\n");
+ else {
+ if(strcmp(s.id,global.active)) {//we need to update the moused-over
+// free(global.active);
+ global.active=strdup(s.id);
+ printf("%s active %s\n",global.user,global.active);
+// set_title(global.active);
+ }
+ }
if(gra_global.mousemap[MOUSE_PRIMARY]==1) {
printf("%s action %s\n",global.user,s.id);
gra_global.mousemap[MOUSE_PRIMARY]=0;