From: Christian Heller Date: Thu, 15 Aug 2013 15:32:36 +0000 (+0200) Subject: Use "uint8_t" instead of "unsigned char". X-Git-Tag: tce~1093 X-Git-Url: https://plomlompom.com/repos/balance?a=commitdiff_plain;h=6ba18516a602b3d4ad95981887ad9c5eb40a335a;p=plomrogue Use "uint8_t" instead of "unsigned char". --- diff --git a/src/main.c b/src/main.c index eaddfa6..24e0058 100644 --- a/src/main.c +++ b/src/main.c @@ -6,6 +6,7 @@ #include /* for initscr(), noecho(), curs_set(), keypad(), raw() */ #include /* for time() */ #include /* for getopt(), optarg */ +#include /* for uint8_t */ #include "windows.h" /* for structs WinMeta, Win, init_win(), init_win_meta(), * draw_all_wins() */ @@ -151,8 +152,8 @@ int main(int argc, char *argv[]) /* Replay mode. */ int key; - unsigned char quit_called = 0; - unsigned char await_actions = 1; + uint8_t quit_called = 0; + uint8_t await_actions = 1; if (0 == world.interactive) { int action; diff --git a/src/map_objects.c b/src/map_objects.c index a6f527d..6ed8c33 100644 --- a/src/map_objects.c +++ b/src/map_objects.c @@ -2,6 +2,7 @@ #include "map_objects.h" #include /* for malloc(), calloc(), free(), atoi() */ +#include /* for uint8_t */ #include /* for FILE typedef */ #include /* for strchr(), strlen(), memcpy() */ #include "readwrite.h" /* for [read/write]_uint[8/16/23][_bigendian]() */ @@ -209,9 +210,9 @@ extern uint8_t read_map_objects(struct World * world, void * start, FILE * file) extern void * build_map_objects(struct World * world, void * start, char def_id, - unsigned char n) + uint8_t n) { - unsigned char i; + uint8_t i; struct MapObj * mo; char first = 1; struct MapObjDef * mod = get_map_obj_def(world, def_id); diff --git a/src/map_objects.h b/src/map_objects.h index 7fcf1c7..0158648 100644 --- a/src/map_objects.h +++ b/src/map_objects.h @@ -10,6 +10,7 @@ #include /* for FILE typedef */ +#include /* for uint8_t */ #include "yx_uint16.h" /* for yx_uint16 coordinates */ struct World; @@ -19,7 +20,7 @@ struct World; struct Player { struct yx_uint16 pos; - unsigned char hitpoints; + uint8_t hitpoints; }; @@ -41,7 +42,7 @@ struct Item struct Monster { struct MapObj map_obj; - unsigned char hitpoints; + uint8_t hitpoints; }; @@ -67,7 +68,7 @@ struct ItemDef struct MonsterDef { struct MapObjDef map_obj_def; - unsigned char hitpoints_start; /* Hitpoints each monster starts with. */ + uint8_t hitpoints_start; /* Hitpoints each monster starts with. */ }; @@ -81,7 +82,7 @@ extern void init_map_object_defs(struct World * world, char * filename); * "def_id". */ extern void * build_map_objects(struct World * world, void * start, char def_id, - unsigned char n); + uint8_t n); diff --git a/src/misc.c b/src/misc.c index 082819f..cfa43ca 100644 --- a/src/misc.c +++ b/src/misc.c @@ -3,6 +3,7 @@ #include "misc.h" #include /* for calloc(), free() */ #include /* for strlen(), strcmp(), memcpy() */ +#include /* for uint8_t */ #include "windows.h" /* for suspend_win(), append_win(), reset_pad_offset(), * resize_active_win(), cycle_active_win(), * shift_active_win(), struct Win, struct WinMeta @@ -215,12 +216,10 @@ extern struct yx_uint16 find_passable_pos(struct Map * map) -extern unsigned char meta_keys(int key, struct World * world, - struct WinMeta * win_meta, - struct Win * win_keys, - struct Win * win_map, - struct Win * win_info, - struct Win * win_log) +extern uint8_t meta_keys(int key, struct World * world, + struct WinMeta * win_meta, struct Win * win_keys, + struct Win * win_map, struct Win * win_info, + struct Win * win_log) { if (key == get_action_key(world->keybindings, "quit")) { diff --git a/src/misc.h b/src/misc.h index 1c1a749..39efe6a 100644 --- a/src/misc.h +++ b/src/misc.h @@ -9,7 +9,7 @@ -#include /* for uint16_t, uint32_t */ +#include /* for uint8_t, uint16_t, uint32_t */ #include /* for FILE typedef */ #include "yx_uint16.h" /* for yx_uint16 coordinates */ struct World; @@ -85,11 +85,9 @@ extern struct yx_uint16 find_passable_pos(struct Map * map); /* Call some meta game / window management actions dependent on key. If the * "quit" action is called, return 1 only instead of doing anything directly. */ -extern unsigned char meta_keys(int key, struct World * world, - struct WinMeta * win_meta, - struct Win * win_keys, - struct Win * win_map, - struct Win * win_info, +extern uint8_t meta_keys(int key, struct World * world, + struct WinMeta * win_meta, struct Win * win_keys, + struct Win * win_map, struct Win * win_info, struct Win * win_log); diff --git a/src/readwrite.c b/src/readwrite.c index e776ec2..da5f73f 100644 --- a/src/readwrite.c +++ b/src/readwrite.c @@ -2,7 +2,7 @@ #include "readwrite.h" #include /* for FILE typedef*/ -#include /* for uint16_t, uint32_t */ +#include /* for uint8_t, uint16_t, uint32_t */ diff --git a/src/readwrite.h b/src/readwrite.h index 42a7c3a..cf4de14 100644 --- a/src/readwrite.h +++ b/src/readwrite.h @@ -10,7 +10,7 @@ #include /* for FILE typedef */ -#include /* for uint16_t, uint32_t */ +#include /* for uint8_t, uint16_t, uint32_t */ diff --git a/src/rexit.c b/src/rexit.c index b9da482..d718f19 100644 --- a/src/rexit.c +++ b/src/rexit.c @@ -3,6 +3,7 @@ #include "rexit.h" #include /* for exit(), free(), defines EXIT_SUCESS, EXIT_FAILURE */ #include /* for printf() */ +#include /* for uint8_t */ #include /* for endwin() */ #include "main.h" /* for World struct */ #include "map.h" /* for Map struct */ @@ -11,7 +12,7 @@ /* The clean-up routine and the flag resource by which it decides what to do. */ -static unsigned char cleanup_flags = 0x00; +static uint8_t cleanup_flags = 0x00; static void cleanup(struct World * world); @@ -59,7 +60,7 @@ extern void exit_game(struct World * world) -extern void exit_err(unsigned char err, struct World * world, char * msg) +extern void exit_err(uint8_t err, struct World * world, char * msg) { if (0 == err) { diff --git a/src/rexit.h b/src/rexit.h index e4c2eb5..f020485 100644 --- a/src/rexit.h +++ b/src/rexit.h @@ -9,6 +9,7 @@ +#include /* for uint8_t */ struct World; struct Map; @@ -38,7 +39,7 @@ extern void exit_game(struct World * world); * pass the result of functions that return non-zero as an error status and * thereby avoid bloating up the code with if-error-conditionals.) */ -extern void exit_err(unsigned char err, struct World * world, char * msg); +extern void exit_err(uint8_t err, struct World * world, char * msg);