mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-04 17:25:30 +01:00
Break include chains and tidy (#16640)
Co-authored-by: cx384 <cx384@proton.me>
This commit is contained in:
@@ -2,58 +2,66 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "client.h"
|
||||
|
||||
#include "chatmessage.h"
|
||||
#include "client/clientevent.h"
|
||||
#include "clientdynamicinfo.h"
|
||||
#include "client/fontengine.h"
|
||||
#include "client/localplayer.h"
|
||||
#include "clientmap.h"
|
||||
#include "clientmedia.h"
|
||||
#include "client/mesh_generator_thread.h"
|
||||
#include "client/particles.h"
|
||||
#include "client/renderingengine.h"
|
||||
#include "client/sound.h"
|
||||
#include "client/texturepaths.h"
|
||||
#include "client/texturesource.h"
|
||||
#include "filesys.h"
|
||||
#include "game.h"
|
||||
#include "gettext.h"
|
||||
#include "gettime.h"
|
||||
#include "guiscalingfilter.h"
|
||||
#include "item_visuals_manager.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapblock_mesh.h"
|
||||
#include "mapnode.h"
|
||||
#include "mapsector.h"
|
||||
#include "minimap.h"
|
||||
#include "profiler.h"
|
||||
#include "shader.h"
|
||||
#include "translation.h"
|
||||
#include "util/auth.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/srp.h"
|
||||
#include "util/string.h"
|
||||
#include "version.h"
|
||||
|
||||
// Modding
|
||||
#include "content/mod_configuration.h"
|
||||
#include "content/mods.h"
|
||||
#include "modchannels.h"
|
||||
#include "script/common/c_types.h" // LuaError
|
||||
#include "script/scripting_client.h"
|
||||
|
||||
// Network
|
||||
#include "network/clientopcodes.h"
|
||||
#include "network/connection.h"
|
||||
#include "network/networkpacket.h"
|
||||
#include "serialization.h"
|
||||
|
||||
// Database
|
||||
#include "database/database-files.h"
|
||||
#include "database/database-sqlite3.h"
|
||||
|
||||
#include <IFileSystem.h>
|
||||
#include <json/json.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
#include <IFileSystem.h>
|
||||
#include <json/json.h>
|
||||
#include "client.h"
|
||||
#include "client/fontengine.h"
|
||||
#include "network/clientopcodes.h"
|
||||
#include "network/connection.h"
|
||||
#include "network/networkpacket.h"
|
||||
#include "threading/mutex_auto_lock.h"
|
||||
#include "client/clientevent.h"
|
||||
#include "client/renderingengine.h"
|
||||
#include "client/sound.h"
|
||||
#include "client/texturepaths.h"
|
||||
#include "client/texturesource.h"
|
||||
#include "client/mesh_generator_thread.h"
|
||||
#include "client/particles.h"
|
||||
#include "client/localplayer.h"
|
||||
#include "util/auth.h"
|
||||
#include "util/directiontables.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/string.h"
|
||||
#include "util/srp.h"
|
||||
#include "filesys.h"
|
||||
#include "mapblock_mesh.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapsector.h"
|
||||
#include "minimap.h"
|
||||
#include "modchannels.h"
|
||||
#include "content/mods.h"
|
||||
#include "profiler.h"
|
||||
#include "shader.h"
|
||||
#include "gettext.h"
|
||||
#include "gettime.h"
|
||||
#include "clientdynamicinfo.h"
|
||||
#include "clientmap.h"
|
||||
#include "clientmedia.h"
|
||||
#include "version.h"
|
||||
#include "database/database-files.h"
|
||||
#include "database/database-sqlite3.h"
|
||||
#include "serialization.h"
|
||||
#include "guiscalingfilter.h"
|
||||
#include "script/scripting_client.h"
|
||||
#include "game.h"
|
||||
#include "chatmessage.h"
|
||||
#include "translation.h"
|
||||
#include "content/mod_configuration.h"
|
||||
#include "mapnode.h"
|
||||
#include "item_visuals_manager.h"
|
||||
|
||||
extern gui::IGUIEnvironment* guienv;
|
||||
|
||||
@@ -1775,6 +1783,11 @@ ClientEvent *Client::getClientEvent()
|
||||
return event;
|
||||
}
|
||||
|
||||
void Client::setFatalError(const LuaError &e)
|
||||
{
|
||||
setFatalError(std::string("Lua: ") + e.what());
|
||||
}
|
||||
|
||||
const Address Client::getServerAddress()
|
||||
{
|
||||
return m_con ? m_con->GetPeerAddress(PEER_ID_SERVER) : Address();
|
||||
|
||||
@@ -5,23 +5,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "clientenvironment.h"
|
||||
#include "irrlichttypes.h"
|
||||
#include <ostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
#include "gamedef.h"
|
||||
#include "gameparams.h" // ELoginRegister
|
||||
#include "inventorymanager.h"
|
||||
#include "irrlichttypes.h"
|
||||
#include "network/address.h"
|
||||
#include "network/networkprotocol.h" // multiple enums
|
||||
#include "network/peerhandler.h"
|
||||
#include "gameparams.h"
|
||||
#include "script/common/c_types.h" // LuaError
|
||||
#include "util/numeric.h"
|
||||
#include "util/string.h" // StringMap
|
||||
#include "config.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#if !IS_CLIENT_BUILD
|
||||
#error Do not include in server builds
|
||||
@@ -35,6 +34,7 @@ class ISoundManager;
|
||||
class IWritableItemDefManager;
|
||||
class IWritableShaderSource;
|
||||
class IWritableTextureSource;
|
||||
class LuaError;
|
||||
class MapDatabase;
|
||||
class MeshUpdateManager;
|
||||
class Minimap;
|
||||
@@ -321,10 +321,7 @@ public:
|
||||
m_access_denied = true;
|
||||
m_access_denied_reason = reason;
|
||||
}
|
||||
inline void setFatalError(const LuaError &e)
|
||||
{
|
||||
setFatalError(std::string("Lua: ") + e.what());
|
||||
}
|
||||
void setFatalError(const LuaError &e);
|
||||
|
||||
// Renaming accessDeniedReason to better name could be good as it's used to
|
||||
// disconnect client when CSM failed.
|
||||
|
||||
@@ -8,24 +8,21 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "util/container.h"
|
||||
#include "config.h"
|
||||
#include "constants.h"
|
||||
#include "environment.h"
|
||||
#include "irrlicht_changes/printing.h"
|
||||
#include "filesys.h"
|
||||
#include "log.h"
|
||||
#include "servermap.h"
|
||||
#include "database/database.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapgen/mg_biome.h"
|
||||
#include "mapgen/mg_ore.h"
|
||||
#include "mapgen/mg_decoration.h"
|
||||
#include "mapgen/mg_schematic.h"
|
||||
#include "nodedef.h"
|
||||
#include "profiler.h"
|
||||
#include "scripting_server.h"
|
||||
#include "scripting_emerge.h"
|
||||
#include "script/common/c_types.h" // LuaError
|
||||
#include "server.h"
|
||||
#include "settings.h"
|
||||
#include "voxel.h"
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "irrlichttypes.h"
|
||||
#include "socket.h"
|
||||
#include "networkprotocol.h" // session_t
|
||||
#include "socket.h" // Address
|
||||
|
||||
class NetworkPacket;
|
||||
class PeerHandler;
|
||||
@@ -13,7 +13,7 @@ class PeerHandler;
|
||||
namespace con
|
||||
{
|
||||
|
||||
enum rtt_stat_type {
|
||||
enum rtt_stat_type : int {
|
||||
MIN_RTT,
|
||||
MAX_RTT,
|
||||
AVG_RTT,
|
||||
@@ -22,7 +22,7 @@ enum rtt_stat_type {
|
||||
AVG_JITTER
|
||||
};
|
||||
|
||||
enum rate_stat_type {
|
||||
enum rate_stat_type : int {
|
||||
CUR_DL_RATE,
|
||||
AVG_DL_RATE,
|
||||
CUR_INC_RATE,
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include "lua_api/l_object.h"
|
||||
#include "lua_api/l_item.h"
|
||||
#include "common/c_internal.h"
|
||||
#include "server.h"
|
||||
#include "content/mods.h" // ModSpec
|
||||
#include "server.h" // ServerPlayingSound
|
||||
#include "itemdef.h"
|
||||
#include "log.h"
|
||||
#include "tool.h"
|
||||
#include "porting.h"
|
||||
#include "mapgen/mg_schematic.h"
|
||||
#include "noise.h"
|
||||
#include "server/player_sao.h"
|
||||
#include "util/pointedthing.h"
|
||||
|
||||
@@ -16,43 +16,45 @@ extern "C" {
|
||||
#include <lua.h>
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include "util/string.h"
|
||||
#include "itemgroup.h"
|
||||
#include "itemdef.h"
|
||||
#include "util/pointabilities.h"
|
||||
// We do an explicit path include because by default c_content.h include src/client/hud.h
|
||||
// prior to the src/hud.h, which is not good on server only build
|
||||
#include "../../hud.h"
|
||||
#include "content/mods.h"
|
||||
|
||||
namespace Json { class Value; }
|
||||
|
||||
struct MapNode;
|
||||
class NodeDefManager;
|
||||
struct PointedThing;
|
||||
struct ItemStack;
|
||||
struct ItemDefinition;
|
||||
struct ToolCapabilities;
|
||||
struct ObjectProperties;
|
||||
struct SoundSpec;
|
||||
struct ServerPlayingSound;
|
||||
class IGameDef;
|
||||
class IItemDefManager;
|
||||
class Inventory;
|
||||
class InventoryList;
|
||||
struct NodeBox;
|
||||
struct ContentFeatures;
|
||||
struct TileDef;
|
||||
class IGameDef;
|
||||
struct DigParams;
|
||||
struct HitParams;
|
||||
struct EnumString;
|
||||
struct NoiseParams;
|
||||
class NodeDefManager;
|
||||
class ServerActiveObject;
|
||||
|
||||
struct collisionMoveResult;
|
||||
struct ContentFeatures;
|
||||
struct DigParams;
|
||||
struct EnumString;
|
||||
struct FlagDesc;
|
||||
struct HitParams;
|
||||
struct ItemDefinition;
|
||||
struct ItemImageDef;
|
||||
struct ItemStack;
|
||||
struct MapNode;
|
||||
struct ModSpec;
|
||||
struct NodeBox;
|
||||
struct NoiseParams;
|
||||
struct ObjectProperties;
|
||||
struct PointedThing;
|
||||
struct ServerPlayingSound;
|
||||
struct SoundSpec;
|
||||
struct TileDef;
|
||||
struct ToolCapabilities;
|
||||
struct WearBarParams;
|
||||
|
||||
namespace Json { class Value; }
|
||||
namespace treegen { struct TreeDef; }
|
||||
|
||||
extern struct EnumString es_TileAnimationType[];
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "mapnode.h"
|
||||
#include "server.h"
|
||||
#include "environment.h"
|
||||
#include "inventorymanager.h"
|
||||
#include "lua_api/l_item.h"
|
||||
|
||||
// Return number of accepted items to be moved
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "cpp_api/s_security.h"
|
||||
#include "lua_api/l_base.h"
|
||||
#include "filesys.h"
|
||||
#include "porting.h"
|
||||
#include "server.h"
|
||||
#if CHECK_CLIENT_BUILD()
|
||||
#include "client/client.h"
|
||||
#endif
|
||||
#include "content/mods.h" // ModSpec
|
||||
#include "settings.h"
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "common/c_converter.h"
|
||||
#include "client/client.h"
|
||||
#include "client/sound.h"
|
||||
#include "sound.h"
|
||||
|
||||
/* ModApiClientSound */
|
||||
|
||||
|
||||
@@ -3,18 +3,22 @@
|
||||
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "lua_api/l_server.h"
|
||||
#include "lua_api/l_internal.h"
|
||||
#include "common/c_converter.h"
|
||||
|
||||
#include "common/c_content.h"
|
||||
#include "common/c_converter.h"
|
||||
#include "common/c_packer.h"
|
||||
#include "content/mods.h" // ModSpec
|
||||
#include "cpp_api/s_base.h"
|
||||
#include "cpp_api/s_security.h"
|
||||
#include "environment.h"
|
||||
#include "filesys.h"
|
||||
#include "log.h"
|
||||
#include "lua_api/l_internal.h"
|
||||
#include "network/connection.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "environment.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "log.h"
|
||||
#include "filesys.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// request_shutdown()
|
||||
|
||||
100
src/server.cpp
100
src/server.cpp
@@ -3,64 +3,69 @@
|
||||
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "server.h"
|
||||
|
||||
#include "chat_interface.h"
|
||||
#include "chatmessage.h"
|
||||
#include "config.h"
|
||||
#include "constants.h"
|
||||
#include "content_nodemeta.h"
|
||||
#include "craftdef.h"
|
||||
#include "environment.h"
|
||||
#include "filesys.h"
|
||||
#include "gameparams.h"
|
||||
#include "gettext.h"
|
||||
#include "irr_v2d.h"
|
||||
#include "itemdef.h"
|
||||
#include "log.h"
|
||||
#include "mapblock.h"
|
||||
#include "nodedef.h"
|
||||
#include "particles.h"
|
||||
#include "profiler.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "server/ban.h"
|
||||
#include "servermap.h"
|
||||
#include "server/player_sao.h"
|
||||
#include "server/rollback.h"
|
||||
#include "server/serveractiveobject.h"
|
||||
#include "server/serverinventorymgr.h"
|
||||
#include "server/serverlist.h"
|
||||
#include "settings.h"
|
||||
#include "translation.h"
|
||||
#include "util/base64.h"
|
||||
#include "util/hashing.h"
|
||||
#include "util/hex.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/string.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/tracy_wrapper.h"
|
||||
#include "version.h"
|
||||
|
||||
// Mapgen
|
||||
#include "emerge.h"
|
||||
#include "mapgen/mapgen.h"
|
||||
#include "mapgen/mg_biome.h"
|
||||
|
||||
// Modding
|
||||
#include "modchannels.h"
|
||||
#include "script/common/c_types.h" // LuaError
|
||||
#include "scripting_server.h"
|
||||
#include "server/mods.h" // ServerModManager
|
||||
|
||||
// Network
|
||||
#include "network/connection.h"
|
||||
#include "network/networkpacket.h"
|
||||
#include "network/networkprotocol.h"
|
||||
#include "network/serveropcodes.h"
|
||||
#include "server/ban.h"
|
||||
#include "environment.h"
|
||||
#include "servermap.h"
|
||||
#include "threading/mutex_auto_lock.h"
|
||||
#include "constants.h"
|
||||
#include "voxel.h"
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
#include "filesys.h"
|
||||
#include "mapblock.h"
|
||||
#include "server/serveractiveobject.h"
|
||||
#include "serialization.h" // SER_FMT_VER_INVALID
|
||||
#include "settings.h"
|
||||
#include "profiler.h"
|
||||
#include "log.h"
|
||||
#include "scripting_server.h"
|
||||
#include "nodedef.h"
|
||||
#include "itemdef.h"
|
||||
#include "craftdef.h"
|
||||
#include "emerge.h"
|
||||
#include "mapgen/mapgen.h"
|
||||
#include "mapgen/mg_biome.h"
|
||||
#include "content_mapnode.h"
|
||||
#include "content_nodemeta.h"
|
||||
#include "content/mods.h"
|
||||
#include "modchannels.h"
|
||||
#include "server/serverlist.h"
|
||||
#include "util/string.h"
|
||||
#include "server/rollback.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/thread.h"
|
||||
#include "defaultsettings.h"
|
||||
#include "server/mods.h"
|
||||
#include "util/base64.h"
|
||||
#include "util/hashing.h"
|
||||
#include "util/hex.h"
|
||||
|
||||
// Database
|
||||
#include "database/database.h"
|
||||
#include "chatmessage.h"
|
||||
#include "chat_interface.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "server/player_sao.h"
|
||||
#include "server/serverinventorymgr.h"
|
||||
#include "translation.h"
|
||||
#include "database/database-sqlite3.h"
|
||||
#if USE_POSTGRESQL
|
||||
#include "database/database-postgresql.h"
|
||||
#endif
|
||||
#include "database/database-files.h"
|
||||
#include "database/database-dummy.h"
|
||||
#include "gameparams.h"
|
||||
#include "particles.h"
|
||||
#include "gettext.h"
|
||||
#include "util/tracy_wrapper.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
@@ -3990,6 +3995,11 @@ void Server::setAsyncFatalError(const std::string &error)
|
||||
m_thread->stop();
|
||||
}
|
||||
|
||||
void Server::setAsyncFatalError(const LuaError &e)
|
||||
{
|
||||
setAsyncFatalError(std::string("Lua: ") + e.what());
|
||||
}
|
||||
|
||||
// Not thread-safe.
|
||||
void Server::addShutdownError(const ModError &e)
|
||||
{
|
||||
|
||||
73
src/server.h
73
src/server.h
@@ -6,67 +6,71 @@
|
||||
|
||||
#include "irr_v3d.h"
|
||||
#include "map.h"
|
||||
#include "hud.h"
|
||||
#include "hud.h" // HudElementStat
|
||||
#include "gamedef.h"
|
||||
#include "content/mods.h"
|
||||
#include "inventorymanager.h"
|
||||
#include "content/subgames.h"
|
||||
#include "network/peerhandler.h"
|
||||
#include "network/connection.h"
|
||||
#include "util/numeric.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/basic_macros.h"
|
||||
#include "util/metricsbackend.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "server/clientiface.h"
|
||||
#include "threading/ordered_mutex.h"
|
||||
#include "chatmessage.h"
|
||||
#include "sound.h"
|
||||
#include "translation.h"
|
||||
#include "script/common/c_types.h" // LuaError
|
||||
#include "sound.h"
|
||||
#include <atomic>
|
||||
#include <csignal>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <shared_mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
class ChatEvent;
|
||||
struct ChatEventChat;
|
||||
struct ChatInterface;
|
||||
class IWritableItemDefManager;
|
||||
class NodeDefManager;
|
||||
class IWritableCraftDefManager;
|
||||
class BanManager;
|
||||
class ChatEvent;
|
||||
class EmergeManager;
|
||||
class Inventory;
|
||||
class IRollbackManager;
|
||||
class IWritableCraftDefManager;
|
||||
class IWritableItemDefManager;
|
||||
class LuaError;
|
||||
class MetricsBackend;
|
||||
class ModChannelMgr;
|
||||
class RemotePlayer;
|
||||
class NodeDefManager;
|
||||
class Player;
|
||||
class PlayerSAO;
|
||||
struct PlayerHPChangeReason;
|
||||
class IRollbackManager;
|
||||
struct RollbackAction;
|
||||
class EmergeManager;
|
||||
class ServerScripting;
|
||||
class RemotePlayer;
|
||||
class ServerEnvironment;
|
||||
struct SoundSpec;
|
||||
struct CloudParams;
|
||||
struct SkyboxParams;
|
||||
struct SunParams;
|
||||
struct MoonParams;
|
||||
struct StarParams;
|
||||
struct Lighting;
|
||||
class ServerThread;
|
||||
class ServerModManager;
|
||||
class ServerInventoryManager;
|
||||
class ServerModManager;
|
||||
class ServerScripting;
|
||||
class ServerThread;
|
||||
|
||||
struct ChatEventChat;
|
||||
struct ChatInterface;
|
||||
struct ChatMessage;
|
||||
struct CloudParams;
|
||||
struct Lighting;
|
||||
struct MoonParams;
|
||||
struct PackedValue;
|
||||
struct ParticleParameters;
|
||||
struct ParticleSpawnerParameters;
|
||||
struct PlayerHPChangeReason;
|
||||
struct RollbackAction;
|
||||
struct SkyboxParams;
|
||||
struct SoundSpec;
|
||||
struct StarParams;
|
||||
struct SunParams;
|
||||
|
||||
namespace con {
|
||||
class IConnection;
|
||||
class IPeer;
|
||||
|
||||
enum rtt_stat_type : int;
|
||||
}
|
||||
|
||||
// Anticheat flags
|
||||
enum {
|
||||
@@ -354,10 +358,7 @@ public:
|
||||
StepSettings getStepSettings() { return m_step_settings.load(); }
|
||||
|
||||
void setAsyncFatalError(const std::string &error);
|
||||
inline void setAsyncFatalError(const LuaError &e)
|
||||
{
|
||||
setAsyncFatalError(std::string("Lua: ") + e.what());
|
||||
}
|
||||
void setAsyncFatalError(const LuaError &e);
|
||||
|
||||
// Not thread-safe.
|
||||
void addShutdownError(const ModError &e);
|
||||
@@ -713,6 +714,8 @@ private:
|
||||
// Craft definition manager
|
||||
IWritableCraftDefManager *m_craftdef;
|
||||
|
||||
// NOTE: Cannot use forward declaration of 'Translations'. Whereas most
|
||||
// modern compilers support incomplete types here, it's not in the C++ spec.
|
||||
std::unordered_map<std::string, Translations> server_translations;
|
||||
|
||||
ModIPCStore m_ipcstore;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "network/connection.h"
|
||||
#include "network/networkpacket.h"
|
||||
#include "network/serveropcodes.h"
|
||||
#include "porting.h" // porting::getTimeS
|
||||
#include "remoteplayer.h"
|
||||
#include "serialization.h" // SER_FMT_VER_INVALID
|
||||
#include "settings.h"
|
||||
@@ -62,7 +63,8 @@ RemoteClient::RemoteClient() :
|
||||
m_block_optimize_distance(g_settings->getS16("block_send_optimize_distance")),
|
||||
m_block_cull_optimize_distance(g_settings->getS16("block_cull_optimize_distance")),
|
||||
m_max_gen_distance(g_settings->getS16("max_block_generate_distance")),
|
||||
m_occ_cull(g_settings->getBool("server_side_occlusion_culling"))
|
||||
m_occ_cull(g_settings->getBool("server_side_occlusion_culling")),
|
||||
m_connection_time(porting::getTimeS())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -619,6 +621,11 @@ void RemoteClient::setEncryptedPassword(const std::string& pwd)
|
||||
allowed_auth_mechs = AUTH_MECHANISM_SRP;
|
||||
}
|
||||
|
||||
u64 RemoteClient::uptime() const
|
||||
{
|
||||
return porting::getTimeS() - m_connection_time;
|
||||
}
|
||||
|
||||
void RemoteClient::setVersionInfo(u8 major, u8 minor, u8 patch, const std::string &full)
|
||||
{
|
||||
m_version_major = major;
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
|
||||
#include "network/address.h"
|
||||
#include "network/networkprotocol.h" // session_t
|
||||
#include "porting.h"
|
||||
#include "threading/mutex_auto_lock.h"
|
||||
#include "clientdynamicinfo.h"
|
||||
#include "constants.h" // PEER_ID_INEXISTENT
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
@@ -310,7 +309,7 @@ public:
|
||||
{ serialization_version = m_pending_serialization_version; }
|
||||
|
||||
/* get uptime */
|
||||
u64 uptime() const { return porting::getTimeS() - m_connection_time; }
|
||||
u64 uptime() const;
|
||||
|
||||
/* set version information */
|
||||
void setVersionInfo(u8 major, u8 minor, u8 patch, const std::string &full);
|
||||
@@ -423,7 +422,7 @@ private:
|
||||
/*
|
||||
time this client was created
|
||||
*/
|
||||
const u64 m_connection_time = porting::getTimeS();
|
||||
const u64 m_connection_time;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<u16, RemoteClient*> RemoteClientMap;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "constants.h"
|
||||
#include "inventorymanager.h" // InventoryLocation
|
||||
#include "metadata.h"
|
||||
#include "network/networkprotocol.h"
|
||||
#include "unit_sao.h"
|
||||
|
||||
Reference in New Issue
Block a user