Support getting a nature iterator.
This commit is contained in:
parent
cae763fdc0
commit
a9b0ec0e98
|
@ -231,6 +231,12 @@ namespace Creaturelib.Generated
|
||||||
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Creature_GetAttacks")]
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Creature_GetAttacks")]
|
||||||
internal static extern IntPtr GetAttacks(IntPtr p);
|
internal static extern IntPtr GetAttacks(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">Creature *</param>
|
||||||
|
/// <param name="scriptName">const char *</param>
|
||||||
|
/// <returns>bool</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Creature_HasAttack")]
|
||||||
|
internal static extern byte HasAttack(IntPtr p, IntPtr scriptName);
|
||||||
|
|
||||||
/// <param name="p">const Creature *</param>
|
/// <param name="p">const Creature *</param>
|
||||||
/// <returns>const CreatureSpecies *</returns>
|
/// <returns>const CreatureSpecies *</returns>
|
||||||
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Creature_GetDisplaySpecies")]
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Creature_GetDisplaySpecies")]
|
||||||
|
|
|
@ -44,5 +44,17 @@ namespace Pkmnlib.Generated
|
||||||
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_NatureLibrary_GetNatureName")]
|
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_NatureLibrary_GetNatureName")]
|
||||||
internal static extern byte GetNatureName(IntPtr p, IntPtr nature, ref IntPtr @out);
|
internal static extern byte GetNatureName(IntPtr p, IntPtr nature, ref IntPtr @out);
|
||||||
|
|
||||||
|
/// <param name="p">const NatureLibrary *</param>
|
||||||
|
/// <returns>long unsigned int</returns>
|
||||||
|
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_NatureLibrary_GetNatureCount")]
|
||||||
|
internal static extern ulong GetNatureCount(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">NatureLibrary *</param>
|
||||||
|
/// <param name="index">long unsigned int</param>
|
||||||
|
/// <param name="out">const char * &</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_NatureLibrary_GetNatureByIndex")]
|
||||||
|
internal static extern byte GetNatureByIndex(IntPtr p, ulong index, ref IntPtr @out);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,17 @@ namespace PkmnLibSharp.Library
|
||||||
return val.PtrString()!;
|
return val.PtrString()!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetNatures()
|
||||||
|
{
|
||||||
|
var count = Pkmnlib.Generated.NatureLibrary.GetNatureCount(Ptr);
|
||||||
|
var ptr = IntPtr.Zero;
|
||||||
|
for (ulong i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
Pkmnlib.Generated.NatureLibrary.GetNatureByIndex(Ptr, i, ref ptr).Assert();
|
||||||
|
yield return ptr.PtrString()!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
{
|
{
|
||||||
Pkmnlib.Generated.NatureLibrary.Destruct(Ptr);
|
Pkmnlib.Generated.NatureLibrary.Destruct(Ptr);
|
||||||
|
|
BIN
PkmnLibSharp/Native/libCreatureLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libCreatureLib.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue