26 lines
804 B
C#
26 lines
804 B
C#
using PkmnLibSharp.Utils;
|
|
using Interface = PkmnLibSharp.FFI.StaticData.Libraries.SpeciesLibrary;
|
|
|
|
namespace PkmnLibSharp.StaticData.Libraries
|
|
{
|
|
public class SpeciesLibrary : DataLibrary<Species>
|
|
{
|
|
protected SpeciesLibrary(FFIHandle handle) : base(handle)
|
|
{
|
|
}
|
|
|
|
public static SpeciesLibrary Create(ulong capacity)
|
|
{
|
|
var handle = Interface.species_library_new(capacity);
|
|
var lib = Resolver.Instance.ResolveSpeciesLibrary(handle.Resolve());
|
|
if (capacity > 0)
|
|
lib.ReserveCapacity(capacity);
|
|
return lib;
|
|
}
|
|
|
|
protected override void AddNative(string key, Species value)
|
|
{
|
|
Interface.species_library_add(Handle, key.ToPtr(), value.Handle);
|
|
}
|
|
}
|
|
} |