1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-20 16:35:25 +01:00

Break include chains and tidy (part 2)

This commit is contained in:
SmallJoker
2025-11-06 19:31:13 +01:00
committed by GitHub
parent 8593d38030
commit 98fb381910
60 changed files with 259 additions and 153 deletions

View File

@@ -8,6 +8,7 @@
#include "config.h" #include "config.h"
#include "map.h" #include "map.h"
#include "clientmap.h" // MapDrawControl #include "clientmap.h" // MapDrawControl
#include "localplayer.h"
#include "player.h" #include "player.h"
#include <cmath> #include <cmath>
#include "client/renderingengine.h" #include "client/renderingengine.h"
@@ -22,9 +23,12 @@
#include "fontengine.h" #include "fontengine.h"
#include "script/scripting_client.h" #include "script/scripting_client.h"
#include "gettext.h" #include "gettext.h"
#include <SViewFrustum.h>
#include <ICameraSceneNode.h>
#include <IGUIFont.h> #include <IGUIFont.h>
#include <ISceneNode.h>
#include <IVideoDriver.h> #include <IVideoDriver.h>
#include <SViewFrustum.h>
static constexpr f32 CAMERA_OFFSET_STEP = 200; static constexpr f32 CAMERA_OFFSET_STEP = 200;
@@ -41,6 +45,7 @@ static const char *setting_names[] = {
Camera::Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *rendering_engine): Camera::Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *rendering_engine):
m_draw_control(draw_control), m_draw_control(draw_control),
m_client(client), m_client(client),
m_camera_mode(CAMERA_MODE_FIRST),
m_player_light_color(0xFFFFFFFF) m_player_light_color(0xFFFFFFFF)
{ {
auto smgr = rendering_engine->get_scene_manager(); auto smgr = rendering_engine->get_scene_manager();
@@ -92,6 +97,11 @@ Camera::~Camera()
m_wieldmgr->drop(); m_wieldmgr->drop();
} }
v3f Camera::getHeadPosition() const
{
return m_headnode->getAbsolutePosition();
}
void Camera::notifyFovChange() void Camera::notifyFovChange()
{ {
LocalPlayer *player = m_client->getEnv().getLocalPlayer(); LocalPlayer *player = m_client->getEnv().getLocalPlayer();
@@ -626,6 +636,16 @@ void Camera::drawWieldedTool(core::matrix4* translation)
m_wieldmgr->drawAll(); m_wieldmgr->drawAll();
} }
void Camera::toggleCameraMode()
{
if (m_camera_mode == CAMERA_MODE_FIRST)
m_camera_mode = CAMERA_MODE_THIRD;
else if (m_camera_mode == CAMERA_MODE_THIRD)
m_camera_mode = CAMERA_MODE_THIRD_FRONT;
else
m_camera_mode = CAMERA_MODE_FIRST;
}
void Camera::drawNametags() void Camera::drawNametags()
{ {
core::matrix4 trans = m_cameranode->getProjectionMatrix(); core::matrix4 trans = m_cameranode->getProjectionMatrix();

View File

@@ -5,11 +5,8 @@
#pragma once #pragma once
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include "inventory.h" #include "inventory.h" // ItemStack
#include "util/numeric.h" #include "util/numeric.h"
#include "client/localplayer.h"
#include <ICameraSceneNode.h>
#include <ISceneNode.h>
#include <plane3d.h> #include <plane3d.h>
#include <array> #include <array>
#include <list> #include <list>
@@ -21,6 +18,14 @@ class Client;
class RenderingEngine; class RenderingEngine;
class WieldMeshSceneNode; class WieldMeshSceneNode;
enum CameraMode : int;
namespace scene {
class ICameraSceneNode;
class ISceneManager;
class ISceneNode;
};
struct Nametag struct Nametag
{ {
scene::ISceneNode *parent_node = nullptr; scene::ISceneNode *parent_node = nullptr;
@@ -75,10 +80,7 @@ public:
} }
// Returns the absolute position of the head SceneNode in the world // Returns the absolute position of the head SceneNode in the world
inline v3f getHeadPosition() const v3f getHeadPosition() const;
{
return m_headnode->getAbsolutePosition();
}
// Get the camera direction (in absolute camera coordinates). // Get the camera direction (in absolute camera coordinates).
// This has view bobbing applied. // This has view bobbing applied.
@@ -156,15 +158,7 @@ public:
void drawWieldedTool(core::matrix4* translation=NULL); void drawWieldedTool(core::matrix4* translation=NULL);
// Toggle the current camera mode // Toggle the current camera mode
void toggleCameraMode() void toggleCameraMode();
{
if (m_camera_mode == CAMERA_MODE_FIRST)
m_camera_mode = CAMERA_MODE_THIRD;
else if (m_camera_mode == CAMERA_MODE_THIRD)
m_camera_mode = CAMERA_MODE_THIRD_FRONT;
else
m_camera_mode = CAMERA_MODE_FIRST;
}
// Set the current camera mode // Set the current camera mode
inline void setCameraMode(CameraMode mode) inline void setCameraMode(CameraMode mode)
@@ -255,7 +249,7 @@ private:
f32 m_wield_change_timer = 0.125f; f32 m_wield_change_timer = 0.125f;
ItemStack m_wield_item_next; ItemStack m_wield_item_next;
CameraMode m_camera_mode = CAMERA_MODE_FIRST; CameraMode m_camera_mode;
f32 m_cache_view_bobbing_amount; f32 m_cache_view_bobbing_amount;
bool m_arm_inertia; bool m_arm_inertia;

View File

@@ -17,12 +17,14 @@
#include "client/sound.h" #include "client/sound.h"
#include "client/texturepaths.h" #include "client/texturepaths.h"
#include "client/texturesource.h" #include "client/texturesource.h"
#include "camera.h"
#include "filesys.h" #include "filesys.h"
#include "game.h" #include "game.h"
#include "gettext.h" #include "gettext.h"
#include "gettime.h" #include "gettime.h"
#include "guiscalingfilter.h" #include "guiscalingfilter.h"
#include "item_visuals_manager.h" #include "item_visuals_manager.h"
#include "itemdef.h"
#include "mapblock.h" #include "mapblock.h"
#include "mapblock_mesh.h" #include "mapblock_mesh.h"
#include "mapnode.h" #include "mapnode.h"

View File

@@ -7,14 +7,16 @@
#include "client/mesh.h" #include "client/mesh.h"
#include "mapblock_mesh.h" #include "mapblock_mesh.h"
#include <IMaterialRenderer.h> #include <IMaterialRenderer.h>
#include <ISceneManager.h>
#include <IVideoDriver.h> #include <IVideoDriver.h>
#include <matrix4.h> #include <matrix4.h>
#include "mapsector.h" #include "mapsector.h"
#include "mapblock.h" #include "mapblock.h"
#include "nodedef.h" #include "nodedef.h"
#include "player.h" // CameraMode
#include "profiler.h" #include "profiler.h"
#include "settings.h" #include "settings.h"
#include "camera.h" // CameraModes #include "camera.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "util/tracy_wrapper.h" #include "util/tracy_wrapper.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"

View File

@@ -6,7 +6,7 @@
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include "map.h" #include "map.h"
#include "camera.h" #include <ISceneNode.h>
#include <set> #include <set>
#include <map> #include <map>
@@ -23,6 +23,9 @@ struct MapDrawControl
}; };
class Client; class Client;
class RenderingEngine;
enum CameraMode : int;
namespace scene namespace scene
{ {

View File

@@ -27,6 +27,7 @@
#include "texturesource.h" #include "texturesource.h"
#include "gui/mainmenumanager.h" #include "gui/mainmenumanager.h"
#include "gui/profilergraph.h" #include "gui/profilergraph.h"
#include "localplayer.h"
#include "minimap.h" #include "minimap.h"
#include "nodedef.h" // Needed for determining pointing to nodes #include "nodedef.h" // Needed for determining pointing to nodes
#include "nodemetadata.h" #include "nodemetadata.h"
@@ -46,6 +47,7 @@
#include "script/scripting_client.h" #include "script/scripting_client.h"
#include "hud.h" #include "hud.h"
#include <AnimatedMeshSceneNode.h> #include <AnimatedMeshSceneNode.h>
#include <ICameraSceneNode.h>
#include "util/tracy_wrapper.h" #include "util/tracy_wrapper.h"
#include "item_visuals_manager.h" #include "item_visuals_manager.h"
@@ -2080,6 +2082,12 @@ f32 Game::getSensitivityScaleFactor() const
return std::tan(fov_y / 2.0f) * 1.3763819f; return std::tan(fov_y / 2.0f) * 1.3763819f;
} }
bool Game::isTouchShootlineUsed() const
{
return g_touchcontrols && g_touchcontrols->isShootlineAvailable() &&
camera->getCameraMode() == CAMERA_MODE_FIRST;
}
void Game::updateCameraOrientation(CameraOrientation *cam, float dtime) void Game::updateCameraOrientation(CameraOrientation *cam, float dtime)
{ {
if (g_touchcontrols) { if (g_touchcontrols) {

View File

@@ -19,6 +19,7 @@
#include "gui/guiPasswordChange.h" #include "gui/guiPasswordChange.h"
#include "gui/guiOpenURL.h" #include "gui/guiOpenURL.h"
#include "gui/guiVolumeChange.h" #include "gui/guiVolumeChange.h"
#include "localplayer.h"
/* /*
Text input system Text input system

View File

@@ -380,11 +380,7 @@ private:
bool m_is_paused = false; bool m_is_paused = false;
bool m_touch_simulate_aux1 = false; bool m_touch_simulate_aux1 = false;
inline bool isTouchShootlineUsed() bool isTouchShootlineUsed() const;
{
return g_touchcontrols && g_touchcontrols->isShootlineAvailable() &&
camera->getCameraMode() == CAMERA_MODE_FIRST;
}
#ifdef __ANDROID__ #ifdef __ANDROID__
bool m_android_chat_open; bool m_android_chat_open;
#endif #endif

View File

@@ -16,6 +16,7 @@
#include "fontengine.h" #include "fontengine.h"
#include "hud.h" // HUD_FLAG_* #include "hud.h" // HUD_FLAG_*
#include "nodedef.h" #include "nodedef.h"
#include "localplayer.h"
#include "profiler.h" #include "profiler.h"
#include "renderingengine.h" #include "renderingengine.h"
#include "version.h" #include "version.h"

View File

@@ -27,6 +27,7 @@
#include "util/enriched_string.h" #include "util/enriched_string.h"
#include "irrlicht_changes/CGUITTFont.h" #include "irrlicht_changes/CGUITTFont.h"
#include "gui/drawItemStack.h" #include "gui/drawItemStack.h"
#include <ICameraSceneNode.h>
#define OBJECT_CROSSHAIR_LINE_SIZE 8 #define OBJECT_CROSSHAIR_LINE_SIZE 8
#define CROSSHAIR_LINE_SIZE 10 #define CROSSHAIR_LINE_SIZE 10

View File

@@ -5,15 +5,15 @@
#pragma once #pragma once
#include "player.h" #include "player.h"
#include "environment.h"
#include "constants.h" #include "constants.h"
#include "lighting.h" #include "lighting.h"
#include <string> #include <string>
class Client; class Client;
class ClientActiveObject;
class Environment; class Environment;
class GenericCAO; class GenericCAO;
class ClientActiveObject; class Map;
struct CollisionInfo; struct CollisionInfo;
struct collisionMoveResult; struct collisionMoveResult;

View File

@@ -4,14 +4,15 @@
#include "minimap.h" #include "minimap.h"
#include <cmath> #include <cmath>
#include "camera.h"
#include "client.h" #include "client.h"
#include "clientmap.h" #include "mapblock.h" // getNodeBlockPos
#include "settings.h" #include "settings.h"
#include "shader.h" #include "shader.h"
#include "mapblock.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "client/texturesource.h" #include "client/texturesource.h"
#include "gettext.h" #include "gettext.h"
#include "voxel.h"
//// ////
//// MinimapUpdateThread //// MinimapUpdateThread

View File

@@ -5,6 +5,7 @@
#include "plain.h" #include "plain.h"
#include "secondstage.h" #include "secondstage.h"
#include "settings.h"
#include "client/camera.h" #include "client/camera.h"
#include "client/client.h" #include "client/client.h"
#include "client/clientmap.h" #include "client/clientmap.h"

View File

@@ -8,6 +8,7 @@
#include "client/camera.h" #include "client/camera.h"
#include "constants.h" #include "constants.h"
#include "settings.h" #include "settings.h"
#include <ICameraSceneNode.h>
OffsetCameraStep::OffsetCameraStep(float eye_offset) OffsetCameraStep::OffsetCameraStep(float eye_offset)
{ {

View File

@@ -9,6 +9,7 @@
#include "client/clientenvironment.h" #include "client/clientenvironment.h"
#include "client/clientmap.h" #include "client/clientmap.h"
#include "client/camera.h" #include "client/camera.h"
#include <ICameraSceneNode.h>
#include <IVideoDriver.h> #include <IVideoDriver.h>
using m4f = core::matrix4; using m4f = core::matrix4;

View File

@@ -3,22 +3,26 @@
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com> // Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2020 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru> // Copyright (C) 2020 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include <cmath>
#include "sky.h" #include "sky.h"
#include <ITexture.h>
#include <IVideoDriver.h> #include "camera.h"
#include <ISceneManager.h>
#include <ICameraSceneNode.h>
#include <S3DVertex.h>
#include "client/mesh.h" #include "client/mesh.h"
#include "client/tile.h"
#include "noise.h" // easeCurve
#include "profiler.h"
#include "util/numeric.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "client/texturesource.h" #include "client/texturesource.h"
#include "client/tile.h"
#include "noise.h" // easeCurve
#include "player.h" // CameraMode
#include "profiler.h"
#include "settings.h" #include "settings.h"
#include "camera.h" // CameraModes #include "util/numeric.h"
#include <ICameraSceneNode.h>
#include <ISceneManager.h>
#include <ITexture.h>
#include <IVideoDriver.h>
#include <S3DVertex.h>
#include <cmath>
using namespace core; using namespace core;

View File

@@ -12,6 +12,7 @@
#include <queue> #include <queue>
#include "gamedef.h" #include "gamedef.h"
#include "inventory.h" #include "inventory.h"
#include "itemdef.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/string.h" #include "util/string.h"
#include "util/numeric.h" #include "util/numeric.h"
@@ -274,6 +275,12 @@ std::string craftDumpMatrix(const std::vector<ItemStack> &items,
CraftInput CraftInput
*/ */
CraftInput::CraftInput(CraftMethod method_, unsigned int width_,
const std::vector<ItemStack> &items_):
method(method_), width(width_), items(items_)
{
}
bool CraftInput::empty() const bool CraftInput::empty() const
{ {
for (const auto &item : items) { for (const auto &item : items) {

View File

@@ -4,12 +4,12 @@
#pragma once #pragma once
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include "gamedef.h" #include "gamedef.h"
#include "inventory.h"
#include <string>
#include <vector>
struct ItemStack;
/* /*
Crafting methods. Crafting methods.
@@ -61,9 +61,7 @@ struct CraftInput
CraftInput() = default; CraftInput() = default;
CraftInput(CraftMethod method_, unsigned int width_, CraftInput(CraftMethod method_, unsigned int width_,
const std::vector<ItemStack> &items_): const std::vector<ItemStack> &items_);
method(method_), width(width_), items(items_)
{}
// Returns true if all items are empty. // Returns true if all items are empty.
bool empty() const; bool empty() const;

View File

@@ -13,6 +13,7 @@
#include "irrlicht_changes/printing.h" #include "irrlicht_changes/printing.h"
#include "filesys.h" #include "filesys.h"
#include "log.h" #include "log.h"
#include "serverenvironment.h"
#include "servermap.h" #include "servermap.h"
#include "mapblock.h" #include "mapblock.h"
#include "mapgen/mg_biome.h" #include "mapgen/mg_biome.h"

View File

@@ -8,6 +8,7 @@
#include "raycast.h" #include "raycast.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "server.h" #include "server.h"
#include "settings.h"
#include "daynightratio.h" #include "daynightratio.h"
#include "emerge.h" #include "emerge.h"

View File

@@ -9,6 +9,7 @@
#include "client/client.h" #include "client/client.h"
#include "porting.h" #include "porting.h"
#include "inventory.h" #include "inventory.h"
#include "itemdef.h"
#include "client/mesh.h" #include "client/mesh.h"
#include "client/wieldmesh.h" #include "client/wieldmesh.h"
#include "client/texturesource.h" #include "client/texturesource.h"

View File

@@ -12,6 +12,7 @@
#include "guiFormSpecMenu.h" #include "guiFormSpecMenu.h"
#include "EGUIElementTypes.h" #include "EGUIElementTypes.h"
#include "constants.h" #include "constants.h"
#include "itemdef.h"
#include "gamedef.h" #include "gamedef.h"
#include "client/keycode.h" #include "client/keycode.h"
#include "gui/guiTable.h" #include "gui/guiTable.h"

View File

@@ -11,6 +11,7 @@
#include "util/strfnd.h" #include "util/strfnd.h"
#include "content_mapnode.h" // For loading legacy MaterialItems #include "content_mapnode.h" // For loading legacy MaterialItems
#include "nameidmapping.h" // For loading legacy MaterialItems #include "nameidmapping.h" // For loading legacy MaterialItems
#include "itemdef.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/string.h" #include "util/string.h"
@@ -303,6 +304,74 @@ v3f ItemStack::getWieldScale(const IItemDefManager *itemdef) const
return str_to_v3f(scale).value_or(getDefinition(itemdef).wield_scale); return str_to_v3f(scale).value_or(getDefinition(itemdef).wield_scale);
} }
u16 ItemStack::getStackMax(const IItemDefManager *itemdef) const
{
return itemdef->get(name).stack_max;
}
bool ItemStack::isKnown(const IItemDefManager *itemdef) const
{
return itemdef->isKnown(name);
}
const ItemDefinition &ItemStack::getDefinition(
const IItemDefManager *itemdef) const
{
return itemdef->get(name);
}
const ToolCapabilities &ItemStack::getToolCapabilities(
const IItemDefManager *itemdef, const ItemStack *hand) const
{
// Check for override
auto &meta_item_cap = metadata.getToolCapabilitiesOverride();
if (meta_item_cap.has_value())
return meta_item_cap.value();
const ToolCapabilities *item_cap = itemdef->get(name).tool_capabilities;
if (item_cap)
return *item_cap;
// Fall back to the hand's tool capabilities
if (hand) {
auto &hand_meta_item_cap = hand->metadata.getToolCapabilitiesOverride();
if (hand_meta_item_cap.has_value())
return hand_meta_item_cap.value();
item_cap = itemdef->get(hand->name).tool_capabilities;
if (item_cap)
return *item_cap;
}
item_cap = itemdef->get("").tool_capabilities;
assert(item_cap);
return *item_cap;
}
const std::optional<WearBarParams> &ItemStack::getWearBarParams(
const IItemDefManager *itemdef) const
{
auto &meta_override = metadata.getWearBarParamOverride();
if (meta_override.has_value())
return meta_override;
return itemdef->get(name).wear_bar_params;
}
bool ItemStack::addWear(s32 amount, const IItemDefManager *itemdef)
{
if (getDefinition(itemdef).type == ITEM_TOOL) {
if(amount > 65535 - wear)
clear();
else if(amount < -wear)
wear = 0;
else
wear += amount;
return true;
}
return false;
}
ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef) ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
{ {
// If the item is empty or the position invalid, bail out // If the item is empty or the position invalid, bail out

View File

@@ -4,7 +4,6 @@
#pragma once #pragma once
#include "itemdef.h"
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include "itemstackmetadata.h" #include "itemstackmetadata.h"
#include <istream> #include <istream>
@@ -13,6 +12,8 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
struct ItemDefinition;
struct ItemImageDef;
struct ToolCapabilities; struct ToolCapabilities;
struct ItemStack struct ItemStack
@@ -73,10 +74,7 @@ struct ItemStack
} }
// Maximum size of a stack // Maximum size of a stack
u16 getStackMax(const IItemDefManager *itemdef) const u16 getStackMax(const IItemDefManager *itemdef) const;
{
return itemdef->get(name).stack_max;
}
// Number of items that can be added to this stack // Number of items that can be added to this stack
u16 freeSpace(const IItemDefManager *itemdef) const u16 freeSpace(const IItemDefManager *itemdef) const
@@ -88,75 +86,24 @@ struct ItemStack
} }
// Returns false if item is not known and cannot be used // Returns false if item is not known and cannot be used
bool isKnown(const IItemDefManager *itemdef) const bool isKnown(const IItemDefManager *itemdef) const;
{
return itemdef->isKnown(name);
}
// Returns a pointer to the item definition struct, // Returns a pointer to the item definition struct,
// or a fallback one (name="unknown") if the item is unknown. // or a fallback one (name="unknown") if the item is unknown.
const ItemDefinition& getDefinition( const ItemDefinition &getDefinition(
const IItemDefManager *itemdef) const const IItemDefManager *itemdef) const;
{
return itemdef->get(name);
}
// Get tool digging properties, or those of the hand if not a tool // Get tool digging properties, or those of the hand if not a tool
// If not hand assumes default hand "" // If not hand assumes default hand ""
const ToolCapabilities& getToolCapabilities( const ToolCapabilities &getToolCapabilities(
const IItemDefManager *itemdef, const ItemStack *hand = nullptr) const const IItemDefManager *itemdef, const ItemStack *hand = nullptr) const;
{
// Check for override
auto &meta_item_cap = metadata.getToolCapabilitiesOverride();
if (meta_item_cap.has_value())
return meta_item_cap.value();
const ToolCapabilities *item_cap = itemdef->get(name).tool_capabilities;
if (item_cap)
return *item_cap;
// Fall back to the hand's tool capabilities
if (hand) {
auto &hand_meta_item_cap = hand->metadata.getToolCapabilitiesOverride();
if (hand_meta_item_cap.has_value())
return hand_meta_item_cap.value();
item_cap = itemdef->get(hand->name).tool_capabilities;
if (item_cap)
return *item_cap;
}
item_cap = itemdef->get("").tool_capabilities;
assert(item_cap);
return *item_cap;
}
const std::optional<WearBarParams> &getWearBarParams( const std::optional<WearBarParams> &getWearBarParams(
const IItemDefManager *itemdef) const const IItemDefManager *itemdef) const;
{
auto &meta_override = metadata.getWearBarParamOverride();
if (meta_override.has_value())
return meta_override;
return itemdef->get(name).wear_bar_params;
}
// Wear out (only tools) // Wear out (only tools)
// Returns true if the item is (was) a tool // Returns true if the item is (was) a tool
bool addWear(s32 amount, const IItemDefManager *itemdef) bool addWear(s32 amount, const IItemDefManager *itemdef);
{
if(getDefinition(itemdef).type == ITEM_TOOL)
{
if(amount > 65535 - wear)
clear();
else if(amount < -wear)
wear = 0;
else
wear += amount;
return true;
}
return false;
}
// If possible, adds newitem to this item. // If possible, adds newitem to this item.
// If cannot be added at all, returns the item back. // If cannot be added at all, returns the item back.

View File

@@ -28,6 +28,9 @@
#include "player.h" #include "player.h"
#include "porting.h" #include "porting.h"
#include "serialization.h" // SER_FMT_VER_HIGHEST_* #include "serialization.h" // SER_FMT_VER_HIGHEST_*
#include "serverenvironment.h"
#include "servermap.h"
#include "settings.h"
#include "network/socket.h" #include "network/socket.h"
#include "mapblock.h" #include "mapblock.h"
#if USE_CURSES #if USE_CURSES

View File

@@ -4,22 +4,22 @@
#pragma once #pragma once
#include <iostream>
#include <set>
#include <map> #include <map>
#include <ostream>
#include <set>
#include <unordered_map>
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include "mapblock.h" #include "mapblock.h" // for forEachNodeInArea
#include "mapnode.h" #include "mapnode.h"
#include "constants.h" #include "constants.h"
#include "voxel.h" #include "voxel.h"
#include "modifiedstate.h" #include "modifiedstate.h"
#include "util/numeric.h" #include "util/numeric.h" // for forEachNodeInArea
#include "nodetimer.h"
#include "debug.h"
class MapSector; class MapSector;
class NodeMetadata; class NodeMetadata;
class NodeTimer;
class IGameDef; class IGameDef;
/* /*

View File

@@ -6,7 +6,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "settings.h" #include "settings.h" // SettingsHierarchy
struct NoiseParams; struct NoiseParams;
struct MapgenParams; struct MapgenParams;

View File

@@ -20,6 +20,7 @@
#include "client/mapblock_mesh.h" #include "client/mapblock_mesh.h"
#endif #endif
#include "porting.h" #include "porting.h"
#include "settings.h"
#include "util/string.h" #include "util/string.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"

View File

@@ -10,14 +10,12 @@
#include "exceptions.h" #include "exceptions.h"
#include "constants.h" #include "constants.h"
#include "staticobject.h" #include "staticobject.h"
#include "nodemetadata.h" #include "nodemetadata.h" // NodeMetadataList
#include "nodetimer.h" #include "nodetimer.h"
#include "modifiedstate.h" #include "modifiedstate.h"
#include "util/numeric.h" // getContainerPos #include "util/numeric.h" // getContainerPos
#include "settings.h"
class Map; class Map;
class NodeMetadataList;
class IGameDef; class IGameDef;
class MapBlockMesh; class MapBlockMesh;
class VoxelManipulator; class VoxelManipulator;

View File

@@ -14,6 +14,7 @@
#include "util/numeric.h" #include "util/numeric.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "serialization.h" #include "serialization.h"
#include "servermap.h"
#include "filesys.h" #include "filesys.h"
#include "voxelalgorithms.h" #include "voxelalgorithms.h"
#include "porting.h" #include "porting.h"

View File

@@ -15,6 +15,7 @@
#include "servermap.h" #include "servermap.h"
#include "mapsector.h" #include "mapsector.h"
#include "client/minimap.h" #include "client/minimap.h"
#include "itemdef.h"
#include "modchannels.h" #include "modchannels.h"
#include "nodedef.h" #include "nodedef.h"
#include "serialization.h" #include "serialization.h"

View File

@@ -4,8 +4,10 @@
#include "chatmessage.h" #include "chatmessage.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include "log.h" #include "log.h"
#include "emerge.h" #include "emerge.h"
#include "itemdef.h"
#include "mapblock.h" #include "mapblock.h"
#include "modchannels.h" #include "modchannels.h"
#include "nodedef.h" #include "nodedef.h"

View File

@@ -6,10 +6,9 @@
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include "inventory.h" #include "inventory.h"
#include "constants.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "util/string.h"
#include <string> #include <string>
#include <string_view>
#define PLAYERNAME_SIZE 20 #define PLAYERNAME_SIZE 20
@@ -125,7 +124,7 @@ struct PlayerPhysicsOverride
}; };
/// @note numeric values are part of network protocol /// @note numeric values are part of network protocol
enum CameraMode { enum CameraMode : int {
// not a mode. indicates that any may be used. // not a mode. indicates that any may be used.
CAMERA_MODE_ANY = 0, CAMERA_MODE_ANY = 0,
CAMERA_MODE_FIRST, CAMERA_MODE_FIRST,

View File

@@ -5,6 +5,7 @@
#pragma once #pragma once
#include "constants.h" // PEER_ID_INEXISTENT
#include "player.h" #include "player.h"
#include "skyparams.h" #include "skyparams.h"
#include "lighting.h" #include "lighting.h"

View File

@@ -9,6 +9,7 @@
#include "util/numeric.h" #include "util/numeric.h"
#include "map.h" #include "map.h"
#include "gamedef.h" #include "gamedef.h"
#include "itemdef.h"
#include "nodedef.h" #include "nodedef.h"
#include "nodemetadata.h" #include "nodemetadata.h"
#include "exceptions.h" #include "exceptions.h"

View File

@@ -16,6 +16,7 @@ extern "C" {
#include "log.h" #include "log.h"
#include "config.h" #include "config.h"
#include "filesys.h" #include "filesys.h"
#include "settings.h"
#include "porting.h" #include "porting.h"
#include "common/c_internal.h" #include "common/c_internal.h"
#include "common/c_packer.h" #include "common/c_packer.h"

View File

@@ -6,10 +6,10 @@
#include "cpp_api/s_internal.h" #include "cpp_api/s_internal.h"
#include "common/c_converter.h" #include "common/c_converter.h"
#include "log.h" #include "log.h"
#include "environment.h"
#include "mapgen/mapgen.h" #include "mapgen/mapgen.h"
#include "lua_api/l_env.h" #include "lua_api/l_env.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "script/common/c_content.h" #include "script/common/c_content.h"

View File

@@ -8,7 +8,7 @@
#include "common/c_content.h" #include "common/c_content.h"
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"
#include "server.h" #include "server.h"
#include "environment.h" #include "serverenvironment.h"
#include "database/database.h" #include "database/database.h"
#include <algorithm> #include <algorithm>

View File

@@ -9,6 +9,8 @@
#include "client/content_cao.h" #include "client/content_cao.h"
#include "client/camera.h" #include "client/camera.h"
#include "client/client.h" #include "client/client.h"
#include "client/localplayer.h"
#include <ICameraSceneNode.h>
LuaCamera::LuaCamera(Camera *m) : m_camera(m) LuaCamera::LuaCamera(Camera *m) : m_camera(m)
{ {

View File

@@ -13,9 +13,9 @@
#include "common/c_converter.h" #include "common/c_converter.h"
#include "common/c_content.h" #include "common/c_content.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "environment.h"
#include "mapblock.h" #include "mapblock.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include "nodedef.h" #include "nodedef.h"
#include "daynightratio.h" #include "daynightratio.h"
#include "util/pointedthing.h" #include "util/pointedthing.h"
@@ -24,6 +24,7 @@
#include "pathfinder.h" #include "pathfinder.h"
#include "face_position_cache.h" #include "face_position_cache.h"
#include "remoteplayer.h" #include "remoteplayer.h"
#include "servermap.h"
#include "server/luaentity_sao.h" #include "server/luaentity_sao.h"
#include "server/player_sao.h" #include "server/player_sao.h"
#include "util/string.h" #include "util/string.h"

View File

@@ -8,6 +8,7 @@
#include "l_internal.h" #include "l_internal.h"
#include "common/c_content.h" #include "common/c_content.h"
#include "gui/guiEngine.h" #include "gui/guiEngine.h"
#include "sound.h"
/* ModApiMainMenuSound */ /* ModApiMainMenuSound */

View File

@@ -10,8 +10,10 @@
#include "cpp_api/s_security.h" #include "cpp_api/s_security.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "server.h" #include "server.h"
#include "environment.h" #include "serverenvironment.h"
#include "servermap.h"
#include "emerge_internal.h" #include "emerge_internal.h"
#include "map_settings_manager.h"
#include "mapgen/mg_biome.h" #include "mapgen/mg_biome.h"
#include "mapgen/mg_ore.h" #include "mapgen/mg_ore.h"
#include "mapgen/mg_decoration.h" #include "mapgen/mg_decoration.h"

View File

@@ -5,8 +5,7 @@
#include "lua_api/l_nodetimer.h" #include "lua_api/l_nodetimer.h"
#include "lua_api/l_internal.h" #include "lua_api/l_internal.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "map.h" #include "servermap.h"
int NodeTimerRef::gc_object(lua_State *L) { int NodeTimerRef::gc_object(lua_State *L) {
NodeTimerRef *o = *(NodeTimerRef **)(lua_touserdata(L, 1)); NodeTimerRef *o = *(NodeTimerRef **)(lua_touserdata(L, 1));

View File

@@ -17,6 +17,8 @@
#include "tool.h" #include "tool.h"
#include "remoteplayer.h" #include "remoteplayer.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include "settings.h"
#include "hud.h" #include "hud.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "server/luaentity_sao.h" #include "server/luaentity_sao.h"

View File

@@ -9,6 +9,7 @@
#include "common/c_converter.h" #include "common/c_converter.h"
#include "common/c_content.h" #include "common/c_content.h"
#include "server.h" #include "server.h"
#include "server/serveractiveobject.h"
#include "particles.h" #include "particles.h"
namespace LuaParticleParams namespace LuaParticleParams

View File

@@ -10,7 +10,6 @@
#include "content/mods.h" // ModSpec #include "content/mods.h" // ModSpec
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"
#include "cpp_api/s_security.h" #include "cpp_api/s_security.h"
#include "environment.h"
#include "filesys.h" #include "filesys.h"
#include "log.h" #include "log.h"
#include "lua_api/l_internal.h" #include "lua_api/l_internal.h"
@@ -18,6 +17,7 @@
#include "remoteplayer.h" #include "remoteplayer.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include <algorithm> #include <algorithm>

View File

@@ -9,10 +9,9 @@
#include "common/c_content.h" #include "common/c_content.h"
#include "common/c_converter.h" #include "common/c_converter.h"
#include "common/c_packer.h" #include "common/c_packer.h"
#include "environment.h"
#include "map.h"
#include "mapblock.h" #include "mapblock.h"
#include "server.h" #include "serverenvironment.h"
#include "servermap.h"
#include "voxelalgorithms.h" #include "voxelalgorithms.h"
// garbage collector // garbage collector

View File

@@ -23,6 +23,7 @@
#include "profiler.h" #include "profiler.h"
#include "remoteplayer.h" #include "remoteplayer.h"
#include "server/ban.h" #include "server/ban.h"
#include "serverenvironment.h"
#include "servermap.h" #include "servermap.h"
#include "server/player_sao.h" #include "server/player_sao.h"
#include "server/rollback.h" #include "server/rollback.h"
@@ -4017,6 +4018,11 @@ void Server::addShutdownError(const ModError &e)
} }
} }
Map &Server::getMap()
{
return m_env->getMap();
}
v3f Server::findSpawnPos() v3f Server::findSpawnPos()
{ {
ServerMap &map = m_env->getServerMap(); ServerMap &map = m_env->getServerMap();

View File

@@ -12,7 +12,7 @@
#include "network/peerhandler.h" #include "network/peerhandler.h"
#include "util/thread.h" #include "util/thread.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "serverenvironment.h" #include "util/metricsbackend.h"
#include "server/clientiface.h" #include "server/clientiface.h"
#include "threading/ordered_mutex.h" #include "threading/ordered_mutex.h"
#include "translation.h" #include "translation.h"
@@ -48,11 +48,13 @@ class ServerInventoryManager;
class ServerModManager; class ServerModManager;
class ServerScripting; class ServerScripting;
class ServerThread; class ServerThread;
class Settings;
struct ChatEventChat; struct ChatEventChat;
struct ChatInterface; struct ChatInterface;
struct ChatMessage; struct ChatMessage;
struct CloudParams; struct CloudParams;
struct GameParams;
struct Lighting; struct Lighting;
struct MoonParams; struct MoonParams;
struct PackedValue; struct PackedValue;
@@ -364,7 +366,7 @@ public:
void addShutdownError(const ModError &e); void addShutdownError(const ModError &e);
bool showFormspec(const char *name, const std::string &formspec, const std::string &formname); bool showFormspec(const char *name, const std::string &formspec, const std::string &formname);
Map & getMap() { return m_env->getMap(); } Map &getMap();
ServerEnvironment & getEnv() { return *m_env; } ServerEnvironment & getEnv() { return *m_env; }
v3f findSpawnPos(); v3f findSpawnPos();

View File

@@ -6,6 +6,7 @@
#include "blockmodifier.h" #include "blockmodifier.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "server.h" #include "server.h"
#include "servermap.h"
#include "mapblock.h" #include "mapblock.h"
#include "nodedef.h" #include "nodedef.h"
#include "gamedef.h" #include "gamedef.h"

View File

@@ -9,6 +9,7 @@
#include "scripting_server.h" #include "scripting_server.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "settings.h"
PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_, PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
bool is_singleplayer): bool is_singleplayer):

View File

@@ -6,6 +6,7 @@
#include "inventory.h" #include "inventory.h"
#include "inventorymanager.h" #include "inventorymanager.h"
#include "constants.h" // BS #include "constants.h" // BS
#include "util/serialize.h"
#include "serverenvironment.h" #include "serverenvironment.h"
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos): ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):

View File

@@ -19,6 +19,7 @@
#include "remoteplayer.h" #include "remoteplayer.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "server.h" #include "server.h"
#include "servermap.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"

View File

@@ -4,30 +4,37 @@
#pragma once #pragma once
#include <memory> // std::unique_ptr
#include <set> #include <set>
#include <utility> #include <unordered_map>
#include <utility> // std::function
#include <vector>
#include "activeobject.h"
#include "environment.h" #include "environment.h"
#include "servermap.h"
#include "util/guid.h" #include "util/guid.h"
#include "map.h" #include "map.h" // MapEventReceiver
#include "settings.h"
#include "server/activeobjectmgr.h" #include "server/activeobjectmgr.h"
#include "server/blockmodifier.h" #include "server/blockmodifier.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "util/metricsbackend.h" #include "util/metricsbackend.h"
struct GameParams;
class RemotePlayer;
class PlayerDatabase;
class AuthDatabase; class AuthDatabase;
class ActiveObject;
class MetricsBackend;
class PlayerDatabase;
class PlayerSAO; class PlayerSAO;
class ServerEnvironment; class RemotePlayer;
struct StaticObject;
class ServerActiveObject;
class Server; class Server;
class ServerActiveObject;
class ServerEnvironment;
class ServerScripting; class ServerScripting;
class Settings;
struct ActiveObjectMessage;
struct GameParams;
struct StaticObject;
class ServerMap;
enum AccessDeniedCode : u8; enum AccessDeniedCode : u8;
typedef u16 session_t; typedef u16 session_t;

View File

@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LGPL-2.1-or-later // SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2024 celeron55, Perttu Ahola <celeron55@gmail.com> // Copyright (C) 2010-2024 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "servermap.h"
#include <algorithm> #include <algorithm>
#include "map.h" #include "map.h"
@@ -23,6 +25,7 @@
#include "mapgen/mg_biome.h" #include "mapgen/mg_biome.h"
#include "config.h" #include "config.h"
#include "server.h" #include "server.h"
#include "serverenvironment.h"
#include "database/database.h" #include "database/database.h"
#include "database/database-dummy.h" #include "database/database-dummy.h"
#include "database/database-sqlite3.h" #include "database/database-sqlite3.h"

View File

@@ -4,12 +4,15 @@
#pragma once #pragma once
#include "debug.h" // FATAL_ERROR
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include <string> #include "log.h"
#include <sstream>
#include <vector> #include <istream>
#include <map> #include <map>
#include "debug.h" #include <ostream>
#include <string>
#include <vector>
class ServerActiveObject; class ServerActiveObject;

View File

@@ -8,12 +8,12 @@
#include <numeric> #include <numeric>
#include "gamedef.h" #include "gamedef.h"
#include "inventory.h" // ItemStack
#include "dummygamedef.h" #include "dummygamedef.h"
#include "client/content_mapblock.h" #include "client/content_mapblock.h"
#include "client/mapblock_mesh.h" #include "client/mapblock_mesh.h"
#include "client/meshgen/collector.h" #include "client/meshgen/collector.h"
#include "mesh_compare.h" #include "mesh_compare.h"
#include "util/directiontables.h"
namespace { namespace {

View File

@@ -4,7 +4,9 @@
#include "test.h" #include "test.h"
#include "inventory.h" // ItemStack
#include "craftdef.h" #include "craftdef.h"
#include "itemdef.h"
class TestCraft : public TestBase class TestCraft : public TestBase
{ {

View File

@@ -7,6 +7,7 @@
#include "mock_inventorymanager.h" #include "mock_inventorymanager.h"
#include "mock_server.h" #include "mock_server.h"
#include "mock_serveractiveobject.h" #include "mock_serveractiveobject.h"
#include "servermap.h"
class TestMoveAction : public TestBase class TestMoveAction : public TestBase
{ {

View File

@@ -6,6 +6,8 @@
#include "mock_server.h" #include "mock_server.h"
#include "server/luaentity_sao.h" #include "server/luaentity_sao.h"
#include "serverenvironment.h"
#include "servermap.h"
#include "emerge.h" #include "emerge.h"
/* /*