mirror of
https://github.com/minetest/minetest.git
synced 2024-09-20 07:20:46 +03:00
Move some more sources to shared target
This commit is contained in:
parent
16fef8f479
commit
0a8eb2c71c
@ -391,7 +391,10 @@ add_subdirectory(server)
|
|||||||
# a compiler error and you need to instead add it to client_SRCS or common_SRCS.
|
# a compiler error and you need to instead add it to client_SRCS or common_SRCS.
|
||||||
set(independent_SRCS
|
set(independent_SRCS
|
||||||
chat.cpp
|
chat.cpp
|
||||||
|
content_nodemeta.cpp
|
||||||
convert_json.cpp
|
convert_json.cpp
|
||||||
|
craftdef.cpp
|
||||||
|
debug.cpp
|
||||||
face_position_cache.cpp
|
face_position_cache.cpp
|
||||||
httpfetch.cpp
|
httpfetch.cpp
|
||||||
hud.cpp
|
hud.cpp
|
||||||
@ -410,11 +413,17 @@ set(independent_SRCS
|
|||||||
particles.cpp
|
particles.cpp
|
||||||
profiler.cpp
|
profiler.cpp
|
||||||
serialization.cpp
|
serialization.cpp
|
||||||
|
settings.cpp
|
||||||
staticobject.cpp
|
staticobject.cpp
|
||||||
terminal_chat_console.cpp
|
terminal_chat_console.cpp
|
||||||
texture_override.cpp
|
texture_override.cpp
|
||||||
tileanimation.cpp
|
tileanimation.cpp
|
||||||
|
tool.cpp
|
||||||
|
${common_network_SRCS}
|
||||||
|
${content_SRCS}
|
||||||
|
${database_SRCS}
|
||||||
${threading_SRCS}
|
${threading_SRCS}
|
||||||
|
${util_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# /!\ Consider carefully before adding files here /!\
|
# /!\ Consider carefully before adding files here /!\
|
||||||
@ -422,9 +431,6 @@ set(common_SRCS
|
|||||||
clientdynamicinfo.cpp
|
clientdynamicinfo.cpp
|
||||||
collision.cpp
|
collision.cpp
|
||||||
content_mapnode.cpp
|
content_mapnode.cpp
|
||||||
content_nodemeta.cpp
|
|
||||||
craftdef.cpp
|
|
||||||
debug.cpp
|
|
||||||
defaultsettings.cpp
|
defaultsettings.cpp
|
||||||
emerge.cpp
|
emerge.cpp
|
||||||
environment.cpp
|
environment.cpp
|
||||||
@ -450,19 +456,14 @@ set(common_SRCS
|
|||||||
server.cpp
|
server.cpp
|
||||||
serverenvironment.cpp
|
serverenvironment.cpp
|
||||||
servermap.cpp
|
servermap.cpp
|
||||||
settings.cpp
|
|
||||||
tool.cpp
|
|
||||||
translation.cpp
|
translation.cpp
|
||||||
version.cpp
|
version.cpp
|
||||||
voxel.cpp
|
voxel.cpp
|
||||||
voxelalgorithms.cpp
|
voxelalgorithms.cpp
|
||||||
${common_network_SRCS}
|
|
||||||
${common_SCRIPT_SRCS}
|
${common_SCRIPT_SRCS}
|
||||||
${common_server_SRCS}
|
${common_server_SRCS}
|
||||||
${content_SRCS}
|
|
||||||
${database_SRCS}
|
|
||||||
${mapgen_SRCS}
|
${mapgen_SRCS}
|
||||||
${UTIL_SRCS}
|
${server_network_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
@ -586,6 +587,9 @@ add_library(EngineCommon OBJECT
|
|||||||
${independent_SRCS}
|
${independent_SRCS}
|
||||||
)
|
)
|
||||||
add_dependencies(EngineCommon GenerateVersion)
|
add_dependencies(EngineCommon GenerateVersion)
|
||||||
|
target_link_libraries(EngineCommon
|
||||||
|
sha256
|
||||||
|
)
|
||||||
get_target_property(
|
get_target_property(
|
||||||
IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
|
IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
target_include_directories(EngineCommon PRIVATE ${IRRLICHT_INCLUDES})
|
target_include_directories(EngineCommon PRIVATE ${IRRLICHT_INCLUDES})
|
||||||
|
@ -28,10 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "map_settings_manager.h"
|
#include "map_settings_manager.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
#if CHECK_CLIENT_BUILD()
|
|
||||||
#include "client/texturepaths.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The maximum number of identical world names allowed
|
// The maximum number of identical world names allowed
|
||||||
#define MAX_WORLD_NAMES 100
|
#define MAX_WORLD_NAMES 100
|
||||||
|
|
||||||
@ -96,8 +92,7 @@ std::string getSubgamePathEnv()
|
|||||||
|
|
||||||
static SubgameSpec getSubgameSpec(const std::string &game_id,
|
static SubgameSpec getSubgameSpec(const std::string &game_id,
|
||||||
const std::string &game_path,
|
const std::string &game_path,
|
||||||
const std::unordered_map<std::string, std::string> &mods_paths,
|
const std::unordered_map<std::string, std::string> &mods_paths)
|
||||||
const std::string &menuicon_path)
|
|
||||||
{
|
{
|
||||||
const auto gamemods_path = game_path + DIR_DELIM + "mods";
|
const auto gamemods_path = game_path + DIR_DELIM + "mods";
|
||||||
// Get meta
|
// Get meta
|
||||||
@ -130,7 +125,7 @@ static SubgameSpec getSubgameSpec(const std::string &game_id,
|
|||||||
last_mod = conf.get("last_mod");
|
last_mod = conf.get("last_mod");
|
||||||
|
|
||||||
SubgameSpec spec(game_id, game_path, gamemods_path, mods_paths, game_title,
|
SubgameSpec spec(game_id, game_path, gamemods_path, mods_paths, game_title,
|
||||||
menuicon_path, game_author, game_release, first_mod, last_mod);
|
game_author, game_release, first_mod, last_mod);
|
||||||
|
|
||||||
if (conf.exists("name") && !conf.exists("title"))
|
if (conf.exists("name") && !conf.exists("title"))
|
||||||
spec.deprecation_msgs.push_back("\"name\" setting in game.conf is deprecated, please use \"title\" instead");
|
spec.deprecation_msgs.push_back("\"name\" setting in game.conf is deprecated, please use \"title\" instead");
|
||||||
@ -191,13 +186,7 @@ SubgameSpec findSubgame(const std::string &id)
|
|||||||
mods_paths[fs::AbsolutePath(mod_path)] = mod_path;
|
mods_paths[fs::AbsolutePath(mod_path)] = mod_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string menuicon_path;
|
return getSubgameSpec(id, game_path, mods_paths);
|
||||||
#if CHECK_CLIENT_BUILD()
|
|
||||||
menuicon_path = getImagePath(
|
|
||||||
game_path + DIR_DELIM + "menu" + DIR_DELIM + "icon.png");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return getSubgameSpec(id, game_path, mods_paths, menuicon_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubgameSpec findWorldSubgame(const std::string &world_path)
|
SubgameSpec findWorldSubgame(const std::string &world_path)
|
||||||
@ -206,7 +195,7 @@ SubgameSpec findWorldSubgame(const std::string &world_path)
|
|||||||
// See if world contains an embedded game; if so, use it.
|
// See if world contains an embedded game; if so, use it.
|
||||||
std::string world_gamepath = world_path + DIR_DELIM + "game";
|
std::string world_gamepath = world_path + DIR_DELIM + "game";
|
||||||
if (fs::PathExists(world_gamepath))
|
if (fs::PathExists(world_gamepath))
|
||||||
return getSubgameSpec(world_gameid, world_gamepath, {}, "");
|
return getSubgameSpec(world_gameid, world_gamepath, {});
|
||||||
return findSubgame(world_gameid);
|
return findSubgame(world_gameid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ struct SubgameSpec
|
|||||||
* Map from virtual path to mods path
|
* Map from virtual path to mods path
|
||||||
*/
|
*/
|
||||||
std::unordered_map<std::string, std::string> addon_mods_paths;
|
std::unordered_map<std::string, std::string> addon_mods_paths;
|
||||||
std::string menuicon_path;
|
|
||||||
|
|
||||||
// For logging purposes
|
// For logging purposes
|
||||||
std::vector<const char *> deprecation_msgs;
|
std::vector<const char *> deprecation_msgs;
|
||||||
@ -50,7 +49,6 @@ struct SubgameSpec
|
|||||||
const std::string &gamemods_path = "",
|
const std::string &gamemods_path = "",
|
||||||
const std::unordered_map<std::string, std::string> &addon_mods_paths = {},
|
const std::unordered_map<std::string, std::string> &addon_mods_paths = {},
|
||||||
const std::string &title = "",
|
const std::string &title = "",
|
||||||
const std::string &menuicon_path = "",
|
|
||||||
const std::string &author = "", int release = 0,
|
const std::string &author = "", int release = 0,
|
||||||
const std::string &first_mod = "",
|
const std::string &first_mod = "",
|
||||||
const std::string &last_mod = "") :
|
const std::string &last_mod = "") :
|
||||||
@ -60,8 +58,7 @@ struct SubgameSpec
|
|||||||
last_mod(last_mod),
|
last_mod(last_mod),
|
||||||
path(path),
|
path(path),
|
||||||
gamemods_path(gamemods_path),
|
gamemods_path(gamemods_path),
|
||||||
addon_mods_paths(addon_mods_paths),
|
addon_mods_paths(addon_mods_paths)
|
||||||
menuicon_path(menuicon_path)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,13 @@ set(common_network_SRCS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/mtp/impl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mtp/impl.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mtp/threads.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mtp/threads.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/networkpacket.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/networkpacket.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/socket.cpp
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(server_network_SRCS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/serveropcodes.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/serveropcodes.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/serverpackethandler.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/serverpackethandler.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/socket.cpp
|
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
|
||||||
bool is_valid_player_name(std::string_view name) {
|
bool is_valid_player_name(std::string_view name)
|
||||||
|
{
|
||||||
return !name.empty() && name.size() <= PLAYERNAME_SIZE && string_allowed(name, PLAYERNAME_ALLOWED_CHARS);
|
return !name.empty() && name.size() <= PLAYERNAME_SIZE && string_allowed(name, PLAYERNAME_ALLOWED_CHARS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,8 +174,6 @@ u16 Player::getMaxHotbarItemcount()
|
|||||||
return mainlist ? std::min(mainlist->getSize(), (u32) hud_hotbar_itemcount) : 0;
|
return mainlist ? std::min(mainlist->getSize(), (u32) hud_hotbar_itemcount) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CHECK_CLIENT_BUILD()
|
|
||||||
|
|
||||||
u32 PlayerControl::getKeysPressed() const
|
u32 PlayerControl::getKeysPressed() const
|
||||||
{
|
{
|
||||||
u32 keypress_bits =
|
u32 keypress_bits =
|
||||||
@ -218,7 +217,6 @@ u32 PlayerControl::getKeysPressed() const
|
|||||||
return keypress_bits;
|
return keypress_bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void PlayerControl::unpackKeysPressed(u32 keypress_bits)
|
void PlayerControl::unpackKeysPressed(u32 keypress_bits)
|
||||||
{
|
{
|
||||||
|
@ -86,11 +86,9 @@ struct PlayerControl
|
|||||||
movement_direction = a_movement_direction;
|
movement_direction = a_movement_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CHECK_CLIENT_BUILD()
|
|
||||||
// For client use
|
// For client use
|
||||||
u32 getKeysPressed() const;
|
u32 getKeysPressed() const;
|
||||||
inline bool isMoving() const { return movement_speed > 0.001f; }
|
inline bool isMoving() const { return movement_speed > 0.001f; }
|
||||||
#endif
|
|
||||||
|
|
||||||
// For server use
|
// For server use
|
||||||
void unpackKeysPressed(u32 keypress_bits);
|
void unpackKeysPressed(u32 keypress_bits);
|
||||||
|
@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "clientdynamicinfo.h"
|
#include "clientdynamicinfo.h"
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
#include "client/renderingengine.h"
|
#include "client/renderingengine.h"
|
||||||
|
#include "client/texturepaths.h"
|
||||||
#include "network/networkprotocol.h"
|
#include "network/networkprotocol.h"
|
||||||
#include "content/mod_configuration.h"
|
#include "content/mod_configuration.h"
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
@ -329,8 +330,9 @@ int ModApiMainMenu::l_get_games(lua_State *L)
|
|||||||
lua_pushinteger(L, game.release);
|
lua_pushinteger(L, game.release);
|
||||||
lua_settable(L, top_lvl2);
|
lua_settable(L, top_lvl2);
|
||||||
|
|
||||||
|
auto menuicon = getImagePath(game.path + DIR_DELIM "menu" DIR_DELIM "icon.png");
|
||||||
lua_pushstring(L, "menuicon_path");
|
lua_pushstring(L, "menuicon_path");
|
||||||
lua_pushstring(L, game.menuicon_path.c_str());
|
lua_pushstring(L, menuicon.c_str());
|
||||||
lua_settable(L, top_lvl2);
|
lua_settable(L, top_lvl2);
|
||||||
|
|
||||||
lua_pushstring(L, "addon_mods_paths");
|
lua_pushstring(L, "addon_mods_paths");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set(UTIL_SRCS
|
set(util_SRCS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/areastore.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/areastore.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/auth.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/auth.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/colorize.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/colorize.cpp
|
||||||
|
@ -856,16 +856,6 @@ std::wstring translate_string(std::wstring_view s, Translations *translations)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate string client side
|
|
||||||
std::wstring translate_string(std::wstring_view s)
|
|
||||||
{
|
|
||||||
#if !CHECK_CLIENT_BUILD()
|
|
||||||
return translate_string(s, nullptr);
|
|
||||||
#else
|
|
||||||
return translate_string(s, g_client_translations);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static const std::array<std::wstring_view, 30> disallowed_dir_names = {
|
static const std::array<std::wstring_view, 30> disallowed_dir_names = {
|
||||||
// Problematic filenames from here:
|
// Problematic filenames from here:
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names
|
||||||
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "config.h" // IS_CLIENT_BUILD
|
#include "config.h" // IS_CLIENT_BUILD
|
||||||
#if IS_CLIENT_BUILD
|
#if IS_CLIENT_BUILD
|
||||||
#include "irrString.h"
|
#include "irrString.h"
|
||||||
|
#include "translation.h"
|
||||||
#endif
|
#endif
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -634,9 +635,17 @@ std::vector<std::basic_string<T> > split(const std::basic_string<T> &s, T delim)
|
|||||||
|
|
||||||
std::wstring translate_string(std::wstring_view s, Translations *translations);
|
std::wstring translate_string(std::wstring_view s, Translations *translations);
|
||||||
|
|
||||||
std::wstring translate_string(std::wstring_view s);
|
inline std::wstring translate_string(std::wstring_view s)
|
||||||
|
{
|
||||||
|
#if IS_CLIENT_BUILD
|
||||||
|
return translate_string(s, g_client_translations);
|
||||||
|
#else
|
||||||
|
return translate_string(s, nullptr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline std::wstring unescape_translate(std::wstring_view s) {
|
inline std::wstring unescape_translate(std::wstring_view s)
|
||||||
|
{
|
||||||
return unescape_enriched(translate_string(s));
|
return unescape_enriched(translate_string(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user