Update for PkmnLib.
This commit is contained in:
parent
20edf39d48
commit
94de1d4dca
|
@ -40,6 +40,8 @@ function(include_pkmnlib)
|
||||||
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include)
|
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include)
|
||||||
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/src
|
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/src
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib)
|
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/PkmnLib)
|
||||||
|
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include/extern)
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/include
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern/AngelscriptDebuggerServer/extern/asio-1.18.2/include
|
${CMAKE_CURRENT_BINARY_DIR}/PkmnLib/src/pkmnlib/extern/AngelscriptDebuggerServer/extern/asio-1.18.2/include
|
||||||
|
|
|
@ -8,7 +8,7 @@ static PkmnLib::Library::PokemonLibrary* BuildStaticLibrary() {
|
||||||
new PkmnLib::Library::LibrarySettings(100, 4, 4096), new PkmnLib::Library::SpeciesLibrary(),
|
new PkmnLib::Library::LibrarySettings(100, 4, 4096), new PkmnLib::Library::SpeciesLibrary(),
|
||||||
new PkmnLib::Library::MoveLibrary(), new PkmnLib::Library::ItemLibrary(),
|
new PkmnLib::Library::MoveLibrary(), new PkmnLib::Library::ItemLibrary(),
|
||||||
new CreatureLib::Library::GrowthRateLibrary(), new CreatureLib::Library::TypeLibrary(),
|
new CreatureLib::Library::GrowthRateLibrary(), new CreatureLib::Library::TypeLibrary(),
|
||||||
new PkmnLib::Library::NatureLibrary());
|
new CreatureLib::Library::TalentLibrary(), new PkmnLib::Library::NatureLibrary());
|
||||||
}
|
}
|
||||||
|
|
||||||
static PkmnLib::Library::TimeOfDay GetTime() { return PkmnLib::Library::TimeOfDay::Morning; }
|
static PkmnLib::Library::TimeOfDay GetTime() { return PkmnLib::Library::TimeOfDay::Morning; }
|
||||||
|
|
|
@ -67,11 +67,35 @@ static void PrintObjectTypeDef(asITypeInfo* type, const std::filesystem::path& d
|
||||||
auto name = std::string(method->GetName());
|
auto name = std::string(method->GetName());
|
||||||
auto decl = std::string(method->GetDeclaration(false, true, false));
|
auto decl = std::string(method->GetDeclaration(false, true, false));
|
||||||
auto realName = name.substr(4);
|
auto realName = name.substr(4);
|
||||||
replace(decl, name, realName);
|
if (method->GetParamCount() > 0 && !name.starts_with("set_")) {
|
||||||
replace(decl, "() const", " { get const; }");
|
fs << " " << decl << " property;" << std::endl;
|
||||||
replace(decl, "()", " { get; }");
|
} else if (name.starts_with("get_")) {
|
||||||
|
replace(decl, name, realName);
|
||||||
|
replace(decl, "() const", " { get const; ");
|
||||||
|
replace(decl, "()", " { get; ");
|
||||||
|
|
||||||
fs << " " << decl << ";" << std::endl;
|
fs << " " << decl;
|
||||||
|
auto setMethod = type->GetMethodByName(("set_" + realName).c_str());
|
||||||
|
if (setMethod != nullptr) {
|
||||||
|
auto setDecl = std::string(setMethod->GetDeclaration(false, true, false));
|
||||||
|
if (setDecl.find("const") != std::string::npos) {
|
||||||
|
fs << "set const; ";
|
||||||
|
} else {
|
||||||
|
fs << "set; ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs << "};" << std::endl;
|
||||||
|
} else if (name.starts_with("set")) {
|
||||||
|
auto getMethod = type->GetMethodByName(("get_" + realName).c_str());
|
||||||
|
if (getMethod != nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
replace(decl, name, realName);
|
||||||
|
replace(decl, "() const", " { set const; }");
|
||||||
|
replace(decl, "()", " { set; }");
|
||||||
|
fs << "\t" << decl << ";" << std::endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
auto name = std::string(method->GetName());
|
auto name = std::string(method->GetName());
|
||||||
auto decl = std::string(method->GetDeclaration(false, true, true));
|
auto decl = std::string(method->GetDeclaration(false, true, true));
|
||||||
|
@ -107,11 +131,33 @@ static void PrintScriptObject(asITypeInfo* type, const std::filesystem::path& di
|
||||||
auto name = std::string(method->GetName());
|
auto name = std::string(method->GetName());
|
||||||
auto decl = std::string(method->GetDeclaration(false, true, false));
|
auto decl = std::string(method->GetDeclaration(false, true, false));
|
||||||
auto realName = name.substr(4);
|
auto realName = name.substr(4);
|
||||||
replace(decl, name, realName);
|
if (name.starts_with("get_")) {
|
||||||
replace(decl, "() const", " { get const; }");
|
replace(decl, name, realName);
|
||||||
replace(decl, "()", " { get; }");
|
replace(decl, "() const", " get const; ");
|
||||||
|
replace(decl, "()", " get; ");
|
||||||
|
|
||||||
fs << "\t" << decl << std::endl;
|
fs << "\t"
|
||||||
|
<< "{" << decl;
|
||||||
|
auto setMethod = type->GetMethodByName(("set_" + realName).c_str());
|
||||||
|
if (setMethod != nullptr) {
|
||||||
|
auto setDecl = replace(decl, name, realName);
|
||||||
|
replace(decl, "() const", " set const; ");
|
||||||
|
replace(decl, "()", " set; ");
|
||||||
|
fs << setDecl;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs << "}" << std::endl;
|
||||||
|
} else if (name.starts_with("set")) {
|
||||||
|
auto getMethod = type->GetMethodByName(("get_" + realName).c_str());
|
||||||
|
if (getMethod != nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
replace(decl, name, realName);
|
||||||
|
replace(decl, "() const", " set const; ");
|
||||||
|
replace(decl, "()", " set; ");
|
||||||
|
fs << "\t"
|
||||||
|
<< "{" << decl << "}" << std::endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
auto name = std::string(method->GetName());
|
auto name = std::string(method->GetName());
|
||||||
if (name == "opAssign")
|
if (name == "opAssign")
|
||||||
|
|
Loading…
Reference in New Issue