Skip to content

Commit 0a79825

Browse files
committed
Fixed issue Blizzard#306.
Cloak now works properly
1 parent 6229e13 commit 0a79825

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

include/sc2api/sc2_unit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ class Unit {
101101
CloakedDetected = 2,
102102
//! No cloaking.
103103
NotCloaked = 3,
104-
//! Could not determine cloaking state.
105-
Unknown = 4
104+
//! Cloaked ally, though not sure why this is necessary.
105+
CloakedAllied = 4
106106
};
107107

108108
//! If the unit is shown on screen or not.

src/sc2api/sc2_proto_to_pods.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ bool Convert(const SC2APIProtocol::CloakState& cloak_proto, Unit::CloakState& cl
153153
case SC2APIProtocol::CloakState::Cloaked: cloak = Unit::Cloaked; return true;
154154
case SC2APIProtocol::CloakState::CloakedDetected: cloak = Unit::CloakedDetected; return true;
155155
case SC2APIProtocol::CloakState::NotCloaked: cloak = Unit::NotCloaked; return true;
156+
case SC2APIProtocol::CloakState::CloakedAllied: cloak = Unit::CloakedAllied; return true;
156157
}
157158
return false;
158159
}
@@ -190,7 +191,7 @@ bool Convert(const ObservationRawPtr& observation_raw, UnitPool& unit_pool, uint
190191
}
191192
}
192193
else {
193-
unit->cloak = Unit::Unknown;
194+
unit->cloak = Unit::CloakedUnknown;
194195
}
195196

196197
unit->detect_range = observation_unit.detect_range();

tests/test_unit_command.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace sc2 {
3939
ReportError("Could not find the test unit.");
4040
}
4141

42-
if (test_unit_ && test_unit_->cloak != Unit::CloakState::Cloaked) {
42+
if (test_unit_ && test_unit_->cloak != Unit::CloakState::CloakedAllied) {
4343
ReportError("Unit is not cloaked as expected.");
4444
}
4545

@@ -1255,9 +1255,6 @@ namespace sc2 {
12551255
if (target_units.front()->is_blip != true) {
12561256
ReportError("Target unit is not a blip.");
12571257
}
1258-
if (target_units.front()->cloak != Unit::CloakState::Unknown) {
1259-
ReportError("Target unit cloak state is incorrect.");
1260-
}
12611258
if (target_units.front()->display_type != Unit::DisplayType::Hidden) {
12621259
ReportError("Target unit is not hidden.");
12631260
}

0 commit comments

Comments
 (0)