Rework constructors to remove the Create pattern.

This commit is contained in:
Deukhoofd committed 2020-08-08 13:57:54 +02:00
1 parent 1b025ea3cf
commit e0f4a38309
22 files changed
+148 -147

No files matched your search

@@ -13,7 +13,7 @@ namespace PkmnLibSharp.Library.GrowthRates
{
}
public static ExternGrowthRate Create(CalculateLevelDelegate levelFunc,
public ExternGrowthRate(CalculateLevelDelegate levelFunc,
CalculateExperienceDelegate experienceFunc)
{
var ptr = IntPtr.Zero;
@@ -21,7 +21,7 @@ namespace PkmnLibSharp.Library.GrowthRates
Marshal.GetFunctionPointerForDelegate(levelFunc),
Marshal.GetFunctionPointerForDelegate(experienceFunc)
);
return new ExternGrowthRate(ptr);
Initialize(ptr);
}
protected override void DeletePtr()
@@ -8,6 +8,8 @@ namespace PkmnLibSharp.Library.GrowthRates
internal GrowthRate(IntPtr ptr) : base(ptr)
{
}
protected GrowthRate(){}
public byte CalculateLevel(uint experience)
{