about summary refs log tree commit diff stats
path: root/tools/validator
diff options
context:
space:
mode:
Diffstat (limited to 'tools/validator')
-rw-r--r--tools/validator/validator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index bc6b854..b33f602 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp
@@ -161,6 +161,11 @@ void ValidatePainting(const PaintingIdentifier& painting_identifier,
161 161
162void ValidatePanel(const PanelIdentifier& panel_identifier, 162void ValidatePanel(const PanelIdentifier& panel_identifier,
163 const PanelInfo& panel_info) { 163 const PanelInfo& panel_info) {
164 if (panel_identifier.name().empty()) {
165 std::cout << "Panel " << panel_identifier.ShortDebugString()
166 << " has no name." << std::endl;
167 }
168
164 if (panel_info.definitions.empty()) { 169 if (panel_info.definitions.empty()) {
165 std::cout << "Panel " << panel_identifier.ShortDebugString() 170 std::cout << "Panel " << panel_identifier.ShortDebugString()
166 << " has no definition, but was referenced:" << std::endl; 171 << " has no definition, but was referenced:" << std::endl;
t .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#ifndef TOOLS_UTIL_TSCN_H_
#define TOOLS_UTIL_TSCN_H_

#include <absl/strings/string_view.h>

#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <variant>

namespace com::fourisland::lingo2_archipelago {

struct GodotExtResource {
  std::string type;
  std::string path;
};

struct GodotExtResourceRef {
  std::string id;
};

using GodotInstanceType = std::variant<std::monostate, GodotExtResourceRef>;

class GodotNode {
 public:
  GodotNode(std::string name, GodotInstanceType instance_type)
      : name_(std::move(name)), instance_type_(std::move(instance_type)) {}

  const std::string& GetName() const { return name_; }

  const GodotInstanceType& GetInstanceType() const { return instance_type_; }

  const GodotNode* GetParent() const { return parent_; }
  GodotNode* GetParent() { return parent_; }

  std::string GetPath() const;

  void AddChild(GodotNode& child);

  const GodotNode* GetNode(absl::string_view path) const;
  GodotNode* GetNode(absl::string_view path);

  const std::map<std::string, GodotNode*> GetChildren() const {
    return children_;
  }

 private:
  std::string name_;
  GodotInstanceType instance_type_;

  GodotNode* parent_ = nullptr;
  std::map<std::string, GodotNode*> children_;
};

class GodotScene {
 public:
  virtual const GodotExtResource* GetExtResource(
      const std::string& id) const = 0;
  virtual const GodotNode& GetRoot() const = 0;
};

std::unique_ptr<GodotScene> ReadGodotSceneFromFile(const std::string& path);

}  // namespace com::fourisland::lingo2_archipelago

#endif /* TOOLS_UTIL_TSCN_H_ */