mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
Merge exp/fixed-width: 64-bit only builds, fixed-width navmesh headers
This commit is contained in:
@@ -9,6 +9,11 @@ if("${CMAKE_SOURCE_DIR}" MATCHES " ")
|
||||
message(FATAL_ERROR "The server cannot build in the path (" ${CMAKE_SOURCE_DIR} ") because it contains a space. Please move the server to a path without spaces.")
|
||||
endif()
|
||||
|
||||
# Only 64-bit builds are supported: sent and stored values assume 64-bit pointers and sizes
|
||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(FATAL_ERROR "The server only builds for 64-bit targets (this configuration is ${CMAKE_SIZEOF_VOID_P}-byte pointers). Use a 64-bit compiler and generator, e.g. -A x64 with Visual Studio.")
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
@@ -326,6 +326,8 @@ CREATE DATABASE darkflame;
|
||||
```
|
||||
|
||||
## Build the server
|
||||
The server only builds for 64-bit targets; CMake refuses to configure a 32-bit build.
|
||||
|
||||
You can either run `build.sh` when in the root folder of the repository:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -237,23 +237,6 @@ bool GeneralUtils::ReplaceInString(std::string& str, const std::string_view from
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> GeneralUtils::SplitString(const std::wstring_view str, const wchar_t delimiter) {
|
||||
std::vector<std::wstring> vector = std::vector<std::wstring>();
|
||||
std::wstring current;
|
||||
|
||||
for (const wchar_t c : str) {
|
||||
if (c == delimiter) {
|
||||
vector.push_back(current);
|
||||
current = L"";
|
||||
} else {
|
||||
current += c;
|
||||
}
|
||||
}
|
||||
|
||||
vector.push_back(std::move(current));
|
||||
return vector;
|
||||
}
|
||||
|
||||
std::vector<std::u16string> GeneralUtils::SplitString(const std::u16string_view str, const char16_t delimiter) {
|
||||
std::vector<std::u16string> vector = std::vector<std::u16string>();
|
||||
std::u16string current;
|
||||
|
||||
@@ -145,8 +145,6 @@ namespace GeneralUtils {
|
||||
|
||||
std::u16string ReadWString(RakNet::BitStream& inStream);
|
||||
|
||||
std::vector<std::wstring> SplitString(const std::wstring_view str, const wchar_t delimiter);
|
||||
|
||||
std::vector<std::u16string> SplitString(const std::u16string_view str, const char16_t delimiter);
|
||||
|
||||
std::vector<std::string> SplitString(const std::string_view str, const char delimiter);
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#pragma warning (disable:4251) //Disables SQL warnings
|
||||
|
||||
static_assert(sizeof(void*) == 8, "The server only builds for 64-bit targets");
|
||||
|
||||
// These are the same define, but they mean two different things in different contexts
|
||||
// so a different define to distinguish what calculation is happening will help clarity.
|
||||
#define FRAMES_TO_MS(x) (1000 / (x))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Recast.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourNavMesh.h"
|
||||
@@ -9,17 +11,22 @@
|
||||
static const int NAVMESHSET_MAGIC = 'M' << 24 | 'S' << 16 | 'E' << 8 | 'T'; // char[4] of 'MSET'
|
||||
static const int NAVMESHSET_VERSION = 1;
|
||||
|
||||
// Read straight from the .bin navmesh files
|
||||
struct NavMeshSetHeader {
|
||||
int magic;
|
||||
int version;
|
||||
int numTiles;
|
||||
int32_t magic;
|
||||
int32_t version;
|
||||
int32_t numTiles;
|
||||
dtNavMeshParams params;
|
||||
};
|
||||
|
||||
struct NavMeshTileHeader {
|
||||
dtTileRef tileRef;
|
||||
int dataSize;
|
||||
int32_t dataSize;
|
||||
};
|
||||
|
||||
// The layout the files were always read with on 64-bit builds
|
||||
static_assert(sizeof(NavMeshSetHeader) == 12 + sizeof(dtNavMeshParams));
|
||||
static_assert(sizeof(NavMeshTileHeader) == (sizeof(dtTileRef) == 8 ? 16 : 8));
|
||||
|
||||
static const int MAX_POLYS = 256;
|
||||
static const int MAX_SMOOTH = 2048;
|
||||
|
||||
Reference in New Issue
Block a user