
------------------------------------------------------------------------------
-- 
function GetObjectHintPosition(objectName)
	assert(playField:HasObject(objectName) == true or 
           (playField:HasObject(objectName) == false and playField:IsActiveToolObject(objectName) == true) );
    Log("Lua: GetObjectHintPosition(\'"..objectName.."\')");

	local GetObjectAccessPosition = function(objectName)
		local targetObjName = objectName;
		local targetObjZone;

		for i,v in pairs(gameState.zoomZones) do
			if ( v.HasObject(targetObjName) == true ) then      --// v:HasObject ??? 8|
				targetObjName = GetParentZoomZoneActiveObjectName(v);
				targetObjZone = v;
				break;
			end
		end
		
		assert(targetObjZone ~= nil);
		local obj;
		if ( gameState.activeZone == targetObjZone) then
		    obj = playField:GetObject(objectName);
		elseif (targetObjName ~= nil and gameState.activeZone.HasObject(targetObjName) == true) then
		    obj = playField:GetObject(targetObjName);
		else
		    assert(gameState.activeZone.close_button ~= nil or gameState.activeZone.navigationObject ~= nil);
		    obj = (gameState.activeZone.close_button ~=nil and gameState.activeZone.close_button or playField:GetObject(gameState.activeZone.navigationObject));
		end
		return Vector(obj:GetScrX(), obj:GetScrY());
	end

	if (playField:IsActiveToolObject(objectName) == true) then
		assert(gameState.toolMap[objectName] ~= nil);
		return GetObjectAccessPosition(gameState.toolMap[objectName]);
	else
		return GetObjectAccessPosition(objectName);
	end
end

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- 
function GetParentZoomZoneActiveObjectName(zone)
    assert(gameState.activeZone ~= nil);
    
--	if (zone.parentZoomZone == nil or gameState.activeZone == zone) then
	if (zone.parentZoomZone == nil or zone.parentZoomZone == gameState.activeZone) then
		return zone.GetActiveObject();
	else
		return GetParentZoomZoneActiveObjectName(zone.parentZoomZone);
	end
end
