n3ss3s
2008-07-23 04:05:05
I still have to finish the actual finder, but here are the functions it'll use -
Type of an object stays always the same and UID changes, so for the finder when it finishes you're going to input the Type.
Thanks to Ben for his UID to Type algorithm and Yakman for teaching about the groundArray :)
Finder is done too, I'll just mess around a bit before releasing it.
Const
getGroundArray = 'g.fb';
getObject1 = 'o';
getObject2 = 'q';
getObject3 = 'r';
getObject4 = 's';
getObject5Array = 'H';
Function GetUIDAt(tX, tY: Integer): Integer;
Var
X, Y, Z, I, UID, o5a, C, Q: Integer;
getObj: TStringArray;
Begin
X := tX - SmartGetFieldInt(0, BaseX);
Y := tY - SmartGetFieldInt(0, BaseY);
For Q := 0 To 3 Do
Begin
Z := SmartGetFieldArray3DObject(0, getGroundArray, Q, X, Y);
If Z = 0 Then Continue;
getObj := [getObject1, getObject2, getObject3, getObject4, getObject5Array];
For I := 0 To 4 Do
If I < 4 Then
Begin
UID := SmartGetFieldObject(Z, getObj[i]);
If UID > 0 Then
Begin
Result := UID;
SmartFreeObject(UID);
Exit;
End;
End Else
Begin
o5a := SmartGetFieldObject(Z, getObj[i]);
For C := 0 To SmartGetFieldArraySize(o5a, '') - 1 Do
Begin
UID := SmartGetFieldArrayObject(o5a, '', C);
If UID > 0 Then
Begin
Result := UID;
SmartFreeObject(o5a);
SmartFreeObject(UID);
Exit;
End;
End;
End;
End;
End;
Function GetObjectType(UID: Integer): Integer; // Ben's math.
Begin
Result := (UID shr 14) and $7fff;
End;
Type of an object stays always the same and UID changes, so for the finder when it finishes you're going to input the Type.
Thanks to Ben for his UID to Type algorithm and Yakman for teaching about the groundArray :)
Finder is done too, I'll just mess around a bit before releasing it.