feat: add detailed rule in BMapInspector
This commit is contained in:
@@ -3,23 +3,37 @@ add_executable(BMapInspector "")
|
||||
# Setup sources
|
||||
target_sources(BMapInspector
|
||||
PRIVATE
|
||||
# Kernel
|
||||
BMapInspector.cpp
|
||||
Utils.cpp
|
||||
Reporter.cpp
|
||||
Cli.cpp
|
||||
Map.cpp
|
||||
Rule.cpp
|
||||
# Rules
|
||||
Rule/GpRules.cpp
|
||||
Rule/ChirsRules.cpp
|
||||
Rule/YYCRules.cpp
|
||||
Rule/ZZQRules.cpp
|
||||
Rule/BBugRules.cpp
|
||||
)
|
||||
# Setup headers
|
||||
target_sources(BMapInspector
|
||||
PRIVATE
|
||||
FILE_SET HEADERS
|
||||
FILES
|
||||
# Kernel
|
||||
Utils.hpp
|
||||
Reporter.hpp
|
||||
Cli.hpp
|
||||
Map.hpp
|
||||
Rule.hpp
|
||||
# Rules
|
||||
Rule/GpRules.hpp
|
||||
Rule/ChirsRules.hpp
|
||||
Rule/YYCRules.hpp
|
||||
Rule/ZZQRules.hpp
|
||||
Rule/BBugRules.hpp
|
||||
)
|
||||
# Setup header infomation
|
||||
target_include_directories(BMapInspector
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BMapInspector::Map {
|
||||
Level::Level(const Cli::Args& args) : m_Context(nullptr), m_LoadStatus() {
|
||||
// Create contexy
|
||||
this->m_Context = new C::CKContext();
|
||||
// Callback for eat all output.
|
||||
// Callback for eating all output.
|
||||
this->m_Context->SetOutputCallback([](LibCmo::CKSTRING strl) -> void {});
|
||||
// Set temp folder
|
||||
auto pm = m_Context->GetPathManager();
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#include "Rule.hpp"
|
||||
|
||||
#include "Rule/GpRules.hpp"
|
||||
#include "Rule/ChirsRules.hpp"
|
||||
#include "Rule/YYCRules.hpp"
|
||||
#include "Rule/BBugRules.hpp"
|
||||
#include "Rule/ZZQRules.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
#pragma region IRule
|
||||
@@ -13,10 +19,20 @@ namespace BMapInspector::Rule {
|
||||
#pragma region Ruleset
|
||||
|
||||
Ruleset::Ruleset() : rules() {
|
||||
// TODO: create instance for each rules.
|
||||
// Add rule into list.
|
||||
rules.emplace_back(new Gp1Rule());
|
||||
rules.emplace_back(new Gp2Rule());
|
||||
rules.emplace_back(new Gp3Rule());
|
||||
rules.emplace_back(new Chirs1Rule());
|
||||
// Add more rules...
|
||||
}
|
||||
|
||||
Ruleset::~Ruleset() {}
|
||||
Ruleset::~Ruleset() {
|
||||
// Free rule from list.
|
||||
for (const auto* rule : this->rules) {
|
||||
delete rule;
|
||||
}
|
||||
}
|
||||
|
||||
size_t Ruleset::GetRuleCount() const {
|
||||
return this->rules.size();
|
||||
|
||||
0
Ballance/BMapInspector/Rule/BBugRules.cpp
Normal file
0
Ballance/BMapInspector/Rule/BBugRules.cpp
Normal file
6
Ballance/BMapInspector/Rule/BBugRules.hpp
Normal file
6
Ballance/BMapInspector/Rule/BBugRules.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "../Rule.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
}
|
||||
19
Ballance/BMapInspector/Rule/ChirsRules.cpp
Normal file
19
Ballance/BMapInspector/Rule/ChirsRules.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "ChirsRules.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
Chirs1Rule::Chirs1Rule() : IRule() {}
|
||||
Chirs1Rule::~Chirs1Rule() {}
|
||||
std::u8string_view Chirs1Rule::GetRuleName() const {
|
||||
return u8"CHIRS1";
|
||||
}
|
||||
void Chirs1Rule::Check(Reporter::Reporter& reporter, Map::Level& ctx) const {
|
||||
// Report error if there is some material named Laterne_Verlauf
|
||||
// but its texture is not pointed to Laterne_Verlauf texture.
|
||||
|
||||
// Report error if some materials' texture is Laterne_Verlauf,
|
||||
// but its name is not Laterne_Verlauf.
|
||||
|
||||
// Report error if there is multiple Laterne_Verlauf material.
|
||||
reporter.WriteError(this->GetRuleName(), u8"Fork you!");
|
||||
}
|
||||
} // namespace BMapInspector::Rule
|
||||
24
Ballance/BMapInspector/Rule/ChirsRules.hpp
Normal file
24
Ballance/BMapInspector/Rule/ChirsRules.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "../Rule.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
// Reference: https://tieba.baidu.com/p/5913556704
|
||||
|
||||
/**
|
||||
* @brief Chirs241097 Rule 1
|
||||
* @details
|
||||
* This rule will make sure that there is only 1 texture named Laterne_Verlauf in map,
|
||||
* which represent the ray of latern.
|
||||
*/
|
||||
class Chirs1Rule : public IRule {
|
||||
public:
|
||||
Chirs1Rule();
|
||||
virtual ~Chirs1Rule();
|
||||
YYCC_DELETE_COPY_MOVE(Chirs1Rule)
|
||||
|
||||
public:
|
||||
std::u8string_view GetRuleName() const override;
|
||||
void Check(Reporter::Reporter& reporter, Map::Level& ctx) const override;
|
||||
};
|
||||
}
|
||||
49
Ballance/BMapInspector/Rule/GpRules.cpp
Normal file
49
Ballance/BMapInspector/Rule/GpRules.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "GpRules.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
#pragma region GP1 Rule
|
||||
|
||||
Gp1Rule::Gp1Rule() : IRule() {}
|
||||
|
||||
Gp1Rule::~Gp1Rule() {}
|
||||
|
||||
std::u8string_view Gp1Rule::GetRuleName() const {
|
||||
return u8"GP1";
|
||||
}
|
||||
|
||||
void Gp1Rule::Check(Reporter::Reporter& reporter, Map::Level& ctx) const {}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GP2 Rule
|
||||
|
||||
Gp2Rule::Gp2Rule() : IRule() {}
|
||||
|
||||
Gp2Rule::~Gp2Rule() {}
|
||||
|
||||
std::u8string_view Gp2Rule::GetRuleName() const {
|
||||
return u8"GP2";
|
||||
}
|
||||
|
||||
void Gp2Rule::Check(Reporter::Reporter& reporter, Map::Level& ctx) const {}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GP3 Rule
|
||||
|
||||
Gp3Rule::Gp3Rule() : IRule() {}
|
||||
|
||||
Gp3Rule::~Gp3Rule() {}
|
||||
|
||||
std::u8string_view Gp3Rule::GetRuleName() const {
|
||||
return u8"GP3";
|
||||
}
|
||||
|
||||
void Gp3Rule::Check(Reporter::Reporter& reporter, Map::Level& ctx) const {
|
||||
// TODO: Mesh hash is not implemented.
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
} // namespace BMapInspector::Rule
|
||||
58
Ballance/BMapInspector/Rule/GpRules.hpp
Normal file
58
Ballance/BMapInspector/Rule/GpRules.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include "../Rule.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
// Reference: https://tieba.baidu.com/p/3182981807
|
||||
|
||||
/**
|
||||
* @brief Gamepiaynmo Rule 1
|
||||
* @details
|
||||
* The most comprehensive group checker inspired from Ballance Blender Plugin.
|
||||
*/
|
||||
class Gp1Rule : public IRule {
|
||||
public:
|
||||
Gp1Rule();
|
||||
virtual ~Gp1Rule();
|
||||
YYCC_DELETE_COPY_MOVE(Gp1Rule)
|
||||
|
||||
public:
|
||||
std::u8string_view GetRuleName() const override;
|
||||
void Check(Reporter::Reporter& reporter, Map::Level& ctx) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gamepiaynmo Rule 2
|
||||
* @details
|
||||
* This rule make sure that one Ballance element must be grouped into only one sector group.
|
||||
* Multiple grouping and none grouping will throw error.
|
||||
*/
|
||||
class Gp2Rule : public IRule {
|
||||
public:
|
||||
Gp2Rule();
|
||||
virtual ~Gp2Rule();
|
||||
YYCC_DELETE_COPY_MOVE(Gp2Rule)
|
||||
|
||||
public:
|
||||
std::u8string_view GetRuleName() const override;
|
||||
void Check(Reporter::Reporter& reporter, Map::Level& ctx) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gamepiaynmo Rule 3
|
||||
* @details
|
||||
* This rule make sure that all Ballance element is grouped into correct element group.
|
||||
* This rule will check the mesh of PH and guess which element it is.
|
||||
*/
|
||||
class Gp3Rule : public IRule {
|
||||
public:
|
||||
Gp3Rule();
|
||||
virtual ~Gp3Rule();
|
||||
YYCC_DELETE_COPY_MOVE(Gp3Rule)
|
||||
|
||||
public:
|
||||
std::u8string_view GetRuleName() const override;
|
||||
void Check(Reporter::Reporter& reporter, Map::Level& ctx) const override;
|
||||
};
|
||||
|
||||
}
|
||||
0
Ballance/BMapInspector/Rule/Shared.cpp
Normal file
0
Ballance/BMapInspector/Rule/Shared.cpp
Normal file
5
Ballance/BMapInspector/Rule/Shared.hpp
Normal file
5
Ballance/BMapInspector/Rule/Shared.hpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace BMapInspector::Rule::Shared {
|
||||
|
||||
}
|
||||
0
Ballance/BMapInspector/Rule/YYCRules.cpp
Normal file
0
Ballance/BMapInspector/Rule/YYCRules.cpp
Normal file
6
Ballance/BMapInspector/Rule/YYCRules.hpp
Normal file
6
Ballance/BMapInspector/Rule/YYCRules.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "../Rule.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
}
|
||||
0
Ballance/BMapInspector/Rule/ZZQRules.cpp
Normal file
0
Ballance/BMapInspector/Rule/ZZQRules.cpp
Normal file
6
Ballance/BMapInspector/Rule/ZZQRules.hpp
Normal file
6
Ballance/BMapInspector/Rule/ZZQRules.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "../Rule.hpp"
|
||||
|
||||
namespace BMapInspector::Rule {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user