// * the manager of the battlefield
struct H3CombatManager : public H3Manager
{
protected:
    h3unk _f_0038[4];
public:
    // * +3C
    // * see BATTLE_ACTION
    INT32 action;
    enum BATTLE_ACTION
    {
        BA_CANCEL, //0 = Cancel Action(the stack can do a different action now but it may still be impossible to force it to do most actions through ERM).
        BA_CAST_SPELL, //1 = Hero casts a spell
        BA_WALK,
        BA_DEFEND,
        BA_RETREAT,
        BA_SURRENDER,
        BA_WALK_ATTACK,
        BA_SHOOT,
        BA_WAIT,
        BA_CATAPULT,
        BA_MONSTER_SPELL,
        BA_FIRST_AID_TENT,
        BA_NOTHING //12 = No action(can be to disable stack for this round)
    };
    // * +40
    INT32 actionParameter;
    // * +44
    INT32 actionTarget;
    // * +48
    INT32 actionParameter2;
    // * +4C
    INT8 accessibleSquares[187];
    // * +107
    INT8 accessibleSquares2[187];
protected:
    h3unk _f_01C2[2];
public:
    // * +1C4
    H3CombatSquare squares[187];
    // * +5394
    INT32 landType;
protected:
    h3unk _f_5398[12];
public:
    // * +53A4
    INT32 siegeKind;
    // * +53A8
    INT32 hasMoat;
protected:
    h3unk _f_53AC[4];
public:
    // * +53B0
    H3LoadedPCX16 *drawBuffer;
protected:
    h3unk _f_53B4[4];
public:
    // * +53B8
    BOOL doNotDrawShade;
    // * +53BC
    // * H3MapItem where combat is taking place
    H3MapItem *mapitem;
    // * +53C0
    // * special terrain type used
    INT32 specialTerrain;
    // * +53C4
    BOOL antiMagicGarrison;
    // * +53C8
    // * town structure where combat is taking place
    H3Town *town;
    // * +53CC
    // * hero structures from each side
    H3Hero *hero[2];
    // * +53D4
    // * spell power from each side
    INT32 heroSpellPower[2];
protected:
    h3unk _f_53DC[8];
    // * +53E4
    UINT32 HeroAnimation[2];
    // * +53EC
    UINT32 HeroAnimationCadre[2];
    h3unk _f_53F4[16];
    // * +5404
    H3LoadedDEF *heroDefLoaded[2];
    // * +540C
    H3LoadedDEF *heroFlagLoaded[2];
    // * +5414
    INT32 heroFlagFrame[2];
    // * +541C
    RECT heroUpdateRect[2];
    // * +543C
    RECT heroFlagUpdateRect[2];
    // * +545C
    // * eagle eye 2x vector
    H3Vector<INT32> eagleEyeSpells[2];
    // * chain lightning?
    h3unk _f_547C[40];
public:
    // * +54A4
    UINT8 isNotAI[2];
    // * +54A6
    UINT8 isHuman[2];
    // * +54A8
    INT32 heroOwner[2];
    // * +54B0
    BOOL8 artifactAutoCast[2];
protected:
    h3unk _f_54B2[2];
public:
    // * +54B4
    BOOL heroCasted[2];
    // * +54BC
    INT32 heroMonCount[2];
    // * +54C4
    H3Army *army[2];
    // * +54CC
    // * a two-sided array of 21 stacks for each side of combat
    H3CombatMonster stacks[2][21];
protected:
    h3unk _f_1329C[4];
public:
    // * +132A0
    INT32 turnsSinceLastEnchanterCast[2];
protected:
    h3unk _f_132A8[16];
public:
    // * +132B8
    INT32 currentMonSide;
    // * +132BC
    INT32 currentMonIndex;
    // * +132C0
    INT32 currentActiveSide;
    // * +132C4
    INT32 autoCombat;
    // * +132C8
    H3CombatMonster *activeStack;
    // * +132CC
    INT8 blueHighlight;
protected:
    h3unk _f_132CD[3];
public:
    // * +132D0
    INT32 creature_at_mouse_pos;
    // * +132D4
    INT32 mouse_coord;
    // * +132D8
    INT32 attacker_coord;
    // * +132DC
    // * the icons of CRCOMBAT.def, see H3MouseManager::H3MouseBattleFieldCursorType
    INT32 move_type;
protected:
    h3unk _f_132E0[20];
public:
    // * +132F4
    INT32 siegeKind2;
    // * +132F8
    BOOL finished;
    // * +132FC
    struct H3Dlg *dlg;
protected:
    h3unk _f_13300[356];
    // * +13464
    PCHAR backgroundPcxName;
    // * +13468
    //INT16 AdjascentSquares[1122];
public:
    H3AdjacentSquares adjacentSquares[187];
protected:
    h3unk _f_13D2C[12];
    // * +132E8
    RECT updateRect;
    h3unk _f_13D48[12];
    // * +13D54
    INT cmNumWinPcxLoaded;
public:
    // * +13D58
    // * information about obstacles on battlefield
    H3Vector<H3Obstacle> obstacleInfo;
    // * +13D68
    BOOL tacticsPhase;
    // * +13D6C
    INT32 turn;
    // * +13D70
    INT32 tacticsDifference;
protected:
    h3unk _f_13D74[4]; // spell related?
    // * +13D78
    TownTowerLoaded Towers[3];
public:
    // * +13DE4
    INT32 waitPhase;
protected:
    // * +13DE8
    INT32 HeroDAttack;
    // * +13DEC
    INT32 HeroDDefence;
    // * +13DF0
    INT32 HeroDSpellPower2;
    // * +13DF4
    INT32 HeroDSpellPoints;
    // * +13DF8
    INT32 TownPicturesLoaded[90];
public:
    // * +13F60
    // * hit points of town walls
    INT32 fort_walls_hp[18];
    // * +13FA8
    INT32 fort_walls_alive[18];
protected:
    UINT8 f13FF0[4];
public:
    // * +13FF4
    // * pcx of grids
    H3LoadedPCX *CCellGrdPcx;
    // * +13FF8
    // * pcx to shade in blue using cheat menu
    H3LoadedPCX *CCellShdPcx;
protected:
    // * +13FFC
    INT32 GlobalCardeIndex;
    h3unk _f_14000[268];
public:
    // functions
    void SimulateMouseAtHex(int hex_id) { return THISCALL_2(void, 0x477550, this, hex_id); }
    BOOL8 CanCastSpellAtCoord(int spell_id, int spell_expertise, int coordinates)
    {
        return THISCALL_7(BOOL8, 0x5A3CD0, this, spell_id, spell_expertise, coordinates, currentActiveSide, 1, 0);
    }
    void WinBattle(void) { return THISCALL_2(void, 0x468F80, this, 1 - currentActiveSide); }
    void LoadSpell(INT32 spell_id) { return THISCALL_3(void, 0x59EF60, this, spell_id, 0); }
    void CastSpell(int spell_id, int hex_ix, int cast_type_012, int hex2_ix, int skill_level, int spell_power)
    {
        THISCALL_7(void, 0x5A0140, this, spell_id, hex_ix, cast_type_012, hex2_ix, skill_level, spell_power);
    }
    H3CombatMonster *GetResurrectionTarget(INT32 coordinate) { return THISCALL_4(H3CombatMonster*, 0x5A3FD0, this, currentActiveSide, coordinate, 0); }
    H3CombatMonster *GetAnimateDeadTarget(INT32 coordinate) { return THISCALL_3(H3CombatMonster*, 0x5A4260, this, currentActiveSide, coordinate); }
    int NextCreatureToMove(void) { return THISCALL_2(int, 0x464C60, this, 1); }
    BOOL8 IsHiddenBattle(void) { return THISCALL_1(BOOL8, 0x46A080, this); }
    BOOL8 IsBattleOver(void) { return THISCALL_1(BOOL8, 0x46A080, this); }
    void Refresh() { Refresh(1, 0, 1); }
    void Refresh(BOOL redrawScreen, INT timeDelay, BOOL redrawBackground) { THISCALL_7(void, 0x493FC0, this, redrawScreen, 0, 0, timeDelay, redrawBackground, 0); }
    void ShadeSquare(int index);
};