format
Some checks failed
Continuous Integration / Code Formatting (push) Successful in 33s
Continuous Integration / Code Quality Check (push) Successful in 28s
Continuous Integration / Test Execution (push) Failing after 16s
Continuous Integration / CI Summary (push) Failing after 3s

This commit is contained in:
2025-10-01 15:35:34 +04:00
parent 1f1c394587
commit 35ee2f9a5e
28 changed files with 1962 additions and 663 deletions

View File

@@ -25,7 +25,12 @@ static func is_valid_grid_position(pos: Vector2i, grid_size: Vector2i) -> bool:
##
## Returns:
## bool: True if position is valid, False if out of bounds
return pos.x >= 0 and pos.y >= 0 and pos.x < grid_size.x and pos.y < grid_size.y
return (
pos.x >= 0
and pos.y >= 0
and pos.x < grid_size.x
and pos.y < grid_size.y
)
static func validate_grid_integrity(grid: Array, grid_size: Vector2i) -> bool:
@@ -46,7 +51,8 @@ static func validate_grid_integrity(grid: Array, grid_size: Vector2i) -> bool:
if grid.size() != grid_size.y:
DebugManager.log_error(
"Grid height mismatch: %d vs %d" % [grid.size(), grid_size.y], "Match3"
"Grid height mismatch: %d vs %d" % [grid.size(), grid_size.y],
"Match3"
)
return false
@@ -57,20 +63,28 @@ static func validate_grid_integrity(grid: Array, grid_size: Vector2i) -> bool:
if grid[y].size() != grid_size.x:
DebugManager.log_error(
"Grid row %d width mismatch: %d vs %d" % [y, grid[y].size(), grid_size.x], "Match3"
(
"Grid row %d width mismatch: %d vs %d"
% [y, grid[y].size(), grid_size.x]
),
"Match3"
)
return false
return true
static func safe_grid_access(grid: Array, pos: Vector2i, grid_size: Vector2i) -> Node2D:
static func safe_grid_access(
grid: Array, pos: Vector2i, grid_size: Vector2i
) -> Node2D:
# Safe grid access with comprehensive bounds checking
if not is_valid_grid_position(pos, grid_size):
return null
if pos.y >= grid.size() or pos.x >= grid[pos.y].size():
DebugManager.log_warn("Grid bounds exceeded: (%d,%d)" % [pos.x, pos.y], "Match3")
DebugManager.log_warn(
"Grid bounds exceeded: (%d,%d)" % [pos.x, pos.y], "Match3"
)
return null
var tile = grid[pos.y][pos.x]