Rework misclibrary gettime to not segfault

This commit is contained in:
Deukhoofd committed 2021-07-09 18:20:01 +02:00
1 parent c2d846c2f6
commit a59f73b2f6
6 files changed
+18 -19

No files matched your search

+4 -10
View File
@@ -11,22 +11,16 @@ namespace PkmnLibSharp.Battling
{
public class MiscLibrary : PointerWrapper
{
private delegate TimeOfDay GetTimeDelegate();
public delegate TimeOfDay GetTimeDelegate();
internal MiscLibrary(IntPtr ptr) : base(ptr)
{
}
public MiscLibrary()
public MiscLibrary(GetTimeDelegate @delegate)
{
GetTimeDelegate getTime = GetTime;
Initialize(Pkmnlib.Generated.MiscLibrary.Construct(Marshal.GetFunctionPointerForDelegate(getTime)));
Initialize(Pkmnlib.Generated.MiscLibrary.Construct(Marshal.GetFunctionPointerForDelegate(@delegate)));
}
public virtual TimeOfDay GetTime()
{
return TimeOfDay.Morning;
}
public bool IsCritical(IntPtr move, Pokemon target, byte hitNumber)
{
byte b = 0;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.