|
5 | 5 | #include "mc/world/level/BlockPos.h" |
6 | 6 |
|
7 | 7 | #include <string> |
8 | | -#include <vector> |
9 | 8 |
|
10 | 9 | class IntVec4 { |
11 | 10 | public: |
12 | 11 | int x, y, z; |
13 | 12 | int dim; |
14 | 13 |
|
15 | | - inline BlockPos getBlockPos() { return {x, y, z}; } |
| 14 | + [[nodiscard]] inline BlockPos getBlockPos() const { return {x, y, z}; } |
16 | 15 |
|
17 | | - inline int getDimensionId() { return dim; } |
| 16 | + [[nodiscard]] inline int getDimensionId() const { return dim; } |
18 | 17 | }; |
19 | 18 |
|
20 | 19 | class FloatVec4 { |
21 | 20 | public: |
22 | 21 | float x, y, z; |
23 | 22 | int dim; |
24 | 23 |
|
25 | | - inline Vec3 getVec3() { return {x, y, z}; } |
| 24 | + [[nodiscard]] inline Vec3 getVec3() const { return {x, y, z}; } |
26 | 25 |
|
27 | | - inline int getDimensionId() { return dim; } |
| 26 | + [[nodiscard]] inline int getDimensionId() const { return dim; } |
28 | 27 |
|
29 | 28 | inline IntVec4 toIntVec4() { |
30 | 29 | auto px = (int)x; |
@@ -61,35 +60,35 @@ inline std::string DimId2Name(int dimid) { |
61 | 60 | // 全局变量 |
62 | 61 | extern bool isCmdRegisterEnabled; |
63 | 62 |
|
64 | | -#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS) |
| 63 | +#if defined(LSE_BACKEND_QUICKJS) |
65 | 64 | // QuickJs |
66 | | -constexpr std::string LLSE_BACKEND_TYPE = "Js"; |
| 65 | +inline constexpr std::string LLSE_BACKEND_TYPE = "Js"; |
67 | 66 |
|
68 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_LUA) |
| 67 | +#elif defined(LSE_BACKEND_LUA) |
69 | 68 | // Lua |
70 | | -constexpr std::string LLSE_BACKEND_TYPE = "Lua"; |
| 69 | +inline constexpr std::string LLSE_BACKEND_TYPE = "Lua"; |
71 | 70 |
|
72 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS) |
| 71 | +#elif defined(LSE_BACKEND_NODEJS) |
73 | 72 | // NodeJs |
74 | | -const std::string LLSE_BACKEND_TYPE = "NodeJs"; |
| 73 | +inline constexpr std::string LLSE_BACKEND_TYPE = "NodeJs"; |
75 | 74 |
|
76 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON) |
| 75 | +#elif defined(LSE_BACKEND_PYTHON) |
77 | 76 | // Python |
78 | | -const std::string LLSE_BACKEND_TYPE = "Python"; |
| 77 | +inline constexpr std::string LLSE_BACKEND_TYPE = "Python"; |
79 | 78 | #endif |
80 | 79 |
|
81 | 80 | // Debug engine information |
82 | | -#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS) |
83 | | -constexpr std::string LLSE_DEBUG_CMD = "nodejsdebug"; |
84 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS) |
85 | | -constexpr std::string LLSE_DEBUG_CMD = "jsdebug"; |
86 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_LUA) |
87 | | -constexpr std::string LLSE_DEBUG_CMD = "luadebug"; |
88 | | -#elif defined(LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON) |
89 | | -constexpr std::string LLSE_DEBUG_CMD = "pydebug"; |
| 81 | +#if defined(LSE_BACKEND_NODEJS) |
| 82 | +inline constexpr std::string LLSE_DEBUG_CMD = "nodejsdebug"; |
| 83 | +#elif defined(LSE_BACKEND_QUICKJS) |
| 84 | +inline constexpr std::string LLSE_DEBUG_CMD = "jsdebug"; |
| 85 | +#elif defined(LSE_BACKEND_LUA) |
| 86 | +inline constexpr std::string LLSE_DEBUG_CMD = "luadebug"; |
| 87 | +#elif defined(LSE_BACKEND_PYTHON) |
| 88 | +inline constexpr std::string LLSE_DEBUG_CMD = "pydebug"; |
90 | 89 | #endif |
91 | 90 |
|
92 | | -constexpr wchar_t LLSE_GLOBAL_DATA_NAME[] = L"LLSE_GLOBAL_DATA_SECTION"; |
93 | | -constexpr unsigned long LLSE_MESSAGE_SYSTEM_WAIT_CHECK_INTERVAL = 5; |
94 | | -constexpr size_t LLSE_POOL_THREAD_COUNT = 4; |
95 | | -constexpr int LLSE_VALID_BACKENDS_COUNT = 4; |
| 91 | +inline constexpr wchar_t LLSE_GLOBAL_DATA_NAME[] = L"LLSE_GLOBAL_DATA_SECTION"; |
| 92 | +inline constexpr unsigned long LLSE_MESSAGE_SYSTEM_WAIT_CHECK_INTERVAL = 5; |
| 93 | +inline constexpr size_t LLSE_POOL_THREAD_COUNT = 4; |
| 94 | +inline constexpr int LLSE_VALID_BACKENDS_COUNT = 4; |
0 commit comments