fix(client): address PR #11 review — type safety, perf, tests
Add Dictionary validation in game_state visible_tiles loop to prevent crash on malformed data (Hoshe critical). Skip redundant modulate.a writes (Hoshe suggestion). Add 3 tests: malformed visible_tiles, facing rotation accuracy, v1 backward compatibility. Clarify D-033 Phase 1/Phase 2 comments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,8 @@ func apply_snapshot(snapshot: Dictionary) -> void:
|
||||
if not has_explicit_positions:
|
||||
visible_positions.clear()
|
||||
for vtile in snapshot.visible_tiles:
|
||||
if not vtile is Dictionary or not vtile.has("x") or not vtile.has("y"):
|
||||
continue
|
||||
var pos := Vector2i(vtile.x, vtile.y)
|
||||
if vtile.has("visibility"):
|
||||
visibility_sectors[pos] = vtile.visibility
|
||||
|
||||
Reference in New Issue
Block a user