Fixed column movement
This commit is contained in:
@@ -190,22 +190,25 @@ function domove(cmd, isauto, valid, nums, from, to, amt, i, si, ec, efc) {
|
||||
efc = 0 # reuse for starting index in source tableau
|
||||
if(from < 9) efc = tablens[rfrom] - amt
|
||||
if(efc > -1) { # check if we aren't moving more cards than allowed
|
||||
for(i=0;i<amt;i++) { # move the cards as usual
|
||||
if(from < 9) { # re-read the source value if looping over a column
|
||||
cval = table[rfrom, efc+i]
|
||||
if(cval == "") break # we try to read more than is available
|
||||
else cval = int(cval)
|
||||
}
|
||||
si = table[rto,tablens[rto]-1] # target value
|
||||
if(stackcond(si, cval) || length(si) == 0) {
|
||||
table[rto,tablens[rto]] = cval # copy the card there
|
||||
tablens[rto]++ # increase tableau length
|
||||
if(from < 9) { # re-read the source value if looping over a column
|
||||
cval = table[rfrom, efc] # checking the first stack value
|
||||
if(cval == "") cval = -1 # we try to read more than is available
|
||||
else cval = int(cval)
|
||||
}
|
||||
si = table[rto,tablens[rto]-1] # target value
|
||||
if(cval > -1 && (stackcond(si, cval) || tablens[rto] == 0)) {
|
||||
for(i=0;i<amt;i++) { # move the cards directly
|
||||
if(from < 9) { # moving from a tableau
|
||||
table[rto,tablens[rto]] = table[rfrom,efc+i] # copy the card there
|
||||
delete table[rfrom,efc+i] # delete the card
|
||||
tablens[rfrom]-- # decrease tableau length
|
||||
} else fcell[from - 9] = -1 # moving from a free cell
|
||||
} else { # moving from a free cell
|
||||
table[rto,tablens[rto]] = fcell[from - 9] # copy the card there
|
||||
fcell[from - 9] = -1
|
||||
}
|
||||
tablens[rto]++ # increase tableau length
|
||||
valid = 1 # mark the move as valid
|
||||
} else break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(fcell[to - 9] == -1) { # moving to a free cell
|
||||
|
||||
Reference in New Issue
Block a user