Commits

Anonymous committed 6c66056

using cmp_findinstance_bytype_inobj in GetComponent

Comments (0)

Files changed (2)

SharpHammer/GameObject.cs

 		public T GetComponent<T>() where T : Component, new()
 		{
 			UInt16 type = Component._comptype[typeof(T)];
-			IntPtr chain = IntPtr.Add(_obj, 52); // shifts 52 byte to get chain pointer
-			UInt64 hdl = NativeCalls.cmp_findinstance2(_obj, type);
+			UInt64 hdl = NativeCalls.cmp_findinstance_bytype_inobj(_obj, type);
 			if (hdl == UInt64.MaxValue)
 				return null;
 			

SharpHammer/NativeCalls.cs

 		public static extern UInt64 cmp_findinstance(IntPtr chain, UInt16 type);
 
 		[DllImport(_engineDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern UInt64 cmp_findinstance2(IntPtr obj, UInt16 type);
+		public static extern UInt64 cmp_findinstance_bytype_inobj(IntPtr obj, UInt16 type);
 
 		[DllImport(_engineDll, CallingConvention = CallingConvention.Cdecl)]
 		public static extern int cmp_modifys(UInt64 hdl,