action: fixed stack error when no unit is hit
authorLukas Krickl <lukas@krickl.dev>
Sat, 23 Aug 2025 03:37:31 +0000 (05:37 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 23 Aug 2025 03:37:31 +0000 (05:37 +0200)
src/action.s

index a753cb6dd403975e6f26fee0d0b60d2786731114..d121c6b7f9b70d34c4f2671b223e99e6ab7ad14d 100644 (file)
@@ -228,12 +228,12 @@ unit_action_attack_damage_calc:
        call unit_attack_get_attack_tile
        call unit_find_at
 
+       ldnull bc
        ld a, h
        or a, l
-       ldnull bc
+       pop de
        ret z ; no unit found
 
-       pop de
        push hl
        pop bc
        ; de = attacker