WFL: Fix deprecation messages when using the enemy_of() function

This commit is contained in:
Celtic Minstrel 2021-06-05 13:40:01 -04:00 committed by GitHub
parent 87f31ad78e
commit 1b533634fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -353,19 +353,17 @@ DEFINE_WFL_FUNCTION(enemy_of, 2, 2)
int self, other;
if(auto uc = self_v.try_convert<unit_callable>()) {
// For some obscure, bizarre reason, the unit callable returns a 0-indexed side. :|
self = uc->get_value("side").as_int() + 1;
self = uc->get_value("side_number").as_int();
} else if(auto tc = self_v.try_convert<team_callable>()) {
self = tc->get_value("side").as_int();
self = tc->get_value("side_number").as_int();
} else {
self = self_v.as_int();
}
if(auto uc = other_v.try_convert<unit_callable>()) {
// For some obscure, bizarre reason, the unit callable returns a 0-indexed side. :|
other = uc->get_value("side").as_int() + 1;
other = uc->get_value("side_number").as_int();
} else if(auto tc = other_v.try_convert<team_callable>()) {
other = tc->get_value("side").as_int();
other = tc->get_value("side_number").as_int();
} else {
other = other_v.as_int();
}