Extract battleactiontype_t/battleaction_t into battleaction.h
Matches the existing battleability.h/battlefighter.h split - keeps battle.h focused on the overall battle_t state machine rather than also owning the action data shape. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "battlefighter.h"
|
#include "battlefighter.h"
|
||||||
|
#include "battleaction.h"
|
||||||
|
|
||||||
#define BATTLE_FIGHTER_COUNT_MAX 8
|
#define BATTLE_FIGHTER_COUNT_MAX 8
|
||||||
|
|
||||||
@@ -46,28 +47,11 @@ typedef enum {
|
|||||||
BATTLE_STATE_COUNT
|
BATTLE_STATE_COUNT
|
||||||
} battlestate_t;
|
} battlestate_t;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
BATTLE_ACTION_NONE, // No action decided yet for this fighter this round.
|
|
||||||
BATTLE_ACTION_ATTACK,
|
|
||||||
|
|
||||||
BATTLE_ACTION_COUNT
|
|
||||||
} battleactiontype_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
battleactiontype_t type;
|
|
||||||
uint8_t targetIndex; // Meaningful for BATTLE_ACTION_ATTACK.
|
|
||||||
} battleaction_t;
|
|
||||||
|
|
||||||
typedef void (*battlestatechangedcallback_t)(
|
typedef void (*battlestatechangedcallback_t)(
|
||||||
const battlestate_t previous,
|
const battlestate_t previous,
|
||||||
const battlestate_t next
|
const battlestate_t next
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef void (*battleactiondecidedcallback_t)(
|
|
||||||
const battlefighter_t *fighter,
|
|
||||||
const battleaction_t *action
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
battlestate_t state;
|
battlestate_t state;
|
||||||
battlefighter_t fighters[BATTLE_FIGHTER_COUNT_MAX];
|
battlefighter_t fighters[BATTLE_FIGHTER_COUNT_MAX];
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
|
#include "battlefighter.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BATTLE_ACTION_NONE, // No action decided yet for this fighter this round.
|
||||||
|
BATTLE_ACTION_ATTACK,
|
||||||
|
|
||||||
|
BATTLE_ACTION_COUNT
|
||||||
|
} battleactiontype_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
battleactiontype_t type;
|
||||||
|
uint8_t targetIndex; // Meaningful for BATTLE_ACTION_ATTACK.
|
||||||
|
} battleaction_t;
|
||||||
|
|
||||||
|
typedef void (*battleactiondecidedcallback_t)(
|
||||||
|
const battlefighter_t *fighter,
|
||||||
|
const battleaction_t *action
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user