This is from my own Include:
Function Location(Where: String): Boolean;
var
Dist: Integer;
P: TPoint;
begin
MakeCompass('N');
Case LowerCase(Where) Of
'cw':
Result := (FoundSymbol(2, P, Dist) OR FoundSymbol(4, P, Dist));
'naturejungle':
Result := (FoundSymbol(3, P, Dist) AND FoundSymbol(6, P, Dist));
'altar':
Result := (FoundSymbol(3, P, Dist) AND (NOT FoundSymbol(6, P, Dist)));
'ruins':
Result := FoundSymbol(7, P, Dist);
else
writeln('Invalid Location');
end;
end;
You can find out your own location by doing:
Function GetMyLocation: String;
var
I: Integer;
ListOfLocations: TStringArray;
begin
ListOfLocations:= ['cw', 'altar', 'ruins'];
For I:= 0 To High(ListOfLocations) Do
If (Location(ListOfLocations[I])) then
begin
Result:= ListOfLocations[I];
break;
end;
end;
OR you can just rewrite the function to have such a thing built in.. Something like:
type
Location = (CW, ALTAR, RUINS);
Function FoundSymbol(Where: Location): Boolean;
begin
//Iunno some crap here.. I have my own but I don't wanna publicize it yet.
end;
Function GetLocation: Location;
var
I: Integer;
Locations: TIntegerArray;
begin
Locations:= [CW, ALTAR, RUINS];
For I:= 0 To High(Locations) Do
Case Locations[I] Of
CW:
if FoundSymbol(CW) then
begin
Result:= CW;
break;
end;
ALTAR:
if FoundSymbol(ALTAR) then
begin
Result:= ALTAR;
break;
end;
RUINS:
if FoundSymbol(RUINS) then
begin
Result:= RUINS;
break;
end;
end;
begin
writeln(GetLocation);
end.