From 7074e7499a3e8dc17d2dee20e9e0642faf382ab3 Mon Sep 17 00:00:00 2001
From: veclavtalica <veclvatalica@poto.cafe>
Date: Thu, 30 Jan 2025 05:10:38 +0300
Subject: [PATCH] ugh?

---
 CMakeLists.txt           | 2 +-
 src/rendering/twn_draw.c | 4 ++--
 src/twn_filewatch.c      | 7 +++++++
 src/twn_timer.c          | 3 ++-
 src/twn_timer_c.h        | 2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30b79b6..78e7c57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -210,7 +210,7 @@ function(give_options_without_warnings target)
 
         target_compile_definitions(${target} PRIVATE
                                              $<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:TWN_FEATURE_DYNLIB_GAME>
-                                             $<$<BOOL:${LINUX}>:_GNU_SOURCE>)
+                                             _GNU_SOURCE)
 endfunction()
 
 
diff --git a/src/rendering/twn_draw.c b/src/rendering/twn_draw.c
index 3f528bb..2f06d3c 100644
--- a/src/rendering/twn_draw.c
+++ b/src/rendering/twn_draw.c
@@ -415,7 +415,7 @@ void render(void) {
 
 void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom) {
     bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
-    if (!orthographic && fov >= M_PIf)
+    if (!orthographic && fov >= (float)(M_PI))
         log_warn("Invalid fov given (%f)", (double)fov);
 
     Camera const camera = {
@@ -447,7 +447,7 @@ DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
                                                                   float zoom)
 {
     bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
-    if (!orthographic && fov >= M_PIf)
+    if (!orthographic && fov >= (float)(M_PI))
         log_warn("Invalid fov given (%f)", (double)fov);
 
     (void)roll;
diff --git a/src/twn_filewatch.c b/src/twn_filewatch.c
index e24490b..09a24ef 100644
--- a/src/twn_filewatch.c
+++ b/src/twn_filewatch.c
@@ -29,6 +29,8 @@ static void filewatch_callback(dmon_watch_id watch_id,
                                const char* oldfilepath,
                                void* user)
 {
+    (void)watch_id; (void)rootdir; (void)filepath; (void)oldfilepath;
+
     enum FilewatchAction faction;
 
     switch (action) {
@@ -41,6 +43,7 @@ static void filewatch_callback(dmon_watch_id watch_id,
     case DMON_ACTION_MODIFY:
         faction = FILEWATCH_ACTION_FILE_MODIFIED;
         break;
+    case DMON_ACTION_MOVE:
     default:
         return;
     }
@@ -74,6 +77,8 @@ bool filewatch_add_directory(char const *dir, FileatchCallback callback) {
     };
     arrpush(filewatch_directories, w);
     dmon_watch(dir, filewatch_callback, DMON_WATCHFLAGS_RECURSIVE, (void *)(intptr_t)(arrlen(filewatch_directories) - 1));
+
+    return true;
 }
 
 
@@ -91,6 +96,8 @@ bool filewatch_add_file(char const *filepath, FileatchCallback callback) {
     };
     arrpush(filewatch_files, f);
     dmon_watch("./", filewatch_callback, 0, (void *)(intptr_t)(-arrlen(filewatch_files)));
+
+    return true;
 }
 
 
diff --git a/src/twn_timer.c b/src/twn_timer.c
index 1e14312..ac3716e 100644
--- a/src/twn_timer.c
+++ b/src/twn_timer.c
@@ -2,6 +2,7 @@
 #include "twn_engine_context_c.h"
 
 #include <SDL2/SDL.h>
+#include <stdlib.h>
 
 static SDL_TimerID sanity_timer;
 
@@ -19,7 +20,7 @@ static uint32_t sanity_timer_handler(uint32_t interval, void *data) {
 
     /* TODO: figure out the most portable way to do it */
     /* TODO: different type of behavior is possible, especially for debugging */
-    quick_exit(EXIT_FAILURE);
+    exit(EXIT_FAILURE);
 }
 
 
diff --git a/src/twn_timer_c.h b/src/twn_timer_c.h
index 292a8ad..b0e96f7 100644
--- a/src/twn_timer_c.h
+++ b/src/twn_timer_c.h
@@ -2,7 +2,7 @@
 #define TWN_TIMER_H
 
 #include <stdbool.h>
-#include <stdbit.h>
+#include <stdint.h>
 
 bool start_sanity_timer(uint32_t milliseconds_to_expire);
 bool end_sanity_timer(void);