mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-10 03:55:20 +01:00
Break include chains and tidy (part 2)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "config.h"
|
||||
#include "map.h"
|
||||
#include "clientmap.h" // MapDrawControl
|
||||
#include "localplayer.h"
|
||||
#include "player.h"
|
||||
#include <cmath>
|
||||
#include "client/renderingengine.h"
|
||||
@@ -22,9 +23,12 @@
|
||||
#include "fontengine.h"
|
||||
#include "script/scripting_client.h"
|
||||
#include "gettext.h"
|
||||
#include <SViewFrustum.h>
|
||||
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <IGUIFont.h>
|
||||
#include <ISceneNode.h>
|
||||
#include <IVideoDriver.h>
|
||||
#include <SViewFrustum.h>
|
||||
|
||||
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):
|
||||
m_draw_control(draw_control),
|
||||
m_client(client),
|
||||
m_camera_mode(CAMERA_MODE_FIRST),
|
||||
m_player_light_color(0xFFFFFFFF)
|
||||
{
|
||||
auto smgr = rendering_engine->get_scene_manager();
|
||||
@@ -92,6 +97,11 @@ Camera::~Camera()
|
||||
m_wieldmgr->drop();
|
||||
}
|
||||
|
||||
v3f Camera::getHeadPosition() const
|
||||
{
|
||||
return m_headnode->getAbsolutePosition();
|
||||
}
|
||||
|
||||
void Camera::notifyFovChange()
|
||||
{
|
||||
LocalPlayer *player = m_client->getEnv().getLocalPlayer();
|
||||
@@ -626,6 +636,16 @@ void Camera::drawWieldedTool(core::matrix4* translation)
|
||||
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()
|
||||
{
|
||||
core::matrix4 trans = m_cameranode->getProjectionMatrix();
|
||||
|
||||
@@ -5,11 +5,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "irrlichttypes.h"
|
||||
#include "inventory.h"
|
||||
#include "inventory.h" // ItemStack
|
||||
#include "util/numeric.h"
|
||||
#include "client/localplayer.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <ISceneNode.h>
|
||||
#include <plane3d.h>
|
||||
#include <array>
|
||||
#include <list>
|
||||
@@ -21,6 +18,14 @@ class Client;
|
||||
class RenderingEngine;
|
||||
class WieldMeshSceneNode;
|
||||
|
||||
enum CameraMode : int;
|
||||
|
||||
namespace scene {
|
||||
class ICameraSceneNode;
|
||||
class ISceneManager;
|
||||
class ISceneNode;
|
||||
};
|
||||
|
||||
struct Nametag
|
||||
{
|
||||
scene::ISceneNode *parent_node = nullptr;
|
||||
@@ -75,10 +80,7 @@ public:
|
||||
}
|
||||
|
||||
// Returns the absolute position of the head SceneNode in the world
|
||||
inline v3f getHeadPosition() const
|
||||
{
|
||||
return m_headnode->getAbsolutePosition();
|
||||
}
|
||||
v3f getHeadPosition() const;
|
||||
|
||||
// Get the camera direction (in absolute camera coordinates).
|
||||
// This has view bobbing applied.
|
||||
@@ -156,15 +158,7 @@ public:
|
||||
void drawWieldedTool(core::matrix4* translation=NULL);
|
||||
|
||||
// Toggle the current camera mode
|
||||
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;
|
||||
}
|
||||
void toggleCameraMode();
|
||||
|
||||
// Set the current camera mode
|
||||
inline void setCameraMode(CameraMode mode)
|
||||
@@ -255,7 +249,7 @@ private:
|
||||
f32 m_wield_change_timer = 0.125f;
|
||||
ItemStack m_wield_item_next;
|
||||
|
||||
CameraMode m_camera_mode = CAMERA_MODE_FIRST;
|
||||
CameraMode m_camera_mode;
|
||||
|
||||
f32 m_cache_view_bobbing_amount;
|
||||
bool m_arm_inertia;
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
#include "client/sound.h"
|
||||
#include "client/texturepaths.h"
|
||||
#include "client/texturesource.h"
|
||||
#include "camera.h"
|
||||
#include "filesys.h"
|
||||
#include "game.h"
|
||||
#include "gettext.h"
|
||||
#include "gettime.h"
|
||||
#include "guiscalingfilter.h"
|
||||
#include "item_visuals_manager.h"
|
||||
#include "itemdef.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapblock_mesh.h"
|
||||
#include "mapnode.h"
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
#include "client/mesh.h"
|
||||
#include "mapblock_mesh.h"
|
||||
#include <IMaterialRenderer.h>
|
||||
#include <ISceneManager.h>
|
||||
#include <IVideoDriver.h>
|
||||
#include <matrix4.h>
|
||||
#include "mapsector.h"
|
||||
#include "mapblock.h"
|
||||
#include "nodedef.h"
|
||||
#include "player.h" // CameraMode
|
||||
#include "profiler.h"
|
||||
#include "settings.h"
|
||||
#include "camera.h" // CameraModes
|
||||
#include "camera.h"
|
||||
#include "util/basic_macros.h"
|
||||
#include "util/tracy_wrapper.h"
|
||||
#include "client/renderingengine.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include "map.h"
|
||||
#include "camera.h"
|
||||
#include <ISceneNode.h>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
@@ -23,6 +23,9 @@ struct MapDrawControl
|
||||
};
|
||||
|
||||
class Client;
|
||||
class RenderingEngine;
|
||||
|
||||
enum CameraMode : int;
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "texturesource.h"
|
||||
#include "gui/mainmenumanager.h"
|
||||
#include "gui/profilergraph.h"
|
||||
#include "localplayer.h"
|
||||
#include "minimap.h"
|
||||
#include "nodedef.h" // Needed for determining pointing to nodes
|
||||
#include "nodemetadata.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#include "script/scripting_client.h"
|
||||
#include "hud.h"
|
||||
#include <AnimatedMeshSceneNode.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include "util/tracy_wrapper.h"
|
||||
#include "item_visuals_manager.h"
|
||||
|
||||
@@ -2080,6 +2082,12 @@ f32 Game::getSensitivityScaleFactor() const
|
||||
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)
|
||||
{
|
||||
if (g_touchcontrols) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "gui/guiPasswordChange.h"
|
||||
#include "gui/guiOpenURL.h"
|
||||
#include "gui/guiVolumeChange.h"
|
||||
#include "localplayer.h"
|
||||
|
||||
/*
|
||||
Text input system
|
||||
|
||||
@@ -380,11 +380,7 @@ private:
|
||||
bool m_is_paused = false;
|
||||
|
||||
bool m_touch_simulate_aux1 = false;
|
||||
inline bool isTouchShootlineUsed()
|
||||
{
|
||||
return g_touchcontrols && g_touchcontrols->isShootlineAvailable() &&
|
||||
camera->getCameraMode() == CAMERA_MODE_FIRST;
|
||||
}
|
||||
bool isTouchShootlineUsed() const;
|
||||
#ifdef __ANDROID__
|
||||
bool m_android_chat_open;
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "fontengine.h"
|
||||
#include "hud.h" // HUD_FLAG_*
|
||||
#include "nodedef.h"
|
||||
#include "localplayer.h"
|
||||
#include "profiler.h"
|
||||
#include "renderingengine.h"
|
||||
#include "version.h"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "util/enriched_string.h"
|
||||
#include "irrlicht_changes/CGUITTFont.h"
|
||||
#include "gui/drawItemStack.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
|
||||
#define OBJECT_CROSSHAIR_LINE_SIZE 8
|
||||
#define CROSSHAIR_LINE_SIZE 10
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "player.h"
|
||||
#include "environment.h"
|
||||
#include "constants.h"
|
||||
#include "lighting.h"
|
||||
#include <string>
|
||||
|
||||
class Client;
|
||||
class ClientActiveObject;
|
||||
class Environment;
|
||||
class GenericCAO;
|
||||
class ClientActiveObject;
|
||||
class Map;
|
||||
struct CollisionInfo;
|
||||
struct collisionMoveResult;
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
|
||||
#include "minimap.h"
|
||||
#include <cmath>
|
||||
#include "camera.h"
|
||||
#include "client.h"
|
||||
#include "clientmap.h"
|
||||
#include "mapblock.h" // getNodeBlockPos
|
||||
#include "settings.h"
|
||||
#include "shader.h"
|
||||
#include "mapblock.h"
|
||||
#include "client/renderingengine.h"
|
||||
#include "client/texturesource.h"
|
||||
#include "gettext.h"
|
||||
#include "voxel.h"
|
||||
|
||||
////
|
||||
//// MinimapUpdateThread
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "plain.h"
|
||||
#include "secondstage.h"
|
||||
#include "settings.h"
|
||||
#include "client/camera.h"
|
||||
#include "client/client.h"
|
||||
#include "client/clientmap.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "client/camera.h"
|
||||
#include "constants.h"
|
||||
#include "settings.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
|
||||
OffsetCameraStep::OffsetCameraStep(float eye_offset)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "client/clientenvironment.h"
|
||||
#include "client/clientmap.h"
|
||||
#include "client/camera.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <IVideoDriver.h>
|
||||
|
||||
using m4f = core::matrix4;
|
||||
|
||||
@@ -3,22 +3,26 @@
|
||||
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
// Copyright (C) 2020 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
|
||||
|
||||
#include <cmath>
|
||||
#include "sky.h"
|
||||
#include <ITexture.h>
|
||||
#include <IVideoDriver.h>
|
||||
#include <ISceneManager.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <S3DVertex.h>
|
||||
|
||||
#include "camera.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/texturesource.h"
|
||||
#include "client/tile.h"
|
||||
#include "noise.h" // easeCurve
|
||||
#include "player.h" // CameraMode
|
||||
#include "profiler.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;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <queue>
|
||||
#include "gamedef.h"
|
||||
#include "inventory.h"
|
||||
#include "itemdef.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/string.h"
|
||||
#include "util/numeric.h"
|
||||
@@ -274,6 +275,12 @@ std::string craftDumpMatrix(const std::vector<ItemStack> &items,
|
||||
CraftInput
|
||||
*/
|
||||
|
||||
CraftInput::CraftInput(CraftMethod method_, unsigned int width_,
|
||||
const std::vector<ItemStack> &items_):
|
||||
method(method_), width(width_), items(items_)
|
||||
{
|
||||
}
|
||||
|
||||
bool CraftInput::empty() const
|
||||
{
|
||||
for (const auto &item : items) {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include "gamedef.h"
|
||||
#include "inventory.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct ItemStack;
|
||||
|
||||
/*
|
||||
Crafting methods.
|
||||
@@ -61,9 +61,7 @@ struct CraftInput
|
||||
CraftInput() = default;
|
||||
|
||||
CraftInput(CraftMethod method_, unsigned int width_,
|
||||
const std::vector<ItemStack> &items_):
|
||||
method(method_), width(width_), items(items_)
|
||||
{}
|
||||
const std::vector<ItemStack> &items_);
|
||||
|
||||
// Returns true if all items are empty.
|
||||
bool empty() const;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "irrlicht_changes/printing.h"
|
||||
#include "filesys.h"
|
||||
#include "log.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapgen/mg_biome.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "raycast.h"
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "settings.h"
|
||||
#include "daynightratio.h"
|
||||
#include "emerge.h"
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "client/client.h"
|
||||
#include "porting.h"
|
||||
#include "inventory.h"
|
||||
#include "itemdef.h"
|
||||
#include "client/mesh.h"
|
||||
#include "client/wieldmesh.h"
|
||||
#include "client/texturesource.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "guiFormSpecMenu.h"
|
||||
#include "EGUIElementTypes.h"
|
||||
#include "constants.h"
|
||||
#include "itemdef.h"
|
||||
#include "gamedef.h"
|
||||
#include "client/keycode.h"
|
||||
#include "gui/guiTable.h"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "util/strfnd.h"
|
||||
#include "content_mapnode.h" // For loading legacy MaterialItems
|
||||
#include "nameidmapping.h" // For loading legacy MaterialItems
|
||||
#include "itemdef.h"
|
||||
#include "util/serialize.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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// If the item is empty or the position invalid, bail out
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "itemdef.h"
|
||||
#include "irrlichttypes.h"
|
||||
#include "itemstackmetadata.h"
|
||||
#include <istream>
|
||||
@@ -13,6 +12,8 @@
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
struct ItemDefinition;
|
||||
struct ItemImageDef;
|
||||
struct ToolCapabilities;
|
||||
|
||||
struct ItemStack
|
||||
@@ -73,10 +74,7 @@ struct ItemStack
|
||||
}
|
||||
|
||||
// Maximum size of a stack
|
||||
u16 getStackMax(const IItemDefManager *itemdef) const
|
||||
{
|
||||
return itemdef->get(name).stack_max;
|
||||
}
|
||||
u16 getStackMax(const IItemDefManager *itemdef) const;
|
||||
|
||||
// Number of items that can be added to this stack
|
||||
u16 freeSpace(const IItemDefManager *itemdef) const
|
||||
@@ -88,75 +86,24 @@ struct ItemStack
|
||||
}
|
||||
|
||||
// Returns false if item is not known and cannot be used
|
||||
bool isKnown(const IItemDefManager *itemdef) const
|
||||
{
|
||||
return itemdef->isKnown(name);
|
||||
}
|
||||
bool isKnown(const IItemDefManager *itemdef) const;
|
||||
|
||||
// Returns a pointer to the item definition struct,
|
||||
// or a fallback one (name="unknown") if the item is unknown.
|
||||
const ItemDefinition& getDefinition(
|
||||
const IItemDefManager *itemdef) const
|
||||
{
|
||||
return itemdef->get(name);
|
||||
}
|
||||
const ItemDefinition &getDefinition(
|
||||
const IItemDefManager *itemdef) const;
|
||||
|
||||
// Get tool digging properties, or those of the hand if not a tool
|
||||
// If not hand assumes default hand ""
|
||||
const ToolCapabilities& getToolCapabilities(
|
||||
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 ToolCapabilities &getToolCapabilities(
|
||||
const IItemDefManager *itemdef, const ItemStack *hand = nullptr) const;
|
||||
|
||||
const std::optional<WearBarParams> &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;
|
||||
}
|
||||
const IItemDefManager *itemdef) const;
|
||||
|
||||
// Wear out (only tools)
|
||||
// Returns true if the item is (was) a tool
|
||||
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;
|
||||
}
|
||||
bool addWear(s32 amount, const IItemDefManager *itemdef);
|
||||
|
||||
// If possible, adds newitem to this item.
|
||||
// If cannot be added at all, returns the item back.
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include "player.h"
|
||||
#include "porting.h"
|
||||
#include "serialization.h" // SER_FMT_VER_HIGHEST_*
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "settings.h"
|
||||
#include "network/socket.h"
|
||||
#include "mapblock.h"
|
||||
#if USE_CURSES
|
||||
|
||||
12
src/map.h
12
src/map.h
@@ -4,22 +4,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapblock.h" // for forEachNodeInArea
|
||||
#include "mapnode.h"
|
||||
#include "constants.h"
|
||||
#include "voxel.h"
|
||||
#include "modifiedstate.h"
|
||||
#include "util/numeric.h"
|
||||
#include "nodetimer.h"
|
||||
#include "debug.h"
|
||||
#include "util/numeric.h" // for forEachNodeInArea
|
||||
|
||||
class MapSector;
|
||||
class NodeMetadata;
|
||||
class NodeTimer;
|
||||
class IGameDef;
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "settings.h"
|
||||
#include "settings.h" // SettingsHierarchy
|
||||
|
||||
struct NoiseParams;
|
||||
struct MapgenParams;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "client/mapblock_mesh.h"
|
||||
#endif
|
||||
#include "porting.h"
|
||||
#include "settings.h"
|
||||
#include "util/string.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/basic_macros.h"
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
#include "exceptions.h"
|
||||
#include "constants.h"
|
||||
#include "staticobject.h"
|
||||
#include "nodemetadata.h"
|
||||
#include "nodemetadata.h" // NodeMetadataList
|
||||
#include "nodetimer.h"
|
||||
#include "modifiedstate.h"
|
||||
#include "util/numeric.h" // getContainerPos
|
||||
#include "settings.h"
|
||||
|
||||
class Map;
|
||||
class NodeMetadataList;
|
||||
class IGameDef;
|
||||
class MapBlockMesh;
|
||||
class VoxelManipulator;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "util/numeric.h"
|
||||
#include "util/serialize.h"
|
||||
#include "serialization.h"
|
||||
#include "servermap.h"
|
||||
#include "filesys.h"
|
||||
#include "voxelalgorithms.h"
|
||||
#include "porting.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "servermap.h"
|
||||
#include "mapsector.h"
|
||||
#include "client/minimap.h"
|
||||
#include "itemdef.h"
|
||||
#include "modchannels.h"
|
||||
#include "nodedef.h"
|
||||
#include "serialization.h"
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
#include "chatmessage.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "log.h"
|
||||
#include "emerge.h"
|
||||
#include "itemdef.h"
|
||||
#include "mapblock.h"
|
||||
#include "modchannels.h"
|
||||
#include "nodedef.h"
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include "inventory.h"
|
||||
#include "constants.h"
|
||||
#include "util/basic_macros.h"
|
||||
#include "util/string.h"
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#define PLAYERNAME_SIZE 20
|
||||
|
||||
@@ -125,7 +124,7 @@ struct PlayerPhysicsOverride
|
||||
};
|
||||
|
||||
/// @note numeric values are part of network protocol
|
||||
enum CameraMode {
|
||||
enum CameraMode : int {
|
||||
// not a mode. indicates that any may be used.
|
||||
CAMERA_MODE_ANY = 0,
|
||||
CAMERA_MODE_FIRST,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "constants.h" // PEER_ID_INEXISTENT
|
||||
#include "player.h"
|
||||
#include "skyparams.h"
|
||||
#include "lighting.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "util/numeric.h"
|
||||
#include "map.h"
|
||||
#include "gamedef.h"
|
||||
#include "itemdef.h"
|
||||
#include "nodedef.h"
|
||||
#include "nodemetadata.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
@@ -16,6 +16,7 @@ extern "C" {
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "filesys.h"
|
||||
#include "settings.h"
|
||||
#include "porting.h"
|
||||
#include "common/c_internal.h"
|
||||
#include "common/c_packer.h"
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "cpp_api/s_internal.h"
|
||||
#include "common/c_converter.h"
|
||||
#include "log.h"
|
||||
#include "environment.h"
|
||||
#include "mapgen/mapgen.h"
|
||||
#include "lua_api/l_env.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "scripting_server.h"
|
||||
#include "script/common/c_content.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "common/c_content.h"
|
||||
#include "cpp_api/s_base.h"
|
||||
#include "server.h"
|
||||
#include "environment.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "database/database.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "client/content_cao.h"
|
||||
#include "client/camera.h"
|
||||
#include "client/client.h"
|
||||
#include "client/localplayer.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
|
||||
LuaCamera::LuaCamera(Camera *m) : m_camera(m)
|
||||
{
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include "common/c_converter.h"
|
||||
#include "common/c_content.h"
|
||||
#include "scripting_server.h"
|
||||
#include "environment.h"
|
||||
#include "mapblock.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "nodedef.h"
|
||||
#include "daynightratio.h"
|
||||
#include "util/pointedthing.h"
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "pathfinder.h"
|
||||
#include "face_position_cache.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "servermap.h"
|
||||
#include "server/luaentity_sao.h"
|
||||
#include "server/player_sao.h"
|
||||
#include "util/string.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "l_internal.h"
|
||||
#include "common/c_content.h"
|
||||
#include "gui/guiEngine.h"
|
||||
#include "sound.h"
|
||||
|
||||
/* ModApiMainMenuSound */
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
#include "cpp_api/s_security.h"
|
||||
#include "util/serialize.h"
|
||||
#include "server.h"
|
||||
#include "environment.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "emerge_internal.h"
|
||||
#include "map_settings_manager.h"
|
||||
#include "mapgen/mg_biome.h"
|
||||
#include "mapgen/mg_ore.h"
|
||||
#include "mapgen/mg_decoration.h"
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "lua_api/l_nodetimer.h"
|
||||
#include "lua_api/l_internal.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "map.h"
|
||||
|
||||
#include "servermap.h"
|
||||
|
||||
int NodeTimerRef::gc_object(lua_State *L) {
|
||||
NodeTimerRef *o = *(NodeTimerRef **)(lua_touserdata(L, 1));
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "tool.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "settings.h"
|
||||
#include "hud.h"
|
||||
#include "scripting_server.h"
|
||||
#include "server/luaentity_sao.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "common/c_converter.h"
|
||||
#include "common/c_content.h"
|
||||
#include "server.h"
|
||||
#include "server/serveractiveobject.h"
|
||||
#include "particles.h"
|
||||
|
||||
namespace LuaParticleParams
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#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"
|
||||
@@ -18,6 +17,7 @@
|
||||
#include "remoteplayer.h"
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#include "common/c_content.h"
|
||||
#include "common/c_converter.h"
|
||||
#include "common/c_packer.h"
|
||||
#include "environment.h"
|
||||
#include "map.h"
|
||||
#include "mapblock.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "voxelalgorithms.h"
|
||||
|
||||
// garbage collector
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "profiler.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "server/ban.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "server/player_sao.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()
|
||||
{
|
||||
ServerMap &map = m_env->getServerMap();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "network/peerhandler.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/basic_macros.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "util/metricsbackend.h"
|
||||
#include "server/clientiface.h"
|
||||
#include "threading/ordered_mutex.h"
|
||||
#include "translation.h"
|
||||
@@ -48,11 +48,13 @@ class ServerInventoryManager;
|
||||
class ServerModManager;
|
||||
class ServerScripting;
|
||||
class ServerThread;
|
||||
class Settings;
|
||||
|
||||
struct ChatEventChat;
|
||||
struct ChatInterface;
|
||||
struct ChatMessage;
|
||||
struct CloudParams;
|
||||
struct GameParams;
|
||||
struct Lighting;
|
||||
struct MoonParams;
|
||||
struct PackedValue;
|
||||
@@ -364,7 +366,7 @@ public:
|
||||
void addShutdownError(const ModError &e);
|
||||
|
||||
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; }
|
||||
v3f findSpawnPos();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "blockmodifier.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "server.h"
|
||||
#include "servermap.h"
|
||||
#include "mapblock.h"
|
||||
#include "nodedef.h"
|
||||
#include "gamedef.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "settings.h"
|
||||
|
||||
PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
|
||||
bool is_singleplayer):
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "inventory.h"
|
||||
#include "inventorymanager.h"
|
||||
#include "constants.h" // BS
|
||||
#include "util/serialize.h"
|
||||
#include "serverenvironment.h"
|
||||
|
||||
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "remoteplayer.h"
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "servermap.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/numeric.h"
|
||||
#include "util/basic_macros.h"
|
||||
|
||||
@@ -4,30 +4,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory> // std::unique_ptr
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <unordered_map>
|
||||
#include <utility> // std::function
|
||||
#include <vector>
|
||||
|
||||
#include "activeobject.h"
|
||||
#include "environment.h"
|
||||
#include "servermap.h"
|
||||
#include "util/guid.h"
|
||||
#include "map.h"
|
||||
#include "settings.h"
|
||||
#include "map.h" // MapEventReceiver
|
||||
#include "server/activeobjectmgr.h"
|
||||
#include "server/blockmodifier.h"
|
||||
#include "util/numeric.h"
|
||||
#include "util/metricsbackend.h"
|
||||
|
||||
struct GameParams;
|
||||
class RemotePlayer;
|
||||
class PlayerDatabase;
|
||||
class AuthDatabase;
|
||||
class ActiveObject;
|
||||
class MetricsBackend;
|
||||
class PlayerDatabase;
|
||||
class PlayerSAO;
|
||||
class ServerEnvironment;
|
||||
struct StaticObject;
|
||||
class ServerActiveObject;
|
||||
class RemotePlayer;
|
||||
class Server;
|
||||
class ServerActiveObject;
|
||||
class ServerEnvironment;
|
||||
class ServerScripting;
|
||||
class Settings;
|
||||
struct ActiveObjectMessage;
|
||||
struct GameParams;
|
||||
struct StaticObject;
|
||||
|
||||
class ServerMap;
|
||||
|
||||
enum AccessDeniedCode : u8;
|
||||
typedef u16 session_t;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2010-2024 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "servermap.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "map.h"
|
||||
@@ -23,6 +25,7 @@
|
||||
#include "mapgen/mg_biome.h"
|
||||
#include "config.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "database/database.h"
|
||||
#include "database/database-dummy.h"
|
||||
#include "database/database-sqlite3.h"
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "debug.h" // FATAL_ERROR
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include "log.h"
|
||||
|
||||
#include <istream>
|
||||
#include <map>
|
||||
#include "debug.h"
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ServerActiveObject;
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#include <numeric>
|
||||
|
||||
#include "gamedef.h"
|
||||
#include "inventory.h" // ItemStack
|
||||
#include "dummygamedef.h"
|
||||
#include "client/content_mapblock.h"
|
||||
#include "client/mapblock_mesh.h"
|
||||
#include "client/meshgen/collector.h"
|
||||
#include "mesh_compare.h"
|
||||
#include "util/directiontables.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "inventory.h" // ItemStack
|
||||
#include "craftdef.h"
|
||||
#include "itemdef.h"
|
||||
|
||||
class TestCraft : public TestBase
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "mock_inventorymanager.h"
|
||||
#include "mock_server.h"
|
||||
#include "mock_serveractiveobject.h"
|
||||
#include "servermap.h"
|
||||
|
||||
class TestMoveAction : public TestBase
|
||||
{
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "mock_server.h"
|
||||
#include "server/luaentity_sao.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "servermap.h"
|
||||
#include "emerge.h"
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user