Working on web version

This commit is contained in:
Vladislav Khorev committed 2026-04-17 16:13:56 +03:00
1 parent 3d3c3b2a36
commit e310822462
20 files changed
+432 -328

No files matched your search

+22 -4
View File
@@ -3,6 +3,11 @@
#include "utils/Utils.h"
#include <iostream>
namespace ZL
{
extern const char* CONST_ZIP_FILE;
}
namespace ZL::Dialogue {
NodeType DialogueDatabase::parseNodeType(const std::string& value) {
@@ -202,10 +207,23 @@ bool DialogueDatabase::loadFromFile(const std::string& path) {
dialogues.clear();
cutscenes.clear();
const std::string raw = ZL::readTextFile(path);
if (raw.empty()) {
std::cerr << "[dialogue] Failed to read file: " << path << "\n";
return false;
std::string raw;
try {
if (strlen(CONST_ZIP_FILE) == 0) {
raw = readTextFile(path);
}
else {
auto buf = readFileFromZIP(path, CONST_ZIP_FILE);
if (buf.empty()) {
std::cerr << "UiManager: failed to read " << path << " from zip " << CONST_ZIP_FILE << std::endl;
throw std::runtime_error("Failed to load UI file: " + path);
}
raw.assign(buf.begin(), buf.end());
}
}
catch (const std::exception& e) {
std::cerr << "UiManager: failed to open " << path << " : " << e.what() << std::endl;
throw std::runtime_error("Failed to load UI file: " + path);
}
json root;