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:
2026-02-12 01:07:02 +01:00
co-authored by Claude Opus 4.6
parent 30b028e85a
commit 64897a40b3
5 changed files with 68 additions and 5 deletions
+2
View File
@@ -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