mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
fix(gameplay): use inline const for static EMPTY members
Use inline const for static EMPTY members to avoid ODR and linker issues. Add missing block_manager.hpp includes in gameplay sources.
This commit is contained in:
@@ -34,7 +34,7 @@ private:
|
|||||||
using IDMap = tbb::concurrent_hash_map<std::string, BlockType>;
|
using IDMap = tbb::concurrent_hash_map<std::string, BlockType>;
|
||||||
using CrossPlaneMap = tbb::concurrent_hash_map<BlockType, BlockType>;
|
using CrossPlaneMap = tbb::concurrent_hash_map<BlockType, BlockType>;
|
||||||
|
|
||||||
static const BlockData EMPTY;
|
static inline const BlockData EMPTY;
|
||||||
|
|
||||||
static inline BlockMap m_datas;
|
static inline BlockMap m_datas;
|
||||||
static inline IDMap m_id_map;
|
static inline IDMap m_id_map;
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ private:
|
|||||||
IDMap m_id_map;
|
IDMap m_id_map;
|
||||||
BlockToIDMap m_block_to_id_map;
|
BlockToIDMap m_block_to_id_map;
|
||||||
|
|
||||||
static constexpr ItemData EMPTY;
|
static inline const ItemData EMPTY;
|
||||||
};
|
};
|
||||||
} // namespace Cubed
|
} // namespace Cubed
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Cubed/gameplay/chunk_generator.hpp"
|
#include "Cubed/gameplay/chunk_generator.hpp"
|
||||||
|
|
||||||
|
#include "Cubed/gameplay/block_manager.hpp"
|
||||||
#include "Cubed/gameplay/builders/desert_builder.hpp"
|
#include "Cubed/gameplay/builders/desert_builder.hpp"
|
||||||
#include "Cubed/gameplay/builders/forest_builder.hpp"
|
#include "Cubed/gameplay/builders/forest_builder.hpp"
|
||||||
#include "Cubed/gameplay/builders/mountain_builder.hpp"
|
#include "Cubed/gameplay/builders/mountain_builder.hpp"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Cubed/gameplay/client_chunk.hpp"
|
#include "Cubed/gameplay/client_chunk.hpp"
|
||||||
|
|
||||||
|
#include "Cubed/gameplay/block_manager.hpp"
|
||||||
namespace Cubed {
|
namespace Cubed {
|
||||||
using OptionalBlockVectorArray =
|
using OptionalBlockVectorArray =
|
||||||
std::array<std::optional<std::vector<BlockType>>, 4>;
|
std::array<std::optional<std::vector<BlockType>>, 4>;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "Cubed/gameplay/client_player_manager.hpp"
|
#include "Cubed/gameplay/client_player_manager.hpp"
|
||||||
|
|
||||||
|
#include "Cubed/gameplay/block_manager.hpp"
|
||||||
#include "Cubed/gameplay/client_world.hpp"
|
#include "Cubed/gameplay/client_world.hpp"
|
||||||
#include "Cubed/gameplay/hitbox_manager.hpp"
|
#include "Cubed/gameplay/hitbox_manager.hpp"
|
||||||
#include "Cubed/tools/math_tools.hpp"
|
#include "Cubed/tools/math_tools.hpp"
|
||||||
|
|
||||||
using namespace google::protobuf;
|
using namespace google::protobuf;
|
||||||
|
|
||||||
namespace Cubed {
|
namespace Cubed {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "Cubed/gameplay/client_world.hpp"
|
#include "Cubed/gameplay/client_world.hpp"
|
||||||
|
|
||||||
#include "Cubed/config.hpp"
|
#include "Cubed/config.hpp"
|
||||||
|
#include "Cubed/gameplay/block_manager.hpp"
|
||||||
#include "Cubed/gameplay/chunk_generator.hpp"
|
#include "Cubed/gameplay/chunk_generator.hpp"
|
||||||
#include "Cubed/gameplay/game_time.hpp"
|
#include "Cubed/gameplay/game_time.hpp"
|
||||||
#include "Cubed/gameplay/packet.hpp"
|
#include "Cubed/gameplay/packet.hpp"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ ItemManager::ItemManager() {}
|
|||||||
|
|
||||||
ItemManager& ItemManager::instance() {
|
ItemManager& ItemManager::instance() {
|
||||||
static ItemManager inst;
|
static ItemManager inst;
|
||||||
|
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Cubed/gameplay/server_world.hpp"
|
#include "Cubed/gameplay/server_world.hpp"
|
||||||
|
|
||||||
|
#include "Cubed/gameplay/block_manager.hpp"
|
||||||
#include "Cubed/gameplay/packet.hpp"
|
#include "Cubed/gameplay/packet.hpp"
|
||||||
#include "Cubed/gameplay/session.hpp"
|
#include "Cubed/gameplay/session.hpp"
|
||||||
#include "Cubed/tools/cubed_assert.hpp"
|
#include "Cubed/tools/cubed_assert.hpp"
|
||||||
|
|||||||
Reference in New Issue
Block a user