From 514de9a2ba3f8d939465abb9041b5e07a67d7f23 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 28 Mar 2021 17:15:06 +0200 Subject: [PATCH] Adds helper function for printing constString. --- src/ScriptResolving/AngelScript/AngelScriptResolver.cpp | 3 +++ src/ScriptResolving/AngelScript/AngelScriptResolver.hpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp index c3400ff..617805f 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp @@ -81,6 +81,9 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg, r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL); if (r < 0) throw ArbUt::Exception("Registering print function failed."); + r = _engine->RegisterGlobalFunction("void print(const constString &in)", asFUNCTION(PrintConst), asCALL_CDECL); + if (r < 0) + throw ArbUt::Exception("Registering print function failed."); } _builder.StartNewModule(_engine, "pkmn"); diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp index 7f8c4d3..d01b179 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp @@ -21,6 +21,7 @@ private: static void MessageCallback(const asSMessageInfo* msg, void* param); static void Print(const std::string& str) { std::cout << str << std::endl; } + static void PrintConst(const ArbUt::StringView& str) { Print(std::string(str.std_str())); } ArbUt::Dictionary> _typeDatabase; ArbUt::Dictionary _baseTypes; ArbUt::Dictionary _itemUseTypes;