Fix crash when filtering moves that are off the board
This commit is contained in:
parent
064ed97513
commit
2a1711fda2
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/edge.png-f8eb0bb54aa0cd5dd98a7aca825fc2d4.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/export/edge.png"
|
||||||
|
dest_files=[ "res://.import/edge.png-f8eb0bb54aa0cd5dd98a7aca825fc2d4.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
|
@ -65,7 +65,13 @@ func get_valid_piece_moves(piece):
|
||||||
# @TODO Filter based on game state
|
# @TODO Filter based on game state
|
||||||
var moves = []
|
var moves = []
|
||||||
for m in possible_moves:
|
for m in possible_moves:
|
||||||
var target_square = self.board_squares[m['pos']]
|
var target_square = null
|
||||||
|
if self.board_squares.has(m['pos']):
|
||||||
|
target_square = self.board_squares[m['pos']]
|
||||||
|
if target_square == null:
|
||||||
|
# Move it off the board
|
||||||
|
print("Move to ", m['pos'], " is not valid due to not being on the board")
|
||||||
|
continue
|
||||||
if target_square['piece']:
|
if target_square['piece']:
|
||||||
# something here
|
# something here
|
||||||
if pieces_hostile(piece, target_square['piece']):
|
if pieces_hostile(piece, target_square['piece']):
|
||||||
|
|
Loading…
Reference in New Issue