RecastLayers: set RC_MAX_LAYERS and RC_MAX_NEIS as optional defines (#624)

It makes possible for a project integrating Recast to set custom values
via CXXFLAGS while remaining build system agnostic.

Type checking is kept.
This commit is contained in:
Thomas Debesse 2023-04-14 23:02:00 +02:00 committed by GitHub
parent cc944f28c1
commit 5c494ad1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,21 @@
// Must be 255 or smaller (not 256) because layer IDs are stored as
// a byte where 255 is a special value.
static const int RC_MAX_LAYERS = 63;
static const int RC_MAX_NEIS = 16;
#ifndef RC_MAX_LAYERS_DEF
#define RC_MAX_LAYERS_DEF 63
#endif
#if RC_MAX_LAYERS_DEF > 255
#error RC_MAX_LAYERS_DEF must be 255 or smaller
#endif
#ifndef RC_MAX_NEIS_DEF
#define RC_MAX_NEIS_DEF 16
#endif
// Keep type checking.
static const int RC_MAX_LAYERS = RC_MAX_LAYERS_DEF;
static const int RC_MAX_NEIS = RC_MAX_NEIS_DEF;
struct rcLayerRegion
{