X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=inline;f=src%2Fbattle%2FTargetSelection.h;fp=src%2Fbattle%2FTargetSelection.h;h=664e9607e86caaf374f53d5f1f6d2a3151f59554;hb=3c72a71fbf6de96333a641051a20c6bf8b3a5df3;hp=0000000000000000000000000000000000000000;hpb=7946f704a4cd3a985d2fb523079fce7fa14c341e;p=l2e.git diff --git a/src/battle/TargetSelection.h b/src/battle/TargetSelection.h new file mode 100644 index 0000000..664e960 --- /dev/null +++ b/src/battle/TargetSelection.h @@ -0,0 +1,67 @@ +/* + * TargetSelection.h + * + * Created on: Aug 9, 2012 + * Author: holy + */ + +#ifndef BATTLE_TARGETSELECTION_H_ +#define BATTLE_TARGETSELECTION_H_ + +#include + +namespace battle { + +class BattleState; + +class TargetSelection { + +public: + explicit TargetSelection(BattleState *battle = 0, bool multiple = false, bool atEnemy = true); + +public: + bool TargetsEnemies() const { return enemy; } + bool TargetsHeroes() const { return !TargetsEnemies(); } + bool IsSelected(int index) const { return index >= 0 && index < int(selected.size()) && selected[index]; } + bool HasSelected() const { return selection >= 0; } + int SingleSelection() const { return selection; } + + bool SelectMultiple() const { return multiple; } + void SetMultiple() { multiple = true; } + bool SelectSingle() const { return !SelectMultiple(); } + void SetSingle() { multiple = false; } + + void SelectEnemies(); + void SelectHeroes(); + void Select(int index) { selected[index] = true; selection = index; } + void Unselect(int index) { selected[index] = false; } + void UnselectAll() { selected.assign(selected.size(), false); selection = -1; } + + void Reset(); + void Resize(int num) { selected.resize(num, false); } + + void MoveUp(); + void MoveRight(); + void MoveDown(); + void MoveLeft(); + void Select() { Select(cursor); } + void Unselect() { Unselect(cursor); } + int Current() const { return cursor; } + bool CurrentIsSelected() { return IsSelected(cursor); } + +private: + void FindNextEnemy(); + +private: + BattleState *battle; + std::vector selected; + int selection; + int cursor; + bool multiple; + bool enemy; + +}; + +} + +#endif /* BATTLE_TARGETSELECTION_H_ */