fix modinfo impl ctor being broken

This commit is contained in:
altalk23 2023-02-08 20:52:54 +03:00
parent a567e93431
commit 4ecc4ac23a
2 changed files with 10 additions and 10 deletions

View file

@ -3692,7 +3692,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate {
bool m_previewMode; bool m_previewMode;
GJGroundLayer* m_groundLayer; GJGroundLayer* m_groundLayer;
std::string m_rawLevelString; std::string m_rawLevelString;
void* m_triggerHitbox; void* m_triggerHitbox; // why are these std vector bruh
std::vector<GameObject*> m_objectVector; std::vector<GameObject*> m_objectVector;
std::vector<GameObject*> m_groupVector; std::vector<GameObject*> m_groupVector;
std::vector<cocos2d::CCArray*> m_nestedObjects; std::vector<cocos2d::CCArray*> m_nestedObjects;

View file

@ -42,7 +42,7 @@ public:
bool m_needsEarlyLoad = false; bool m_needsEarlyLoad = false;
bool m_isAPI = false; bool m_isAPI = false;
std::shared_ptr<ModJson> m_rawJSON; ModJson m_rawJSON;
static Result<ModInfo> createFromGeodeZip(utils::file::Unzip& zip); static Result<ModInfo> createFromGeodeZip(utils::file::Unzip& zip);
static Result<ModInfo> createFromGeodeFile(ghc::filesystem::path const& path); static Result<ModInfo> createFromGeodeFile(ghc::filesystem::path const& path);
@ -80,9 +80,9 @@ Result<ModInfo> ModInfo::Impl::createFromSchemaV010(ModJson const& rawJson) {
auto impl = info.m_impl.get(); auto impl = info.m_impl.get();
impl->m_rawJSON = std::make_unique<ModJson>(rawJson); impl->m_rawJSON = rawJson;
JsonChecker checker(*impl->m_rawJSON); JsonChecker checker(impl->m_rawJSON);
auto root = checker.root("[mod.json]").obj(); auto root = checker.root("[mod.json]").obj();
root.addKnownKey("geode"); root.addKnownKey("geode");
@ -189,7 +189,7 @@ Result<ModInfo> ModInfo::Impl::create(ModJson const& json) {
// Handle mod.json data based on target // Handle mod.json data based on target
if (schema >= VersionInfo(0, 1, 0)) { if (schema >= VersionInfo(0, 1, 0)) {
return ModInfo::createFromSchemaV010(json); return Impl::createFromSchemaV010(json);
} }
return Err( return Err(
@ -294,14 +294,14 @@ std::vector<std::pair<std::string, std::optional<std::string>*>> ModInfo::Impl::
} }
ModJson ModInfo::Impl::toJSON() const { ModJson ModInfo::Impl::toJSON() const {
auto json = *m_rawJSON; auto json = m_rawJSON;
json["path"] = this->m_path.string(); json["path"] = this->m_path.string();
json["binary"] = this->m_binaryName; json["binary"] = this->m_binaryName;
return json; return json;
} }
ModJson ModInfo::Impl::getRawJSON() const { ModJson ModInfo::Impl::getRawJSON() const {
return *m_rawJSON; return m_rawJSON;
} }
bool ModInfo::Impl::operator==(ModInfo::Impl const& other) const { bool ModInfo::Impl::operator==(ModInfo::Impl const& other) const {
@ -474,10 +474,10 @@ bool ModInfo::validateID(std::string const& id) {
} }
ModJson& ModInfo::rawJSON() { ModJson& ModInfo::rawJSON() {
return *m_impl->m_rawJSON; return m_impl->m_rawJSON;
} }
ModJson const& ModInfo::rawJSON() const { ModJson const& ModInfo::rawJSON() const {
return *m_impl->m_rawJSON; return m_impl->m_rawJSON;
} }
Result<ModInfo> ModInfo::createFromSchemaV010(ModJson const& json) { Result<ModInfo> ModInfo::createFromSchemaV010(ModJson const& json) {
@ -495,7 +495,7 @@ std::vector<std::pair<std::string, std::optional<std::string>*>> ModInfo::getSpe
return m_impl->getSpecialFiles(); return m_impl->getSpecialFiles();
} }
ModInfo::ModInfo() : m_impl() {} ModInfo::ModInfo() : m_impl(std::make_unique<Impl>()) {}
ModInfo::ModInfo(ModInfo const& other) : m_impl(std::make_unique<Impl>(*other.m_impl)) {} ModInfo::ModInfo(ModInfo const& other) : m_impl(std::make_unique<Impl>(*other.m_impl)) {}