fix: remove_die_from_active now copies data backwards and decrements active count

This commit is contained in:
Sara 2025-09-17 22:00:43 +02:00
parent 718bf61d0c
commit f99d414667

View file

@ -26,7 +26,8 @@ size_t add_die_to_active(enum die_type die) {
} }
void remove_die_from_active(size_t index) { void remove_die_from_active(size_t index) {
memmove(active_dice_set + index + 1, active_dice_set + index, MAX_ACTIVE_DICE - index - 1); memcpy(active_dice_set + index, active_dice_set + index + 1, MAX_ACTIVE_DICE - index - 1);
--current_active_count;
} }
struct roll_result_type roll_active_dice_set(enum die_type die) { struct roll_result_type roll_active_dice_set(enum die_type die) {