summaryrefslogtreecommitdiff
path: root/src/factories/LightsFactory.cpp
diff options
context:
space:
mode:
authorLywx <kiritodev01@gmail.com>2024-03-20 21:17:11 -0600
committerGitHub <noreply@github.com>2024-03-20 21:17:11 -0600
commitf0c70f855a892ca7dc21cee4b4037dad983adb8f (patch)
treef15cc271b00166476a2e7b780e50d911770a7316 /src/factories/LightsFactory.cpp
parent8465919ab7aba6cfde7d25ad1731673e5da01642 (diff)
Auto pad and overlap detection (#47)
* Fully implemented pad and overlap detection * Cleaned code, fixed pad generation and added alignment * Added debug size on pads
Diffstat (limited to 'src/factories/LightsFactory.cpp')
-rw-r--r--src/factories/LightsFactory.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/factories/LightsFactory.cpp b/src/factories/LightsFactory.cpp
index a14e12f..a26a17a 100644
--- a/src/factories/LightsFactory.cpp
+++ b/src/factories/LightsFactory.cpp
@@ -4,18 +4,19 @@
#include "spdlog/spdlog.h"
#include "Companion.h"
-void LightsHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
+ExportResult LightsHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
const auto symbol = GetSafeNode(node, "symbol", entryName);
if(Companion::Instance->IsOTRMode()){
write << "static const char " << symbol << "[] = \"__OTR__" << (*replacement) << "\";\n\n";
- return;
+ return std::nullopt;
}
write << "extern Lights1 " << symbol << ";\n";
+ return std::nullopt;
}
-void LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto light = std::static_pointer_cast<LightsData>(raw)->mLights;
auto symbol = GetSafeNode(node, "symbol", entryName);
@@ -44,9 +45,10 @@ void LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData
write << r2 << ", " << g2 << ", " << b2 << ", " << x << ", " << y << ", " << z << "\n";
write << ");\n\n";
+ return std::nullopt;
}
-void LightsBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult LightsBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto light = std::static_pointer_cast<LightsData>(raw)->mLights;
auto writer = LUS::BinaryWriter();
auto size = sizeof(light.l) / sizeof(LightRaw);
@@ -65,6 +67,7 @@ void LightsBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedDa
}
writer.Finish(write);
writer.Close();
+ return std::nullopt;
}
std::optional<std::shared_ptr<IParsedData>> LightsFactory::parse(std::vector<uint8_t>& buffer, YAML::Node& node) {