#ifndef ROGUEDEFS_H
#define ROGUEDEFS_H

#include "SDL2/SDL_rect.h"

//
// commonly reused typedefs and macros
//

// bitmask of the four cardinal directions
// would be an enum, but C++ typechecking doesn't like that, so this results in more readable code overall
typedef unsigned short Directions;
#define NORTH 0x1u
#define EAST (0x1u << 1)
#define SOUTH (0x1u << 2)
#define WEST (0x1u << 3)

// simple shorthand for wrapping limiting a number by wrapping
// useful for generating random numbers within a range
#define WRAP(M_x, M_min, M_max) (((M_x - M_min) % (M_max - M_min)) + M_min)

// typedefs that help with differentiating between chunk coordinates and tile coordinates
typedef SDL_Point Tile;
typedef SDL_Point Chunk;
// represents a sprite index
typedef unsigned Sprite;

// define a comparison function for SDL_Point to make code slightly more readable
static inline bool operator==(SDL_Point const &lhs, SDL_Point const &rhs) {
	return lhs.x == rhs.x && lhs.y == rhs.y;
}

#endif // !ROGUEDEFS_H
