From: Christian Heller Date: Thu, 27 Jun 2013 01:07:53 +0000 (+0200) Subject: Sorted out library dependencies / includes. Include every header file needed by each... X-Git-Tag: tce~1189 X-Git-Url: https://plomlompom.com/repos/balance?a=commitdiff_plain;h=47d7b87570ce3c79d3e0a6b8e765c74d065b6ba5;p=plomrogue Sorted out library dependencies / includes. Include every header file needed by each file individually, don't assume any inherited includes. Use forward declarations where possible. --- diff --git a/src/actors.c b/src/actors.c index 288bb49..b70f279 100644 --- a/src/actors.c +++ b/src/actors.c @@ -1,8 +1,9 @@ -#include "stdlib.h" -#include "stdint.h" +#include "actors.h" +#include +#include +#include #include "yx_uint16.h" #include "roguelike.h" -#include "actors.h" extern char is_passable (struct Map * map, uint16_t y, uint16_t x) { // Check if coordinate on (or beyond) map is accessible to actor movement. diff --git a/src/actors.h b/src/actors.h index e82d1da..c97d91b 100644 --- a/src/actors.h +++ b/src/actors.h @@ -1,6 +1,12 @@ #ifndef ACTORS_H #define ACTORS_H +#include +#include "yx_uint16.h" + +struct World; +struct Map; + struct Player { struct yx_uint16 pos; }; diff --git a/src/draw_wins.c b/src/draw_wins.c index bcce0a4..0ec8d7a 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -1,9 +1,9 @@ +#include "draw_wins.h" #include #include -#include #include +#include #include "windows.h" -#include "draw_wins.h" #include "roguelike.h" #include "keybindings.h" #include "actors.h" diff --git a/src/draw_wins.h b/src/draw_wins.h index d3a8b9d..dea248a 100644 --- a/src/draw_wins.h +++ b/src/draw_wins.h @@ -1,6 +1,10 @@ #ifndef DRAW_WINS_H #define DRAW_WINS_H +#include + +struct Win; + void draw_with_linebreaks (struct Win *, char *, uint16_t); void draw_text_from_bottom (struct Win *, char *); void draw_log_win (struct Win *); diff --git a/src/keybindings.c b/src/keybindings.c index b6ff412..f9d1b8b 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1,10 +1,10 @@ -#include +#include "keybindings.h" #include +#include #include #include #include "windows.h" #include "roguelike.h" -#include "keybindings.h" void init_keybindings(struct World * world) { // Initialize keybindings from file "keybindings". diff --git a/src/keybindings.h b/src/keybindings.h index 85c33c7..ad8b3bb 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -1,4 +1,10 @@ #ifndef KEYBINDINGS_H +#define KEYBINDINGS_H + +#include + +struct World; +struct WinMeta; struct KeyBinding { char * name; diff --git a/src/readwrite.c b/src/readwrite.c index 9f089ea..34ec09b 100644 --- a/src/readwrite.c +++ b/src/readwrite.c @@ -1,6 +1,7 @@ +#include "readwrite.h" #include -#include #include +#include static const uint16_t uchar_s = UCHAR_MAX + 1; diff --git a/src/readwrite.h b/src/readwrite.h index 7fad4be..eeead6b 100644 --- a/src/readwrite.h +++ b/src/readwrite.h @@ -1,6 +1,9 @@ #ifndef READWRITE_H #define READWRITE_H +#include +#include + uint16_t read_uint16_bigendian(FILE * file); void write_uint16_bigendian(uint16_t x, FILE * file); uint32_t read_uint32_bigendian(FILE * file); diff --git a/src/roguelike.c b/src/roguelike.c index 021bfe7..7bcaf92 100644 --- a/src/roguelike.c +++ b/src/roguelike.c @@ -1,3 +1,4 @@ +#include "roguelike.h" #include #include #include @@ -6,7 +7,6 @@ #include #include "windows.h" #include "draw_wins.h" -#include "roguelike.h" #include "keybindings.h" #include "readwrite.h" #include "actors.h" diff --git a/src/roguelike.h b/src/roguelike.h index 7c54dc4..45e63b9 100644 --- a/src/roguelike.h +++ b/src/roguelike.h @@ -1,8 +1,13 @@ #ifndef ROGUELIKE_H #define ROGUELIKE_H +#include #include "yx_uint16.h" -#include "windows.h" + +struct WinMeta; +struct Win; +struct KeyBinding; +struct KeysWinData; struct World { char interactive; diff --git a/src/windows.c b/src/windows.c index 98c8cf8..6089781 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,8 +1,8 @@ -#include +#include "windows.h" #include #include +#include #include -#include "windows.h" struct Corners { struct yx_uint16 tl; diff --git a/src/windows.h b/src/windows.h index e52f93b..9391233 100644 --- a/src/windows.h +++ b/src/windows.h @@ -1,7 +1,8 @@ #ifndef WINDOWS_H #define WINDOWS_H -#include "ncurses.h" +#include +#include #include "yx_uint16.h" struct Frame { diff --git a/src/yx_uint16.c b/src/yx_uint16.c index 0d607cb..55c832b 100644 --- a/src/yx_uint16.c +++ b/src/yx_uint16.c @@ -1,4 +1,3 @@ -#include "stdint.h" #include "yx_uint16.h" extern char yx_uint16_cmp (struct yx_uint16 a, struct yx_uint16 b) { diff --git a/src/yx_uint16.h b/src/yx_uint16.h index 70fc39d..c697879 100644 --- a/src/yx_uint16.h +++ b/src/yx_uint16.h @@ -1,6 +1,8 @@ #ifndef YX_UINT16_H #define YX_UINT16_H +#include + #define NORTH 1 #define EAST 2 #define SOUTH 3