1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/lib/BattleAction.h
Ivan Savenko 2ff07fa66a - Next part of animation system:
-- Reduced memory usage for images with margins
-- Implemented RLE compression
- Linux-related changes:
-- build system updated to include changed paths
-- new dependency: boost-program-options
-- configure option --disable-debug will produce optimized build

- Several gcc compile fixes
- Optimized CPU usage on town screens
- Removed several includes from headers
- Possible fix for #496
2011-02-06 17:26:27 +00:00

44 lines
1.5 KiB
C++

#pragma once
#ifndef __BATTLEACTION_H__
#define __BATTLEACTION_H__
#include "../global.h"
/*
* BattleAction.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CStack;
struct DLL_EXPORT BattleAction
{
ui8 side; //who made this action: false - left, true - right player
ui32 stackNumber;//stack ID, -1 left hero, -2 right hero,
enum ActionType
{
INVALID = -1, NO_ACTION = 0, HERO_SPELL, WALK, DEFEND, RETREAT, SURRENDER, WALK_AND_ATTACK, SHOOT, WAIT, CATAPULT, MONSTER_SPELL, BAD_MORALE, STACK_HEAL
};
ui8 actionType; //use ActionType enum for values
//10 = Monster casts a spell (i.e. Faerie Dragons) 11 - Bad morale freeze 12 - stacks heals another stack
THex destinationTile;
si32 additionalInfo; // e.g. spell number if type is 1 || 10; tile to attack if type is 6
template <typename Handler> void serialize(Handler &h, const int version)
{
h & side & stackNumber & actionType & destinationTile & additionalInfo;
}
BattleAction();
static BattleAction makeDefend(const CStack *stack);
static BattleAction makeWait(const CStack *stack);
static BattleAction makeMeleeAttack(const CStack *stack, const CStack * attacked, THex attackFrom = THex::INVALID);
static BattleAction makeShotAttack(const CStack *shooter, const CStack *target);
static BattleAction makeMove(const CStack *stack, THex dest);
};
#endif // __BATTLEACTION_H__