mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Convert BrickDatabase to namespace (#1142)
* Convert BrickDatabase to namespace This did not need to be a class. * Fix linker errors * convert to anonymous namespace so the cache is unmodifiable outside the brickcache * Move to lower scope level and remove log
This commit is contained in:
@@ -5,14 +5,12 @@
|
||||
#include "Game.h"
|
||||
#include "AssetManager.h"
|
||||
#include "tinyxml2.h"
|
||||
#include "Brick.h"
|
||||
|
||||
std::vector<Brick> BrickDatabase::emptyCache{};
|
||||
BrickDatabase* BrickDatabase::m_Address = nullptr;
|
||||
const BrickList& BrickDatabase::GetBricks(const LxfmlPath& lxfmlPath) {
|
||||
static std::unordered_map<LxfmlPath, BrickList> m_Cache;
|
||||
static const BrickList emptyCache;
|
||||
|
||||
BrickDatabase::BrickDatabase() = default;
|
||||
BrickDatabase::~BrickDatabase() = default;
|
||||
|
||||
std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
|
||||
const auto cached = m_Cache.find(lxfmlPath);
|
||||
|
||||
if (cached != m_Cache.end()) {
|
||||
@@ -45,7 +43,7 @@ std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
|
||||
return emptyCache;
|
||||
}
|
||||
|
||||
std::vector<Brick> parts;
|
||||
BrickList parts;
|
||||
|
||||
auto* lxfml = doc->FirstChildElement("LXFML");
|
||||
auto* bricks = lxfml->FirstChildElement("Bricks");
|
||||
|
Reference in New Issue
Block a user