Adds little hack for GetOwner.

This commit is contained in:
Deukhoofd 2021-10-30 11:49:52 +02:00
parent f9c8efb9b1
commit 31414d6521
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 15 additions and 14 deletions

View File

@ -20,8 +20,7 @@ static void PrintObjectTypeDef(asITypeInfo* type, const std::filesystem::path& d
if ((type->GetFlags() & asOBJ_VALUE) != 0 && (type->GetFlags() & asOBJ_ASHANDLE) == 0) { if ((type->GetFlags() & asOBJ_VALUE) != 0 && (type->GetFlags() & asOBJ_ASHANDLE) == 0) {
fs << "valuetype"; fs << "valuetype";
} } else {
else{
fs << "type"; fs << "type";
} }
@ -117,24 +116,27 @@ static void PrintScriptObject(asITypeInfo* type, const std::filesystem::path& di
auto name = std::string(method->GetName()); auto name = std::string(method->GetName());
if (name == "opAssign") if (name == "opAssign")
continue; continue;
if (name == "GetOwner") {
fs << "\tref@ __owner;" << std::endl << std::endl;
}
auto decl = std::string(method->GetDeclaration(false, true, true)); auto decl = std::string(method->GetDeclaration(false, true, true));
replace(decl, "&in", " &in"); replace(decl, "&in", " &in");
replace(decl, "&out", " &out"); replace(decl, "&out", " &out");
replace(decl, "ref", "ref@");
fs << "\t" << decl; fs << "\t" << decl;
if (isAbstract) { if (isAbstract) {
if (method->GetReturnTypeId() == 0) { if (method->GetReturnTypeId() == 0) {
fs << "{};" << std::endl; fs << "{};" << std::endl;
} } else {
else{ if (name == "GetOwner") {
if (method->GetReturnTypeId() == asTYPEID_BOOL){ fs << "{ return __owner; };" << std::endl;
} else if (method->GetReturnTypeId() == asTYPEID_BOOL) {
fs << "{ return false; };" << std::endl; fs << "{ return false; };" << std::endl;
} } else {
else{
fs << "{ return 0; };" << std::endl; fs << "{ return 0; };" << std::endl;
} }
} }
} } else
else
fs << ";" << std::endl; fs << ";" << std::endl;
} }
} }
@ -196,5 +198,4 @@ void ScriptHeadersExporter::Export(const std::string& outPath) {
fs << "func " << func->GetDeclaration(false, false, true) << ";" << std::endl; fs << "func " << func->GetDeclaration(false, false, true) << ";" << std::endl;
} }
} }
} }