SRL Archive - SRL Archives

TBoxInTBox


Sir R. M8gic1an

2009-05-03 00:33:43

sprang up in a discussion between me, nava, n3ss and mixster on how to detect if we're fishing… >.>

if placed in srl i think it'd probably fit best in math.scar


{*******************************************************************************
function TBoxInTBox(TB1, TB2: TBox): boolean;
By: Rasta Magician and mixster
Description: Returns true if one of the boxes overlaps the other
*******************************************************************************}
function TBoxInTBox(TB1, TB2: TBox): boolean;
begin
Result := false;
if not (InRange(TB1.x1, TB2.x1, TB2.x2) or
InRange(TB1.x2, TB2.x1, TB2.x2) or
InRange(TB2.x1, TB1.x1, TB1.x2) or
InRange(TB2.x2, TB1.x1, TB1.x2))
then
exit;

if not (InRange(TB1.y1, TB2.y1, TB2.y2) or
InRange(TB1.y2, TB2.y1, TB2.y2) or
InRange(TB2.y1, TB1.y1, TB1.y2) or
InRange(TB2.y2, TB1.y1, TB1.y2))
then
exit;

Result := true;
end;

~RM

Nava2

2009-05-03 09:44:10

it wasn't how to detect! It was how to track a fishing spot <3

It is nice and I might toss this in WizzyPlugin, just because.

Also I have my own version of this I will post up.