rm push/pop
This commit is contained in:
@@ -29,14 +29,14 @@ function init(grid) {
|
||||
row = []
|
||||
for (bx = 0; bx < 8; bx++) {
|
||||
col = ((bx + by) & 1) ? dark_color : light_color
|
||||
push(row, shape.rect({
|
||||
row[] = shape.rect({
|
||||
pos: {x: bx * S + S / 2, y: by * S + S / 2},
|
||||
width: S, height: S,
|
||||
fill: {r: col.r, g: col.g, b: col.b, a: col.a},
|
||||
plane: 'game', layer: 0
|
||||
}))
|
||||
})
|
||||
}
|
||||
push(board_shapes, row)
|
||||
board_shapes[] = row
|
||||
}
|
||||
|
||||
next_id = 0
|
||||
|
||||
@@ -49,7 +49,7 @@ function compute_valid_moves(from) {
|
||||
dest = grid.at(to)
|
||||
if (length(dest) && dest[0].colour == piece.colour) continue
|
||||
if (rules.canMove(piece, from, to, grid))
|
||||
push(validMoves, to)
|
||||
validMoves[] = to
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ function compute_valid_moves(from) {
|
||||
dest = grid.at(to)
|
||||
if (length(dest) && dest[0].colour == piece.colour) continue
|
||||
if (rules.canMove(piece, from, to, grid))
|
||||
push(validMoves, to)
|
||||
validMoves[] = to
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ var grid_prototype = {
|
||||
// add an entity into a cell
|
||||
add(entity, pos) {
|
||||
var cx = px(pos), cy = py(pos);
|
||||
push(this.cell(cx, cy), entity);
|
||||
this.cell(cx, cy)[] = entity;
|
||||
entity.coord = [cx, cy];
|
||||
},
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ function compute_valid_moves(from) {
|
||||
dest = grid.at(to)
|
||||
if (length(dest) && dest[0].colour == piece.colour) continue
|
||||
if (rules.canMove(piece, from, to, grid))
|
||||
push(validMoves, to)
|
||||
validMoves[] = to
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user