Skip to content

Commit

Permalink
changed: Reduce wrap arguments count
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvideo1234 committed Sep 18, 2024
1 parent 88704e8 commit a1e989f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lua/trackassembly/trackasmlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,13 @@ end
* Out (R): 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1
* This is an example call for the input between L=1 and H=3
* nV - Current value being wrapped
* nL - Wrapper low value
* nH - Wrapper high value
* nH - Wrapper size/count value
* Returns the wrapped value mapped to the interval provided
]]
function GetWrap(nV, nL, nH)
function GetWrap(nV, nH)
if(nV == 0) then return nH end
if(nV >= nL and nV <= nH) then return nV end
local nC = nV % nH
if(nV >= 1 and nV <= nH) then return nV end
local nC = nV % nH -- Get the reminder
return (nC == 0) and nH or nC
end

Expand Down Expand Up @@ -2068,7 +2067,7 @@ function SwitchID(vID,vDir,oRec)
local nDir = mathFloor(tonumber(vDir) or 0)
local iDir = (((nDir > 0) and 1) or ((nDir < 0) and -1) or 0)
if(iDir == 0) then LogInstance("Direction mismatch"); return ID end
local ID = GetWrap(ID + iDir, 1, oRec.Size) -- Move around the snap
local ID = GetWrap(ID + iDir, oRec.Size) -- Move around the snap
local stPOA = LocatePOA(oRec,ID); if(not IsHere(stPOA)) then
LogInstance("Offset missing "..GetReport(ID)); return 1 end
return ID
Expand Down

0 comments on commit a1e989f

Please sign in to comment.