mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Add support for packed clients (#802)
* First iteration of pack reader and interface * Fix memory leak and remove logs * Complete packed asset interface and begin on file loading replacement * Implement proper BinaryIO error * Improve AssetMemoryBuffer for reading and implement more reading * Repair more file loading code and improve how navmeshes are loaded * Missing checks implementation * Revert addition of Manifest class and migration changes * Resolved all feedback.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "BrickDatabase.h"
|
||||
#include "Game.h"
|
||||
#include "AssetManager.h"
|
||||
|
||||
std::vector<Brick> BrickDatabase::emptyCache{};
|
||||
BrickDatabase* BrickDatabase::m_Address = nullptr;
|
||||
@@ -17,7 +18,8 @@ std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
|
||||
return cached->second;
|
||||
}
|
||||
|
||||
std::ifstream file(lxfmlPath);
|
||||
AssetMemoryBuffer buffer = Game::assetManager->GetFileAsBuffer(("client/" + lxfmlPath).c_str());
|
||||
std::istream file(&buffer);
|
||||
if (!file.good()) {
|
||||
return emptyCache;
|
||||
}
|
||||
@@ -25,9 +27,12 @@ std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
|
||||
std::stringstream data;
|
||||
data << file.rdbuf();
|
||||
if (data.str().empty()) {
|
||||
buffer.close();
|
||||
return emptyCache;
|
||||
}
|
||||
|
||||
buffer.close();
|
||||
|
||||
auto* doc = new tinyxml2::XMLDocument();
|
||||
if (doc->Parse(data.str().c_str(), data.str().size()) != 0) {
|
||||
delete doc;
|
||||
|
Reference in New Issue
Block a user