local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
local ____roomShape = require("functions.roomShape")
local getRoomShapeWidth = ____roomShape.getRoomShapeWidth
local ____utils = require("functions.utils")
local iRange = ____utils.iRange
--- Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
-- vertical line, inclusive on both ends.
-- 
-- If the first grid index is greater than the second grid index, the two will be swapped.
-- 
-- This function will throw a run-time error if the two provided grid indexes are not on the same
-- horizontal or vertical line.
function ____exports.getGridIndexesBetween(self, gridIndex1, gridIndex2, roomShape)
    if gridIndex1 > gridIndex2 then
        local oldGridIndex1 = gridIndex1
        local oldGridIndex2 = gridIndex2
        gridIndex1 = oldGridIndex2
        gridIndex2 = oldGridIndex1
    end
    local delta = gridIndex2 - gridIndex1
    local gridWidth = getRoomShapeWidth(nil, roomShape)
    local isOnHorizontalLine = delta <= gridWidth
    if isOnHorizontalLine then
        return iRange(nil, gridIndex1, gridIndex2)
    end
    local isOnVerticalLine = delta % gridWidth == 0
    if isOnVerticalLine then
        return iRange(nil, gridIndex1, gridIndex2, gridWidth)
    end
    error(((((((("Failed to get the grid indexes between " .. tostring(gridIndex1)) .. " and ") .. tostring(gridIndex2)) .. " for RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") since they are not on the same horizontal or vertical line.")
end
return ____exports
