Set "user action" flag on attack action added by player
This commit is contained in:
parent
62ac46376f
commit
097af6e93f
2 changed files with 4 additions and 2 deletions
|
@ -27,9 +27,11 @@ namespace game {
|
|||
|
||||
class AttackAction : public ObjectAction {
|
||||
public:
|
||||
AttackAction(std::shared_ptr<SpatialObject> object, float range = kDefaultAttackRange) :
|
||||
AttackAction(std::shared_ptr<SpatialObject> object, float range = kDefaultAttackRange, bool userAction = false) :
|
||||
ObjectAction(ActionType::AttackObject, std::move(object)),
|
||||
_range(range) {
|
||||
|
||||
_userAction = userAction;
|
||||
}
|
||||
|
||||
std::shared_ptr<SpatialObject> target() const { return std::static_pointer_cast<SpatialObject>(_object); }
|
||||
|
|
|
@ -127,7 +127,7 @@ bool SelectionOverlay::handleMouseButtonDown(const SDL_MouseButtonEvent &event)
|
|||
case ContextualAction::Attack: {
|
||||
shared_ptr<Creature> partyLeader(_game->party().getLeader());
|
||||
ActionQueue &actions = partyLeader->actionQueue();
|
||||
actions.add(make_unique<AttackAction>(static_pointer_cast<Creature>(selectedObject), partyLeader->getAttackRange()));
|
||||
actions.add(make_unique<AttackAction>(static_pointer_cast<Creature>(selectedObject), partyLeader->getAttackRange(), true));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue