Make CreateScript use std::string to help prevent issues.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-03-20 11:18:32 +01:00
parent 3bd5bb3fe6
commit e346f5ffb4
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 3 additions and 3 deletions

View File

@ -320,8 +320,8 @@ void AngelScriptResolver::RegisterScriptType(asITypeInfo* typeInfo, const ArbUt:
break;
}
}
void AngelScriptResolver::CreateScript(const char* name, const char* script) {
EnsureGreater(_builder.AddSectionFromMemory(name, script), 0);
void AngelScriptResolver::CreateScript(const std::string& name, const std::string& script) {
EnsureGreater(_builder.AddSectionFromMemory(name.c_str(), script.c_str()), 0);
}
void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugInfo) {
FILE* wFile = nullptr;

View File

@ -58,7 +58,7 @@ public:
void Initialize(CreatureLib::Battling::BattleLibrary* library) override { Initialize(library, true); }
void Initialize(CreatureLib::Battling::BattleLibrary* library, bool includeStandard);
void CreateScript(const char* name, const char* script);
void CreateScript(const std::string& name, const std::string& script);
inline void SetSourceDirectory(std::string const& path) noexcept { _sourceDirectory = path; }
const asIScriptModule* GetMainModule() const noexcept { return _mainModule; }
CScriptBuilder& GetBuilder() noexcept { return _builder; }