From a5dd54fbf8b6768423c48786b6a2afaf9a8ece0e Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 13 Dec 2021 15:00:32 +0800 Subject: *misc --- .../Ragdolls/Ragdolls/Ragdolls.vcxproj | 20 ++- .../Ragdolls/Ragdolls/Ragdolls.vcxproj.filters | 69 +++++++++ Client/Source/Filesystem/Filesystem.cpp | 0 Client/Source/Filesystem/Filesystem.h | 4 + Client/Source/Local/LocalPlayer.cpp | 0 Client/Source/Local/LocalPlayer.h | 0 Client/Source/Network/Socket.h | 2 + Client/Source/Network/http.cpp | 0 Client/Source/Network/http.h | 1 + Client/Source/Physics/raycast.cpp | 0 Client/Source/Physics/raycast.h | 0 Client/Source/Remote/RemotePlayer.cpp | 0 Client/Source/Remote/RemotePlayer.h | 0 Client/Source/Serialization/serialization.cpp | 0 Client/Source/Serialization/serialization.h | 0 Client/Source/Threading/Event.cpp | 0 Client/Source/Threading/Event.h | 0 Client/Source/Utilities/Optional.h | 105 ++++++++++++++ Client/Source/Utilities/base64.cpp | 154 +++++++++++++++++++++ Client/Source/Utilities/base64.h | 26 ++++ Client/Source/Utilities/hex.h | 60 ++++++++ Client/Source/metadata.cpp | 115 +++++++++++++++ Client/Source/metadata.h | 63 +++++++++ .../\350\256\276\350\256\241.xlsx" | Bin 8446389 -> 8448214 bytes .../RagdollServer/.vs/RagdollServer/v15/.suo | Bin 0 -> 25600 bytes .../.vs/RagdollServer/v15/Browse.VC.db | Bin 0 -> 266240 bytes Server/Project/RagdollServer/RagdollServer.sln | 31 +++++ .../RagdollServer/RagdollServer.vcxproj | 122 ++++++++++++++++ .../RagdollServer/RagdollServer.vcxproj.filters | 2 + .../RagdollServer/RagdollServer.vcxproj.user | 4 + 30 files changed, 776 insertions(+), 2 deletions(-) create mode 100644 Client/Source/Filesystem/Filesystem.cpp create mode 100644 Client/Source/Filesystem/Filesystem.h create mode 100644 Client/Source/Local/LocalPlayer.cpp create mode 100644 Client/Source/Local/LocalPlayer.h create mode 100644 Client/Source/Network/http.cpp create mode 100644 Client/Source/Network/http.h create mode 100644 Client/Source/Physics/raycast.cpp create mode 100644 Client/Source/Physics/raycast.h create mode 100644 Client/Source/Remote/RemotePlayer.cpp create mode 100644 Client/Source/Remote/RemotePlayer.h create mode 100644 Client/Source/Serialization/serialization.cpp create mode 100644 Client/Source/Serialization/serialization.h create mode 100644 Client/Source/Threading/Event.cpp create mode 100644 Client/Source/Threading/Event.h create mode 100644 Client/Source/Utilities/Optional.h create mode 100644 Client/Source/Utilities/base64.cpp create mode 100644 Client/Source/Utilities/base64.h create mode 100644 Client/Source/Utilities/hex.h create mode 100644 Client/Source/metadata.cpp create mode 100644 Client/Source/metadata.h create mode 100644 Server/Project/RagdollServer/.vs/RagdollServer/v15/.suo create mode 100644 Server/Project/RagdollServer/.vs/RagdollServer/v15/Browse.VC.db create mode 100644 Server/Project/RagdollServer/RagdollServer.sln create mode 100644 Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj create mode 100644 Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.filters create mode 100644 Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.user diff --git a/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj b/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj index 27506d4..d3a9c40 100644 --- a/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj +++ b/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj @@ -81,7 +81,7 @@ Disabled true true - $(SolutionDir)..\..\..\ThirdParty;$(SolutionDir)..\..\..\ThirdParty\imgui;$(SolutionDir)..\..\..\ThirdParty\SDL2\include;$(SolutionDir)..\..\..\ThirdParty\freetype\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\..\..\ThirdParty;$(SolutionDir)..\..\..\ThirdParty\imgui;$(SolutionDir)..\..\..\ThirdParty\SDL2\include;$(SolutionDir)..\..\..\ThirdParty\freetype\include;$(SolutionDir)..\..\..\Source;%(AdditionalIncludeDirectories) RAGDOLL_WIN;_CRT_SECURE_NO_WARNINGS;RAGDOLL_DEBUG;%(PreprocessorDefinitions) @@ -122,7 +122,7 @@ true true true - $(SolutionDir)..\..\..\ThirdParty;$(SolutionDir)..\..\..\ThirdParty\imgui;$(SolutionDir)..\..\..\ThirdParty\SDL2\include;$(SolutionDir)..\..\..\ThirdParty\freetype\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\..\..\ThirdParty;$(SolutionDir)..\..\..\ThirdParty\imgui;$(SolutionDir)..\..\..\ThirdParty\SDL2\include;$(SolutionDir)..\..\..\ThirdParty\freetype\include;$(SolutionDir)..\..\..\Source;%(AdditionalIncludeDirectories) RAGDOLL_WIN;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) @@ -136,6 +136,7 @@ + @@ -165,22 +166,29 @@ + + + + + + + @@ -195,6 +203,7 @@ + @@ -228,6 +237,7 @@ + @@ -238,12 +248,17 @@ + + + + + @@ -251,6 +266,7 @@ + diff --git a/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj.filters b/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj.filters index 63eb02b..6e0768e 100644 --- a/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj.filters +++ b/Client/Project/VisualStudio/Ragdolls/Ragdolls/Ragdolls.vcxproj.filters @@ -43,6 +43,27 @@ {c6dc4916-d04c-45ae-9cd9-868a55f979d3} + + {993ff0e4-3779-4143-8987-8051dcd6dbed} + + + {a816541a-4fc2-4d86-968f-44a498544d43} + + + {983e3658-5991-4175-98be-ef907edc5199} + + + {3410850d-bd0b-4b53-92fd-bdf3da189756} + + + {1fef6e26-4cb1-424d-933c-a343d3a4e691} + + + {ce78bf9b-da4d-4dd9-ae65-cdc8d48f975d} + + + {d614da35-9a6a-4edb-9c2f-55517c089a2b} + @@ -214,6 +235,30 @@ Utilities + + Filesystem + + + Network + + + Physics + + + Remote + + + Serialization + + + Threading + + + Utilities + + + Local + @@ -447,5 +492,29 @@ Utilities + + Filesystem + + + Network + + + Physics + + + Remote + + + Serialization + + + Threading + + + Utilities + + + Local + \ No newline at end of file diff --git a/Client/Source/Filesystem/Filesystem.cpp b/Client/Source/Filesystem/Filesystem.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Filesystem/Filesystem.h b/Client/Source/Filesystem/Filesystem.h new file mode 100644 index 0000000..5919022 --- /dev/null +++ b/Client/Source/Filesystem/Filesystem.h @@ -0,0 +1,4 @@ +#pragma once + + + diff --git a/Client/Source/Local/LocalPlayer.cpp b/Client/Source/Local/LocalPlayer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Local/LocalPlayer.h b/Client/Source/Local/LocalPlayer.h new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Network/Socket.h b/Client/Source/Network/Socket.h index e69de29..3749a34 100644 --- a/Client/Source/Network/Socket.h +++ b/Client/Source/Network/Socket.h @@ -0,0 +1,2 @@ + +// UDP socket \ No newline at end of file diff --git a/Client/Source/Network/http.cpp b/Client/Source/Network/http.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Network/http.h b/Client/Source/Network/http.h new file mode 100644 index 0000000..50e9667 --- /dev/null +++ b/Client/Source/Network/http.h @@ -0,0 +1 @@ +#pragma once diff --git a/Client/Source/Physics/raycast.cpp b/Client/Source/Physics/raycast.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Physics/raycast.h b/Client/Source/Physics/raycast.h new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Remote/RemotePlayer.cpp b/Client/Source/Remote/RemotePlayer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Remote/RemotePlayer.h b/Client/Source/Remote/RemotePlayer.h new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Serialization/serialization.cpp b/Client/Source/Serialization/serialization.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Serialization/serialization.h b/Client/Source/Serialization/serialization.h new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Threading/Event.cpp b/Client/Source/Threading/Event.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Threading/Event.h b/Client/Source/Threading/Event.h new file mode 100644 index 0000000..e69de29 diff --git a/Client/Source/Utilities/Optional.h b/Client/Source/Utilities/Optional.h new file mode 100644 index 0000000..eda7fff --- /dev/null +++ b/Client/Source/Utilities/Optional.h @@ -0,0 +1,105 @@ +/* +Minetest +Copyright (C) 2021 rubenwardy + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include +#include "debug.h" + +struct nullopt_t +{ +}; +constexpr nullopt_t nullopt{}; + +/** + * An implementation of optional for C++11, which aims to be + * compatible with a subset of std::optional features. + * + * Unfortunately, Minetest doesn't use C++17 yet. + * + * @tparam T The type to be stored + */ +template +class Optional +{ + bool m_has_value = false; + T m_value; + +public: + Optional() noexcept {} + Optional(nullopt_t) noexcept {} + + Optional(const T &value) noexcept : m_has_value(true), m_value(value) {} + Optional(T &&value) noexcept : m_has_value(true), m_value(std::move(value)) {} + + Optional(const Optional &other) noexcept : + m_has_value(other.m_has_value), m_value(other.m_value) + {} + Optional(Optional &&other) noexcept : + m_has_value(other.m_has_value), m_value(std::move(other.m_value)) + { + other.m_has_value = false; + } + + Optional &operator=(nullopt_t) noexcept { m_has_value = false; return *this; } + + Optional &operator=(const Optional &other) noexcept + { + if (&other == this) + return *this; + m_has_value = other.m_has_value; + m_value = other.m_value; + return *this; + } + + Optional &operator=(Optional &&other) noexcept + { + if (&other == this) + return *this; + m_has_value = other.m_has_value; + m_value = std::move(other.m_value); + other.m_has_value = false; + return *this; + } + + T &value() + { + FATAL_ERROR_IF(!m_has_value, "optional doesn't have value"); + return m_value; + } + + const T &value() const + { + FATAL_ERROR_IF(!m_has_value, "optional doesn't have value"); + return m_value; + } + + const T &value_or(const T &def) const { return m_has_value ? m_value : def; } + + // Unchecked access consistent with std::optional + T* operator->() { return &m_value; } + const T* operator->() const { return &m_value; } + + T& operator*() { return m_value; } + const T& operator*() const { return m_value; } + + bool has_value() const noexcept { return m_has_value; } + + explicit operator bool() const { return m_has_value; } +}; diff --git a/Client/Source/Utilities/base64.cpp b/Client/Source/Utilities/base64.cpp new file mode 100644 index 0000000..0c24552 --- /dev/null +++ b/Client/Source/Utilities/base64.cpp @@ -0,0 +1,154 @@ +/* +base64.cpp and base64.h + +Copyright (C) 2004-2008 René Nyffenegger + +This source code is provided 'as-is', without any express or implied +warranty. In no event will the author be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + +3. This notice may not be removed or altered from any source distribution. + +René Nyffenegger rene.nyffenegger@adp-gmbh.ch + +*/ + +#include "base64.h" +#include + +static const std::string base64_chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + +static const std::string base64_chars_padding_1 = "AEIMQUYcgkosw048"; +static const std::string base64_chars_padding_2 = "AQgw"; + +static inline bool is_base64(unsigned char c) +{ + return (c >= '0' && c <= '9') + || (c >= 'A' && c <= 'Z') + || (c >= 'a' && c <= 'z') + || c == '+' || c == '/'; +} + +bool base64_is_valid(std::string const& s) +{ + size_t i = 0; + for (; i < s.size(); ++i) + if (!is_base64(s[i])) + break; + unsigned char padding = 3 - ((i + 3) % 4); + if ((padding == 1 && base64_chars_padding_1.find(s[i - 1]) == std::string::npos) + || (padding == 2 && base64_chars_padding_2.find(s[i - 1]) == std::string::npos) + || padding == 3) + return false; + int actual_padding = s.size() - i; + // omission of padding characters is allowed + if (actual_padding == 0) + return true; + + // remaining characters (max. 2) may only be padding + for (; i < s.size(); ++i) + if (s[i] != '=') + return false; + // number of padding characters needs to match + return padding == actual_padding; +} + +std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { + std::string ret; + int i = 0; + int j = 0; + unsigned char char_array_3[3]; + unsigned char char_array_4[4]; + + while (in_len--) { + char_array_3[i++] = *(bytes_to_encode++); + if (i == 3) { + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for(i = 0; (i <4) ; i++) + ret += base64_chars[char_array_4[i]]; + i = 0; + } + } + + if (i) + { + for(j = i; j < 3; j++) + char_array_3[j] = '\0'; + + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for (j = 0; (j < i + 1); j++) + ret += base64_chars[char_array_4[j]]; + + // Don't pad it with = + /*while((i++ < 3)) + ret += '=';*/ + + } + + return ret; + +} + +std::string base64_decode(std::string const& encoded_string) { + int in_len = encoded_string.size(); + int i = 0; + int j = 0; + int in_ = 0; + unsigned char char_array_4[4], char_array_3[3]; + std::string ret; + + while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { + char_array_4[i++] = encoded_string[in_]; in_++; + if (i ==4) { + for (i = 0; i <4; i++) + char_array_4[i] = base64_chars.find(char_array_4[i]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; (i < 3); i++) + ret += char_array_3[i]; + i = 0; + } + } + + if (i) { + for (j = i; j <4; j++) + char_array_4[j] = 0; + + for (j = 0; j <4; j++) + char_array_4[j] = base64_chars.find(char_array_4[j]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (j = 0; (j < i - 1); j++) ret += char_array_3[j]; + } + + return ret; +} diff --git a/Client/Source/Utilities/base64.h b/Client/Source/Utilities/base64.h new file mode 100644 index 0000000..7f2bf13 --- /dev/null +++ b/Client/Source/Utilities/base64.h @@ -0,0 +1,26 @@ +/* +Minetest +Copyright (C) 2013-2017 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include + +bool base64_is_valid(std::string const& s); +std::string base64_encode(unsigned char const* , unsigned int len); +std::string base64_decode(std::string const& s); diff --git a/Client/Source/Utilities/hex.h b/Client/Source/Utilities/hex.h new file mode 100644 index 0000000..708f330 --- /dev/null +++ b/Client/Source/Utilities/hex.h @@ -0,0 +1,60 @@ +/* +Minetest +Copyright (C) 2013 Jonathan Neuschäfer + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include + +static const char hex_chars[] = "0123456789abcdef"; + +static inline std::string hex_encode(const char *data, unsigned int data_size) +{ + std::string ret; + ret.reserve(data_size * 2); + + char buf2[3]; + buf2[2] = '\0'; + + for (unsigned int i = 0; i < data_size; i++) { + unsigned char c = (unsigned char)data[i]; + buf2[0] = hex_chars[(c & 0xf0) >> 4]; + buf2[1] = hex_chars[c & 0x0f]; + ret.append(buf2); + } + + return ret; +} + +static inline std::string hex_encode(const std::string &data) +{ + return hex_encode(data.c_str(), data.size()); +} + +static inline bool hex_digit_decode(char hexdigit, unsigned char &value) +{ + if (hexdigit >= '0' && hexdigit <= '9') + value = hexdigit - '0'; + else if (hexdigit >= 'A' && hexdigit <= 'F') + value = hexdigit - 'A' + 10; + else if (hexdigit >= 'a' && hexdigit <= 'f') + value = hexdigit - 'a' + 10; + else + return false; + return true; +} diff --git a/Client/Source/metadata.cpp b/Client/Source/metadata.cpp new file mode 100644 index 0000000..453ac1c --- /dev/null +++ b/Client/Source/metadata.cpp @@ -0,0 +1,115 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "metadata.h" +#include "log.h" + +/* + Metadata +*/ + +void Metadata::clear() +{ + m_stringvars.clear(); + m_modified = true; +} + +bool Metadata::empty() const +{ + return m_stringvars.empty(); +} + +size_t Metadata::size() const +{ + return m_stringvars.size(); +} + +bool Metadata::contains(const std::string &name) const +{ + return m_stringvars.find(name) != m_stringvars.end(); +} + +bool Metadata::operator==(const Metadata &other) const +{ + if (size() != other.size()) + return false; + + for (const auto &sv : m_stringvars) { + if (!other.contains(sv.first) || other.getString(sv.first) != sv.second) + return false; + } + + return true; +} + +const std::string &Metadata::getString(const std::string &name, u16 recursion) const +{ + StringMap::const_iterator it = m_stringvars.find(name); + if (it == m_stringvars.end()) { + static const std::string empty_string = std::string(""); + return empty_string; + } + + return resolveString(it->second, recursion); +} + +bool Metadata::getStringToRef( + const std::string &name, std::string &str, u16 recursion) const +{ + StringMap::const_iterator it = m_stringvars.find(name); + if (it == m_stringvars.end()) { + return false; + } + + str = resolveString(it->second, recursion); + return true; +} + +/** + * Sets var to name key in the metadata storage + * + * @param name + * @param var + * @return true if key-value pair is created or changed + */ +bool Metadata::setString(const std::string &name, const std::string &var) +{ + if (var.empty()) { + m_stringvars.erase(name); + return true; + } + + StringMap::iterator it = m_stringvars.find(name); + if (it != m_stringvars.end() && it->second == var) { + return false; + } + + m_stringvars[name] = var; + m_modified = true; + return true; +} + +const std::string &Metadata::resolveString(const std::string &str, u16 recursion) const +{ + if (recursion <= 1 && str.substr(0, 2) == "${" && str[str.length() - 1] == '}') { + return getString(str.substr(2, str.length() - 3), recursion + 1); + } + + return str; +} diff --git a/Client/Source/metadata.h b/Client/Source/metadata.h new file mode 100644 index 0000000..5333f8a --- /dev/null +++ b/Client/Source/metadata.h @@ -0,0 +1,63 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include "irr_v3d.h" +#include +#include +#include "util/string.h" + +class Metadata +{ + bool m_modified = false; +public: + virtual ~Metadata() = default; + + virtual void clear(); + virtual bool empty() const; + + bool operator==(const Metadata &other) const; + inline bool operator!=(const Metadata &other) const + { + return !(*this == other); + } + + // + // Key-value related + // + + size_t size() const; + bool contains(const std::string &name) const; + const std::string &getString(const std::string &name, u16 recursion = 0) const; + bool getStringToRef(const std::string &name, std::string &str, u16 recursion = 0) const; + virtual bool setString(const std::string &name, const std::string &var); + inline bool removeString(const std::string &name) { return setString(name, ""); } + const StringMap &getStrings() const + { + return m_stringvars; + } + // Add support for variable names in values + const std::string &resolveString(const std::string &str, u16 recursion = 0) const; + + inline bool isModified() const { return m_modified; } + inline void setModified(bool v) { m_modified = v; } +protected: + StringMap m_stringvars; +}; diff --git "a/Documents/\350\256\276\350\256\241/\350\256\276\350\256\241.xlsx" "b/Documents/\350\256\276\350\256\241/\350\256\276\350\256\241.xlsx" index 1a76cea..269b802 100644 Binary files "a/Documents/\350\256\276\350\256\241/\350\256\276\350\256\241.xlsx" and "b/Documents/\350\256\276\350\256\241/\350\256\276\350\256\241.xlsx" differ diff --git a/Server/Project/RagdollServer/.vs/RagdollServer/v15/.suo b/Server/Project/RagdollServer/.vs/RagdollServer/v15/.suo new file mode 100644 index 0000000..8fb755f Binary files /dev/null and b/Server/Project/RagdollServer/.vs/RagdollServer/v15/.suo differ diff --git a/Server/Project/RagdollServer/.vs/RagdollServer/v15/Browse.VC.db b/Server/Project/RagdollServer/.vs/RagdollServer/v15/Browse.VC.db new file mode 100644 index 0000000..74057cd Binary files /dev/null and b/Server/Project/RagdollServer/.vs/RagdollServer/v15/Browse.VC.db differ diff --git a/Server/Project/RagdollServer/RagdollServer.sln b/Server/Project/RagdollServer/RagdollServer.sln new file mode 100644 index 0000000..f1ab946 --- /dev/null +++ b/Server/Project/RagdollServer/RagdollServer.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.902 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RagdollServer", "RagdollServer\RagdollServer.vcxproj", "{8BC61D58-41D9-43F2-9B52-A97F5AF992C6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Debug|x64.ActiveCfg = Debug|x64 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Debug|x64.Build.0 = Debug|x64 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Debug|x86.ActiveCfg = Debug|Win32 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Debug|x86.Build.0 = Debug|Win32 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Release|x64.ActiveCfg = Release|x64 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Release|x64.Build.0 = Release|x64 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Release|x86.ActiveCfg = Release|Win32 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FCB3BA56-98AE-4D1D-B599-F7A1F1E9CF24} + EndGlobalSection +EndGlobal diff --git a/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj new file mode 100644 index 0000000..c13234c --- /dev/null +++ b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj @@ -0,0 +1,122 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {8BC61D58-41D9-43F2-9B52-A97F5AF992C6} + RagdollServer + 10.0.17763.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + + + + + Level3 + Disabled + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + + + + \ No newline at end of file diff --git a/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.filters b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.filters new file mode 100644 index 0000000..ef1ebf5 --- /dev/null +++ b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.filters @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.user b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.user new file mode 100644 index 0000000..6e2aec7 --- /dev/null +++ b/Server/Project/RagdollServer/RagdollServer/RagdollServer.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file -- cgit v1.1-26-g67d0