Skip to content

Commit 2d25b52

Browse files
committed
fix: fix ang.toFacing (#271)
1 parent fd72ce3 commit 2d25b52

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/legacy/api/BaseAPI.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,7 @@ Local<Value> DirectionAngle::toFacing() {
189189
if (static_cast<float>(static_cast<int>(value)) <= value) {
190190
result = static_cast<int>(value);
191191
}
192-
switch (result) {
193-
case 2:
194-
facing = 0;
195-
break;
196-
case 3:
197-
facing = 2;
198-
break;
199-
case 4:
200-
facing = 3;
201-
break;
202-
case 5:
203-
facing = 1;
204-
break;
205-
}
192+
facing = (result + 2) % 4;
206193
return Number::newNumber(facing);
207194
}
208195

0 commit comments

Comments
 (0)