Skip to content

Commit 9a3d814

Browse files
committed
Added NetFields (A new way to replicate data across the network)
Added Dependency (Recastnavigation)
1 parent 0ebcdcb commit 9a3d814

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+20319
-15
lines changed

Dependencies/Dependencies.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ local dependencies =
3131
"rtree/rtree.lua",
3232
"libsodium/libsodium.lua",
3333
"spake2-ee/spake2-ee.lua",
34+
"recastnavigation/recastnavigation.lua"
3435
}
3536

3637
for k,v in pairs(dependencies) do
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// Copyright (c) 2009-2010 Mikko Mononen [email protected]
3+
//
4+
// This software is provided 'as-is', without any express or implied
5+
// warranty. In no event will the authors be held liable for any damages
6+
// arising from the use of this software.
7+
// Permission is granted to anyone to use this software for any purpose,
8+
// including commercial applications, and to alter it and redistribute it
9+
// freely, subject to the following restrictions:
10+
// 1. The origin of this software must not be misrepresented; you must not
11+
// claim that you wrote the original software. If you use this software
12+
// in a product, an acknowledgment in the product documentation would be
13+
// appreciated but is not required.
14+
// 2. Altered source versions must be plainly marked as such, and must not be
15+
// misrepresented as being the original software.
16+
// 3. This notice may not be removed or altered from any source distribution.
17+
//
18+
19+
#include <stdlib.h>
20+
#include "DetourAlloc.h"
21+
22+
static void *dtAllocDefault(size_t size, dtAllocHint)
23+
{
24+
return malloc(size);
25+
}
26+
27+
static void dtFreeDefault(void *ptr)
28+
{
29+
free(ptr);
30+
}
31+
32+
static dtAllocFunc* sAllocFunc = dtAllocDefault;
33+
static dtFreeFunc* sFreeFunc = dtFreeDefault;
34+
35+
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc)
36+
{
37+
sAllocFunc = allocFunc ? allocFunc : dtAllocDefault;
38+
sFreeFunc = freeFunc ? freeFunc : dtFreeDefault;
39+
}
40+
41+
void* dtAlloc(size_t size, dtAllocHint hint)
42+
{
43+
return sAllocFunc(size, hint);
44+
}
45+
46+
void dtFree(void* ptr)
47+
{
48+
if (ptr)
49+
sFreeFunc(ptr);
50+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// Copyright (c) 2009-2010 Mikko Mononen [email protected]
3+
//
4+
// This software is provided 'as-is', without any express or implied
5+
// warranty. In no event will the authors be held liable for any damages
6+
// arising from the use of this software.
7+
// Permission is granted to anyone to use this software for any purpose,
8+
// including commercial applications, and to alter it and redistribute it
9+
// freely, subject to the following restrictions:
10+
// 1. The origin of this software must not be misrepresented; you must not
11+
// claim that you wrote the original software. If you use this software
12+
// in a product, an acknowledgment in the product documentation would be
13+
// appreciated but is not required.
14+
// 2. Altered source versions must be plainly marked as such, and must not be
15+
// misrepresented as being the original software.
16+
// 3. This notice may not be removed or altered from any source distribution.
17+
//
18+
19+
#ifndef DETOURALLOCATOR_H
20+
#define DETOURALLOCATOR_H
21+
22+
#include <stddef.h>
23+
24+
/// Provides hint values to the memory allocator on how long the
25+
/// memory is expected to be used.
26+
enum dtAllocHint
27+
{
28+
DT_ALLOC_PERM, ///< Memory persist after a function call.
29+
DT_ALLOC_TEMP ///< Memory used temporarily within a function.
30+
};
31+
32+
/// A memory allocation function.
33+
// @param[in] size The size, in bytes of memory, to allocate.
34+
// @param[in] rcAllocHint A hint to the allocator on how long the memory is expected to be in use.
35+
// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
36+
/// @see dtAllocSetCustom
37+
typedef void* (dtAllocFunc)(size_t size, dtAllocHint hint);
38+
39+
/// A memory deallocation function.
40+
/// @param[in] ptr A pointer to a memory block previously allocated using #dtAllocFunc.
41+
/// @see dtAllocSetCustom
42+
typedef void (dtFreeFunc)(void* ptr);
43+
44+
/// Sets the base custom allocation functions to be used by Detour.
45+
/// @param[in] allocFunc The memory allocation function to be used by #dtAlloc
46+
/// @param[in] freeFunc The memory de-allocation function to be used by #dtFree
47+
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc);
48+
49+
/// Allocates a memory block.
50+
/// @param[in] size The size, in bytes of memory, to allocate.
51+
/// @param[in] hint A hint to the allocator on how long the memory is expected to be in use.
52+
/// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
53+
/// @see dtFree
54+
void* dtAlloc(size_t size, dtAllocHint hint);
55+
56+
/// Deallocates a memory block.
57+
/// @param[in] ptr A pointer to a memory block previously allocated using #dtAlloc.
58+
/// @see dtAlloc
59+
void dtFree(void* ptr);
60+
61+
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// Copyright (c) 2009-2010 Mikko Mononen [email protected]
3+
//
4+
// This software is provided 'as-is', without any express or implied
5+
// warranty. In no event will the authors be held liable for any damages
6+
// arising from the use of this software.
7+
// Permission is granted to anyone to use this software for any purpose,
8+
// including commercial applications, and to alter it and redistribute it
9+
// freely, subject to the following restrictions:
10+
// 1. The origin of this software must not be misrepresented; you must not
11+
// claim that you wrote the original software. If you use this software
12+
// in a product, an acknowledgment in the product documentation would be
13+
// appreciated but is not required.
14+
// 2. Altered source versions must be plainly marked as such, and must not be
15+
// misrepresented as being the original software.
16+
// 3. This notice may not be removed or altered from any source distribution.
17+
//
18+
19+
#include "DetourAssert.h"
20+
21+
#ifndef RC_DISABLE_ASSERTS
22+
23+
static dtAssertFailFunc* sAssertFailFunc = 0;
24+
25+
void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc)
26+
{
27+
sAssertFailFunc = assertFailFunc;
28+
}
29+
30+
dtAssertFailFunc* dtAssertFailGetCustom()
31+
{
32+
return sAssertFailFunc;
33+
}
34+
35+
#endif
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// Copyright (c) 2009-2010 Mikko Mononen [email protected]
3+
//
4+
// This software is provided 'as-is', without any express or implied
5+
// warranty. In no event will the authors be held liable for any damages
6+
// arising from the use of this software.
7+
// Permission is granted to anyone to use this software for any purpose,
8+
// including commercial applications, and to alter it and redistribute it
9+
// freely, subject to the following restrictions:
10+
// 1. The origin of this software must not be misrepresented; you must not
11+
// claim that you wrote the original software. If you use this software
12+
// in a product, an acknowledgment in the product documentation would be
13+
// appreciated but is not required.
14+
// 2. Altered source versions must be plainly marked as such, and must not be
15+
// misrepresented as being the original software.
16+
// 3. This notice may not be removed or altered from any source distribution.
17+
//
18+
19+
#ifndef DETOURASSERT_H
20+
#define DETOURASSERT_H
21+
22+
// Note: This header file's only purpose is to include define assert.
23+
// Feel free to change the file and include your own implementation instead.
24+
25+
#ifdef RC_DISABLE_ASSERTS
26+
27+
// From https://web.archive.org/web/20210117002833/http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
28+
# define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
29+
30+
#else
31+
32+
/// An assertion failure function.
33+
// @param[in] expression asserted expression.
34+
// @param[in] file Filename of the failed assertion.
35+
// @param[in] line Line number of the failed assertion.
36+
/// @see dtAssertFailSetCustom
37+
typedef void (dtAssertFailFunc)(const char* expression, const char* file, int line);
38+
39+
/// Sets the base custom assertion failure function to be used by Detour.
40+
/// @param[in] assertFailFunc The function to be invoked in case of failure of #dtAssert
41+
void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc);
42+
43+
/// Gets the base custom assertion failure function to be used by Detour.
44+
dtAssertFailFunc* dtAssertFailGetCustom();
45+
46+
# include <assert.h>
47+
# define dtAssert(expression) \
48+
{ \
49+
dtAssertFailFunc* failFunc = dtAssertFailGetCustom(); \
50+
if(failFunc == NULL) { assert(expression); } \
51+
else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \
52+
}
53+
54+
#endif
55+
56+
#endif // DETOURASSERT_H

0 commit comments

Comments
 (0)