Remove math library and merge gametypes and mathtypes
This commit is contained in:
parent
d9b9f3d7dd
commit
3342300324
4 changed files with 27 additions and 33 deletions
|
@ -1,28 +0,0 @@
|
||||||
#ifndef _BASETYPES_H_
|
|
||||||
#define _BASETYPES_H_
|
|
||||||
|
|
||||||
#include <limits> // std::numeric_limits
|
|
||||||
|
|
||||||
#include "stdlib.h" // for size_t
|
|
||||||
|
|
||||||
template<class T, size_t N>
|
|
||||||
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<coord_t>::max();
|
|
||||||
static const ucoord_t ucoord_invalid = std::numeric_limits<ucoord_t>::max();
|
|
||||||
|
|
||||||
// Direction representation
|
|
||||||
enum class dir_c : char
|
|
||||||
{
|
|
||||||
N = 'N',
|
|
||||||
S = 'S',
|
|
||||||
E = 'E',
|
|
||||||
W = 'W'
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //_BASETYPES_H_
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _GAME_TYPES_H_
|
#define _GAME_TYPES_H_
|
||||||
|
|
||||||
#include <limits> // std::numeric_limits
|
#include <limits> // std::numeric_limits
|
||||||
|
#include "stdlib.h" // for size_t
|
||||||
|
|
||||||
#define GAME_POS_FORMATTER "[%u,%u]"
|
#define GAME_POS_FORMATTER "[%u,%u]"
|
||||||
|
|
||||||
|
@ -20,11 +21,32 @@ enum class player_t : char
|
||||||
NUM_INVALID
|
NUM_INVALID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Type for unit IDs
|
||||||
typedef unsigned short unit_id_t; // Type for unit IDs
|
typedef unsigned short unit_id_t;
|
||||||
typedef char unitvis_c; // Typedef for unit visual representations
|
|
||||||
|
|
||||||
static const unit_id_t unit_id_invalid = std::numeric_limits<unit_id_t>::max();
|
static const unit_id_t unit_id_invalid = std::numeric_limits<unit_id_t>::max();
|
||||||
static const unitvis_c unitvis_invalid = std::numeric_limits<unitvis_c>::max();
|
|
||||||
|
// Typedef for unit visual representations
|
||||||
|
typedef char unitvis_c;
|
||||||
|
static const unitvis_c unitvis_invalid = std::numeric_limits<unitvis_c>::max();
|
||||||
|
|
||||||
|
// Coordinate types
|
||||||
|
typedef short coord_t;
|
||||||
|
static const coord_t coord_invalid = std::numeric_limits<coord_t>::max();
|
||||||
|
|
||||||
|
typedef unsigned short ucoord_t;
|
||||||
|
static const ucoord_t ucoord_invalid = std::numeric_limits<ucoord_t>::max();
|
||||||
|
|
||||||
|
// Direction representation
|
||||||
|
enum class dir_c : char
|
||||||
|
{
|
||||||
|
N = 'N',
|
||||||
|
S = 'S',
|
||||||
|
E = 'E',
|
||||||
|
W = 'W'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function for count of an array
|
||||||
|
template<class T, size_t N>
|
||||||
|
constexpr size_t _countof(T (&)[N]) { return N; }
|
||||||
|
|
||||||
#endif //_GAME_TYPES_H_
|
#endif //_GAME_TYPES_H_
|
Loading…
Add table
Add a link
Reference in a new issue