Adds helper function for printing constString.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-03-28 17:15:06 +02:00
parent f8c3e92769
commit 514de9a2ba
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 4 additions and 0 deletions

View File

@ -81,6 +81,9 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg,
r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL); r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL);
if (r < 0) if (r < 0)
throw ArbUt::Exception("Registering print function failed."); 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"); _builder.StartNewModule(_engine, "pkmn");

View File

@ -21,6 +21,7 @@ private:
static void MessageCallback(const asSMessageInfo* msg, void* param); static void MessageCallback(const asSMessageInfo* msg, void* param);
static void Print(const std::string& str) { std::cout << str << std::endl; } 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<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> _typeDatabase; ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> _typeDatabase;
ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _baseTypes; ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _baseTypes;
ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _itemUseTypes; ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _itemUseTypes;