Register GrowthRate in AngelScript.
This commit is contained in:
parent
797044aa8c
commit
faf22c9562
|
@ -1,9 +1,10 @@
|
|||
#include "AngelScripResolver.hpp"
|
||||
#include "../../extern/angelscript_addons/scripthelper/scripthelper.h"
|
||||
#include "../../extern/angelscript_addons/scriptstdstring/scriptstdstring.h"
|
||||
#include "TypeRegistry/RegisterItemTypes.hpp"
|
||||
#include "TypeRegistry/RegisterMoveTypes.hpp"
|
||||
#include "TypeRegistry/RegisterPokemonTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterGrowthRateTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterItemTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterMoveTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterPokemonTypes.hpp"
|
||||
|
||||
CreatureLib::Battling::ScriptResolver* PkmnLib::Battling::BattleLibrary::CreateScriptResolver() {
|
||||
return new AngelScripResolver();
|
||||
|
@ -31,6 +32,7 @@ void AngelScripResolver::Initialize(CreatureLib::Battling::BattleLibrary* librar
|
|||
RegisterPokemonTypes::Register(_engine);
|
||||
RegisterItemTypes::Register(_engine);
|
||||
RegisterMoveTypes::Register(_engine);
|
||||
RegisterGrowthRateTypes::Register(_engine);
|
||||
|
||||
_mainModule = _engine->GetModule("pkmn", asGM_ALWAYS_CREATE);
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include "RegisterGrowthRateTypes.hpp"
|
||||
#include <Library/GrowthRates/GrowthRate.hpp>
|
||||
#include <cassert>
|
||||
|
||||
void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
|
||||
RegisterGrowthRateType(engine);
|
||||
}
|
||||
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("GrowthRate", "uint8 CalculateLevel(uint experience) const",
|
||||
asMETHOD(CreatureLib::Library::GrowthRate, CalculateLevel), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("GrowthRate", "uint CalculateExperience(uint8 level) const",
|
||||
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef PKMNLIB_REGISTERGROWTHRATETYPES_HPP
|
||||
#define PKMNLIB_REGISTERGROWTHRATETYPES_HPP
|
||||
#include <angelscript.h>
|
||||
|
||||
class RegisterGrowthRateTypes {
|
||||
static void RegisterGrowthRateType(asIScriptEngine* engine);
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_REGISTERGROWTHRATETYPES_HPP
|
|
@ -1,6 +1,6 @@
|
|||
#include "RegisterItemTypes.hpp"
|
||||
#include <cassert>
|
||||
#include "../../Library/Items/Item.hpp"
|
||||
#include "../../../Library/Items/Item.hpp"
|
||||
|
||||
void RegisterItemTypes::Register(asIScriptEngine* engine) {
|
||||
RegisterItemCategoryEnum(engine);
|
|
@ -1,6 +1,6 @@
|
|||
#include "RegisterMoveTypes.hpp"
|
||||
#include <cassert>
|
||||
#include "../../Library/Moves/MoveData.hpp"
|
||||
#include "../../../Library/Moves/MoveData.hpp"
|
||||
|
||||
void RegisterMoveTypes::Register(asIScriptEngine* engine) {
|
||||
RegisterMoveCategory(engine);
|
|
@ -1,7 +1,7 @@
|
|||
#include "RegisterPokemonTypes.hpp"
|
||||
#include <cassert>
|
||||
#include "../../Library/Species/PokemonSpecies.hpp"
|
||||
#include "../../Library/Statistic.hpp"
|
||||
#include "../../../Library/Species/PokemonSpecies.hpp"
|
||||
#include "../../../Library/Statistic.hpp"
|
||||
|
||||
void RegisterPokemonTypes::Register(asIScriptEngine* engine) {
|
||||
RegisterGenderEnum(engine);
|
Loading…
Reference in New Issue