Implement target-tile selection and Shift-queueing for all unit actions
This commit is contained in:
@@ -35,8 +35,8 @@ struct UnitAction {
|
||||
|
||||
UnitAction() = default;
|
||||
UnitAction(UnitActionType t) : type(t) {}
|
||||
UnitAction(UnitActionType t, int x, int y, const QString &data = "")
|
||||
: type(t), targetX(x), targetY(y), extraData(data) {}
|
||||
UnitAction(UnitActionType t, int x, int y, const QString &data = "", int uId = -1)
|
||||
: type(t), targetX(x), targetY(y), targetUnitId(uId), extraData(data) {}
|
||||
UnitAction(UnitActionType t, int targetId)
|
||||
: type(t), targetUnitId(targetId) {}
|
||||
|
||||
@@ -65,9 +65,10 @@ public:
|
||||
int targetTileX;
|
||||
int targetTileY;
|
||||
|
||||
// Action Queue
|
||||
// Currently executing action & subsequent Action Queue
|
||||
UnitAction currentAction;
|
||||
std::deque<UnitAction> actionQueue;
|
||||
int maxQueueSize = 5;
|
||||
int maxQueueSize = 15;
|
||||
|
||||
// Road Construction Route (tile-by-tile road paving)
|
||||
std::vector<std::pair<int, int>> roadRoute;
|
||||
@@ -88,13 +89,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool hasActiveAction() const {
|
||||
return currentAction.isValid() || state != UnitState::Idle || hasRoadRoute();
|
||||
}
|
||||
|
||||
bool queueAction(const UnitAction &action);
|
||||
void clearActionQueue();
|
||||
bool hasQueuedAction() const { return !actionQueue.empty(); }
|
||||
bool hasQueuedActionType(UnitActionType type) const;
|
||||
bool hasQueuedImprovementAt(int tx, int ty) const;
|
||||
bool hasQueuedCityAt(int tx, int ty) const;
|
||||
void removeQueuedActionsOfType(UnitActionType type);
|
||||
UnitAction popNextQueuedAction();
|
||||
const UnitAction* peekNextQueuedAction() const;
|
||||
QString getActionSummary(const UnitAction &act) const;
|
||||
QString getQueuedActionSummary() const;
|
||||
|
||||
// Attack cooldown / flash
|
||||
|
||||
Reference in New Issue
Block a user