I seem to be running into a very weird issue.
I have a test plugin like this
Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
#include <dynamic>
#include <testdyn>
public Plugin myinfo =
{
name = "",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
TestDyn t = TestDyn();
t.time = 5.5;
t.Dispose();
}
and a methodmap dynamic class
Code:
#if defined _dynamic_class_testdyn_
#endinput
#endif
#define _dynamic_class_testdyn_
methodmap TestDyn < Dynamic
{
public TestDyn()
{
// First we make a new dymanic object
Dynamic myclass = Dynamic(64, 0);
// Next we will define all the members
// -> We do this to force the offsets to always be in the same location
// over multiple instances of the same class.
myclass.SetFloat("time", 0.0000000);
return view_as<TestDyn>(myclass);
}
// Note that I use static offsets to access members.
// -> This improves performance by caching member offsets
// -> This is why we force the members in during the contructor
// -> Failure to force members in the constructor will cause corruption
property float time
{
public get()
{
static DynamicOffset offset = INVALID_DYNAMIC_OFFSET;
if (offset == INVALID_DYNAMIC_OFFSET)
{
offset = this.GetMemberOffset("time");
if (offset == INVALID_DYNAMIC_OFFSET)
SetFailState("A serious error occured in Dynamic!");
}
return this.GetFloatByOffset(offset);
}
public set(float value)
{
static DynamicOffset offset = INVALID_DYNAMIC_OFFSET;
if (offset == INVALID_DYNAMIC_OFFSET)
{
offset = this.GetMemberOffset("time");
if (offset == INVALID_DYNAMIC_OFFSET)
{
offset = this.SetFloat("time", value);
return;
}
}
this.SetFloatByOffset(offset, value);
}
}
}
and this results in the error. It only happens when i use a methodmap, if i use Dynamic by it self it works fine. I tried this on 2 different servers as well
Code:
L 03/03/2017 - 21:34:28: [SM] Exception reported: Invalid index 65 (count: 1)
L 03/03/2017 - 21:34:28: [SM] Blaming: dynamic.smx
L 03/03/2017 - 21:34:28: [SM] Call stack trace:
L 03/03/2017 - 21:34:28: [SM] [0] ArrayList.Get
L 03/03/2017 - 21:34:28: [SM] [1] Line 486, ..\dynamic.sp::_Dynamic_GetMemberDataType
L 03/03/2017 - 21:34:28: [SM] [2] Line 48, ..\dynamic/system/datatypes/float.sp::_SetFloat
L 03/03/2017 - 21:34:28: [SM] [3] Line 118, ..\dynamic/system/datatypes/float.sp::_Dynamic_SetFloatByOffset
L 03/03/2017 - 21:34:28: [SM] [4] Line 311, ..\dynamic/system/natives.sp::Native_Dynamic_SetFloatByOffset
L 03/03/2017 - 21:34:28: [SM] [6] Dynamic_SetFloatByOffset
L 03/03/2017 - 21:34:28: [SM] [7] Line 210, C:\Users\Josh\Documents\spedit1.2.0.1\sourcepawn\configs\sm_1_8_5914\include\dynamic/methodmaps/dynamic.inc::Dynamic.SetFloatByOffset
L 03/03/2017 - 21:34:28: [SM] [8] Line 50, C:\Users\Josh\Documents\timersurf\addons\sourcemod\scripting\include\testdyn.inc::TestDyn.time.set
L 03/03/2017 - 21:34:28: [SM] [9] Line 28, C:\Users\Josh\Desktop\testdyn.sp::OnPluginStart