From 3342300324f1a4a67b59cd5da6615693740cb697 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Tue, 30 Dec 2014 13:24:20 +0000 Subject: [PATCH] Remove math library and merge gametypes and mathtypes --- source/maths/mathtypes.h | 28 -------------------------- source/ttrts/gametypes.h | 32 +++++++++++++++++++++++++----- source/{maths => ttrts}/vector2.h | 0 source/{client => ttrts}/version.h | 0 4 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 source/maths/mathtypes.h rename source/{maths => ttrts}/vector2.h (100%) rename source/{client => ttrts}/version.h (100%) diff --git a/source/maths/mathtypes.h b/source/maths/mathtypes.h deleted file mode 100644 index d987e25..0000000 --- a/source/maths/mathtypes.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _BASETYPES_H_ -#define _BASETYPES_H_ - -#include // std::numeric_limits - -#include "stdlib.h" // for size_t - -template -constexpr size_t _countof(T (&)[N]) { return N; } - -// Coordinate types -typedef short coord_t; -typedef unsigned short ucoord_t; - -// Invalid values -static const coord_t coord_invalid = std::numeric_limits::max(); -static const ucoord_t ucoord_invalid = std::numeric_limits::max(); - -// Direction representation -enum class dir_c : char -{ - N = 'N', - S = 'S', - E = 'E', - W = 'W' -}; - -#endif //_BASETYPES_H_ diff --git a/source/ttrts/gametypes.h b/source/ttrts/gametypes.h index e86ebf3..d37591b 100644 --- a/source/ttrts/gametypes.h +++ b/source/ttrts/gametypes.h @@ -2,6 +2,7 @@ #define _GAME_TYPES_H_ #include // std::numeric_limits +#include "stdlib.h" // for size_t #define GAME_POS_FORMATTER "[%u,%u]" @@ -20,11 +21,32 @@ enum class player_t : char NUM_INVALID }; - -typedef unsigned short unit_id_t; // Type for unit IDs -typedef char unitvis_c; // Typedef for unit visual representations - +// Type for unit IDs +typedef unsigned short unit_id_t; static const unit_id_t unit_id_invalid = std::numeric_limits::max(); -static const unitvis_c unitvis_invalid = std::numeric_limits::max(); + +// Typedef for unit visual representations +typedef char unitvis_c; +static const unitvis_c unitvis_invalid = std::numeric_limits::max(); + +// Coordinate types +typedef short coord_t; +static const coord_t coord_invalid = std::numeric_limits::max(); + +typedef unsigned short ucoord_t; +static const ucoord_t ucoord_invalid = std::numeric_limits::max(); + +// Direction representation +enum class dir_c : char +{ + N = 'N', + S = 'S', + E = 'E', + W = 'W' +}; + +// Helper function for count of an array +template +constexpr size_t _countof(T (&)[N]) { return N; } #endif //_GAME_TYPES_H_ \ No newline at end of file diff --git a/source/maths/vector2.h b/source/ttrts/vector2.h similarity index 100% rename from source/maths/vector2.h rename to source/ttrts/vector2.h diff --git a/source/client/version.h b/source/ttrts/version.h similarity index 100% rename from source/client/version.h rename to source/ttrts/version.h