SC2API
An API for AI for StarCraft II
sc2_action.h
1 #pragma once
2 
3 #include "sc2_common.h"
4 #include "sc2_typeenums.h"
5 #include "sc2_gametypes.h"
6 #include <vector>
7 #include <stdint.h>
8 
9 namespace sc2 {
10 
12 struct ActionRaw {
14  enum TargetType {
21  };
22 
26  std::vector<Tag> unit_tags;
33 
35  ActionRaw();
36 
38 
39  bool operator==(const ActionRaw& a) const {
40  if (ability_id != a.ability_id) {
41  return false;
42  }
43  if (target_type != a.target_type) {
44  return false;
45  }
46  if (target_tag != a.target_tag) {
47  return false;
48  }
49  if (target_point.x != a.target_point.x) {
50  return false;
51  }
52  if (target_point.y != a.target_point.y) {
53  return false;
54  }
55  return true;
56  }
57 };
58 
59 typedef std::vector<ActionRaw> RawActions;
60 
64  enum TargetType {
68  TargetMinimap
69  };
70 
78  bool queued;
79 };
80 
83  Point2DI center_minimap;
84 };
85 
87 enum class PointSelectionType {
89  PtSelect = 1,
91  PtToggle = 2,
93  PtAllType = 3,
95  PtAddAllType = 4
96 };
97 
100  Point2DI select_screen;
101  PointSelectionType type;
102 };
103 
108  std::vector<Rect2DI> select_screen;
109  bool select_add;
110 };
111 
115  std::vector<SpatialUnitCommand> unit_commands;
117  std::vector<SpatialCameraMove> camera_moves;
119  std::vector<SpatialSelectPoint> select_points;
121  std::vector<SpatialSelectRect> select_rects;
122 };
123 
124 }
Tag target_tag
The target of this action. Valid only when target_type == TargetUnitTag.
Definition: sc2_action.h:30
Possible actions for feature layers.
Definition: sc2_action.h:113
ActionRaw()
Constructor.
AbilityID ability_id
The ID of the ability to invoke.
Definition: sc2_action.h:72
std::vector< SpatialUnitCommand > unit_commands
Commands to selected units.
Definition: sc2_action.h:115
std::vector< Tag > unit_tags
Units this action applies to. In normal use, this would be the currently selected units...
Definition: sc2_action.h:26
Common data types, including points, rectangles and colors.
TargetType
Type of target. Target types are mutually exclusive.
Definition: sc2_action.h:14
2D integer point.
Definition: sc2_common.h:95
Definition: sc2_common.h:49
Definition: sc2_action.h:9
The target is a point.
Definition: sc2_action.h:20
A list of enums provided for your convenience.
The target is a unit tag, could also be a snapshot in the fog-of-war.
Definition: sc2_action.h:18
No target generally means &#39;self&#39;, e.g., a order to make a unit.
Definition: sc2_action.h:16
AbilityID ability_id
The ID of the ability to invoke.
Definition: sc2_action.h:24
TargetType target_type
If this action should be applied to the main game screen or the minimap.
Definition: sc2_action.h:74
Point2DI target
Target point on the screen or minimap, if required.
Definition: sc2_action.h:76
TargetType
If this action should apply to the screen or minimap.
Definition: sc2_action.h:64
std::vector< SpatialSelectPoint > select_points
Selecting by point.
Definition: sc2_action.h:119
bool queued
Indicates if this action should replace or queue behind other actions.
Definition: sc2_action.h:78
Types used in setting up a game.
Point selection.
Definition: sc2_action.h:99
Point2D target_point
The target point for this action. Valid only when target_type == TargetPosition.
Definition: sc2_action.h:32
Apply this action to the main game screen.
Definition: sc2_action.h:66
std::vector< SpatialCameraMove > camera_moves
Camera movement.
Definition: sc2_action.h:117
std::vector< SpatialSelectRect > select_rects
Selecting by rectangles.
Definition: sc2_action.h:121
An action (command or ability) applied to selected units when using feature layers or the rendered in...
Definition: sc2_action.h:62
An action (command or ability) applied to a unit or set of units.
Definition: sc2_action.h:12
Where to move the camera to on the minimap.
Definition: sc2_action.h:82
TargetType target_type
Which target fields are valid.
Definition: sc2_action.h:28
bool operator==(const ActionRaw &a) const
Comparison overload.
Definition: sc2_action.h:39
Definition: sc2_action.h:107