Register Type Library for AngelScript.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c1d865d366
commit
175e26d8b4
|
@ -5,6 +5,7 @@
|
|||
#include "TypeRegistry/Library/RegisterItemTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterMoveTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterSpeciesTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterTypeLibrary.hpp"
|
||||
|
||||
CreatureLib::Battling::ScriptResolver* PkmnLib::Battling::BattleLibrary::CreateScriptResolver() {
|
||||
return new AngelScripResolver();
|
||||
|
@ -33,6 +34,7 @@ void AngelScripResolver::Initialize(CreatureLib::Battling::BattleLibrary* librar
|
|||
RegisterItemTypes::Register(_engine);
|
||||
RegisterMoveTypes::Register(_engine);
|
||||
RegisterGrowthRateTypes::Register(_engine);
|
||||
RegisterTypeLibrary::Register(_engine);
|
||||
|
||||
_mainModule = _engine->GetModule("pkmn", asGM_ALWAYS_CREATE);
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#include "RegisterTypeLibrary.hpp"
|
||||
#include <Library/TypeLibrary.hpp>
|
||||
#include <cassert>
|
||||
|
||||
void RegisterTypeLibrary::Register(asIScriptEngine* engine) {
|
||||
RegisterTypeLibraryType(engine);
|
||||
}
|
||||
|
||||
void RegisterTypeLibrary::RegisterTypeLibraryType(asIScriptEngine* engine) {
|
||||
[[maybe_unused]] int r = engine->RegisterObjectType("TypeLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TypeLibrary", "uint8 GetTypeId(const string &in name) const",
|
||||
asMETHOD(CreatureLib::Library::TypeLibrary, GetTypeId), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TypeLibrary", "float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const",
|
||||
asMETHOD(CreatureLib::Library::TypeLibrary, GetSingleEffectiveness), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
//TODO: Register get full effectiveness method.
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef PKMNLIB_REGISTERTYPELIBRARY_HPP
|
||||
#define PKMNLIB_REGISTERTYPELIBRARY_HPP
|
||||
#include <angelscript.h>
|
||||
|
||||
class RegisterTypeLibrary {
|
||||
static void RegisterTypeLibraryType(asIScriptEngine* engine);
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_REGISTERTYPELIBRARY_HPP
|
Loading…
Reference in New Issue