libclod
C library for interacting with NBTs, region files, LOD data and other things.
Loading...
Searching...
No Matches
region_impl.h
1
#ifndef CLOD_REGION_IMPL_H
2
#define CLOD_REGION_IMPL_H
3
4
#include <
clod/region.h
>
5
#include "platform/platform.h"
6
7
#include <assert.h>
8
#include <stdint.h>
9
#include <string.h>
10
#include <time.h>
11
12
struct
clod_region
{
13
struct
clod_region_opts
opts;
14
15
atomic int32_t inside;
16
mutex mtx;
17
dir d;
18
19
size_t
cache_len;
20
struct
file_cache
*cache;
21
};
22
23
enum
clod_region_result
file_cache_destroy(
struct
clod_region
*r);
24
25
#define REGION_PUBLIC_ENTER(region) do {\
26
assert((region) != nullptr);\
27
const int32_t inside = ++(region)->inside;\
28
assert(inside > 0);\
29
} while (0)
30
31
#define REGION_PUBLIC_LEAVE(region) do {\
32
const int32_t inside = (region)->inside--;\
33
assert(inside > 0);\
34
} while(0)
35
36
static
bool
is_vanilla_compatible(
struct
clod_region_opts
*opts) {
37
return
38
opts->
dims
== 2 &&
39
memcmp(opts->
prefix
,
"region"
, strlen(
"region"
)) == 0 &&
40
(
41
memcmp(opts->
region_ext
,
"mca"
, strlen(
"mca"
)) == 0 ||
42
memcmp(opts->
region_ext
,
"mcr"
, strlen(
"mcr"
)) == 0
43
);
44
}
45
46
#endif
clod_region_result
clod_region_result
Definition
region.h:43
region.h
clod_region_opts
Definition
region.h:168
clod_region_opts::dims
uint8_t dims
Definition
region.h:173
clod_region_opts::region_ext
char region_ext[10+1]
Definition
region.h:203
clod_region_opts::prefix
char prefix[30+1]
Definition
region.h:199
clod_region
Definition
region_impl.h:12
file_cache
Definition
file_cache.c:15
src
region
region_impl.h
Generated by
1.16.1