From: Christian Heller Date: Wed, 14 May 2014 02:49:12 +0000 (+0200) Subject: Unify Map struct common to server and client in src/common/map.h. X-Git-Tag: tce~746 X-Git-Url: https://plomlompom.com/repos/template?a=commitdiff_plain;h=7433f56ec2c6cc51bc497e3c0c67d2fe3e6ab64a;p=plomrogue Unify Map struct common to server and client in src/common/map.h. --- diff --git a/src/client/map.h b/src/client/map.h index d104c28..6cef27e 100644 --- a/src/client/map.h +++ b/src/client/map.h @@ -3,17 +3,8 @@ * Routines for the game map window. */ -#ifndef MAP_H -#define MAP_H - -#include "../common/yx_uint16.h" /* yx_uint16 struct */ - - -struct Map -{ - struct yx_uint16 size; /* map's height/width in number of cells */ - char * cells; /* sequence of bytes encoding map cells */ -}; +#ifndef MAP_H_CLIENT +#define MAP_H_CLIENT diff --git a/src/client/world.h b/src/client/world.h index 508d1af..8d490c8 100644 --- a/src/client/world.h +++ b/src/client/world.h @@ -9,7 +9,7 @@ #include /* uint8_t, uint16_t */ #include /* FILE */ #include /* time_t */ -#include "map.h" /* struct Map */ +#include "../common/map.h" /* struct Map */ #include "../common/yx_uint8.h" /* struct yx_uint8 */ #include "keybindings.h" /* stuct KeyBindingDB */ #include "command_db.h" /* struct CommandDB */ diff --git a/src/common/map.h b/src/common/map.h new file mode 100644 index 0000000..8d454ca --- /dev/null +++ b/src/common/map.h @@ -0,0 +1,20 @@ +/* src/common/map.h + * + * Game map. + */ + +#ifndef MAP_H +#define MAP_H + +#include "yx_uint16.h" /* yx_uint16 struct */ + + +struct Map +{ + struct yx_uint16 size; /* map's height/width in number of cells */ + char * cells; /* sequence of bytes encoding map cells */ +}; + + + +#endif diff --git a/src/server/map.c b/src/server/map.c index 52a9b0b..464f6e2 100644 --- a/src/server/map.c +++ b/src/server/map.c @@ -163,4 +163,3 @@ extern uint16_t yx_to_map_pos(struct yx_uint8 * yx) { return (yx->y * world.map.size.x) + yx->x; } - diff --git a/src/server/map.h b/src/server/map.h index 9e3c548..74bb71e 100644 --- a/src/server/map.h +++ b/src/server/map.h @@ -1,22 +1,13 @@ /* src/server/map.h * - * Struct for the game map and routines to create and navigate on it. + * Routines to create and navigate game map. */ -#ifndef MAP_H -#define MAP_H +#ifndef MAP_H_SERVER +#define MAP_H_SERVER #include /* uint8_t, uint16_t */ #include "../common/yx_uint8.h" /* yx_uint8 struct */ -#include "../common/yx_uint16.h" /* yx_uint16 struct */ - - - -struct Map -{ - struct yx_uint16 size; /* Map's height/width (use max. 256x256)! */ - char * cells; /* Sequence of bytes encoding map cells. */ -}; diff --git a/src/server/world.h b/src/server/world.h index be772fc..732c810 100644 --- a/src/server/world.h +++ b/src/server/world.h @@ -8,7 +8,7 @@ #include /* uint8_t, uint16_t, uint32_t */ #include /* define FILE */ -#include "map.h" /* struct Map */ +#include "../common/map.h" /* struct Map */ struct MapObjDef; struct MapObjAct; struct MapObj;