jp @again
; resets all moves
- ; of all actors un p0 and p1_unts
+ ; of all actors in p0 and p1_unts
unit_reset_all_moves:
+ ld b, UNITS_MAX * PLAYERS
+ ld hl, p0_units
+@loop:
+ push hl
+ ld de, act_moves+1
+ add hl, de ; hl = act_moves_max
+
+ ld a, [hl]
+ dec hl ; hl = current moves
+ ld [hl], a ; moves are now reset
+
+ pop hl
+ ld de, act_size
+ add hl, de ; move to next act
+
+ dec b
+ jr z, @loop REL
+
ret