File tree Expand file tree Collapse file tree 11 files changed +13
-85
lines changed Expand file tree Collapse file tree 11 files changed +13
-85
lines changed Original file line number Diff line number Diff line change 1717namespace openage ::gamestate::api {
1818
1919bool APIAbility::is_ability (const nyan::Object &obj) {
20- for (auto &parent : obj.get_parents ()) {
21- if (parent == " engine.ability.Ability" ) {
22- return true ;
23- }
24- }
25-
26- return false ;
20+ return obj.extends (" engine.ability.Ability" );
2721}
2822
2923bool APIAbility::check_type (const nyan::Object &ability,
Original file line number Diff line number Diff line change 99namespace openage ::gamestate::api {
1010
1111bool APIActivity::is_activity (const nyan::Object &obj) {
12- for (auto &parent : obj.get_parents ()) {
13- if (parent == " engine.util.activity.Activity" ) {
14- return true ;
15- }
16- }
17-
18- return false ;
12+ return obj.extends (" engine.util.activity.Activity" );
1913}
2014
2115nyan::Object APIActivity::get_start (const nyan::Object &activity) {
@@ -27,13 +21,7 @@ nyan::Object APIActivity::get_start(const nyan::Object &activity) {
2721
2822
2923bool APIActivityNode::is_node (const nyan::Object &obj) {
30- for (auto &parent : obj.get_parents ()) {
31- if (parent == " engine.util.activity.node.Node" ) {
32- return true ;
33- }
34- }
35-
36- return false ;
24+ return obj.extends (" engine.util.activity.node.Node" );
3725}
3826
3927activity::node_t APIActivityNode::get_type (const nyan::Object &node) {
Original file line number Diff line number Diff line change 1010namespace openage ::gamestate::api {
1111
1212bool APIAnimation::is_animation (nyan::Object &obj) {
13- for (auto &parent : obj.get_parents ()) {
14- if (parent == " engine.util.animation.Animation" ) {
15- return true ;
16- }
17- }
18-
19- return false ;
13+ return obj.extends (" engine.util.animation.Animation" );
2014}
2115
2216const std::string APIAnimation::get_animation_path (const nyan::Object &animation) {
Original file line number Diff line number Diff line change 99namespace openage ::gamestate::api {
1010
1111bool APIEffect::is_effect (const nyan::Object &obj) {
12- for (auto &parent : obj.get_parents ()) {
13- if (parent == " engine.effect.Effect" ) {
14- return true ;
15- }
16- }
17-
18- return false ;
12+ return obj.extends (" engine.effect.Effect" );
1913}
2014
2115bool APIEffect::check_type (const nyan::Object &effect,
Original file line number Diff line number Diff line change 88namespace openage ::gamestate::api {
99
1010bool APIObject::is_object (const nyan::Object &obj) {
11- for (const auto &parent : obj.get_parents ()) {
12- if (parent == " engine.root.Object" ) {
13- return true ;
14- }
15- }
16-
17- return false ;
11+ return obj.extends (" engine.root.Object" );
1812}
1913
20- } // namespace
14+ } // namespace openage::gamestate::api
Original file line number Diff line number Diff line change 1616namespace openage ::gamestate::api {
1717
1818bool APIPatch::is_patch (const nyan::Object &obj) {
19- for (auto &parent : obj.get_parents ()) {
20- if (parent == " engine.util.patch.Patch" ) {
21- return true ;
22- }
23- }
24-
25- return false ;
19+ return obj.extends (" engine.util.patch.Patch" );
2620}
2721
2822bool APIPatch::check_property (const nyan::Object &patch,
Original file line number Diff line number Diff line change 1313namespace openage ::gamestate::api {
1414
1515bool APIPlayerSetup::is_player_setup (const nyan::Object &obj) {
16- for (auto &parent : obj.get_parents ()) {
17- if (parent == " engine.util.setup.PlayerSetup" ) {
18- return true ;
19- }
20- }
21-
22- return false ;
16+ return obj.extends (" engine.util.setup.PlayerSetup" );
2317}
2418
2519const std::vector<nyan::Object> APIPlayerSetup::get_modifiers (const nyan::Object &player_setup) {
Original file line number Diff line number Diff line change 1313namespace openage ::gamestate::api {
1414
1515bool APIAbilityProperty::is_property (const nyan::Object &obj) {
16- for (auto &parent : obj.get_parents ()) {
17- if (parent == " engine.ability.property.Property" ) {
18- return true ;
19- }
20- }
21-
22- return false ;
16+ return obj.extends (" engine.ability.property.Property" );
2317}
2418
2519const std::vector<nyan::Object> APIAbilityProperty::get_animations (const nyan::Object &property) {
Original file line number Diff line number Diff line change 99namespace openage ::gamestate::api {
1010
1111bool APIResistance::is_resistance (const nyan::Object &obj) {
12- for (auto &parent : obj.get_parents ()) {
13- if (parent == " engine.resistance.Resistance" ) {
14- return true ;
15- }
16- }
17-
18- return false ;
12+ return obj.extends (" engine.resistance.Resistance" );
1913}
2014
2115bool APIResistance::check_effect_type (const nyan::Object &resistance,
Original file line number Diff line number Diff line change 1212namespace openage ::gamestate::api {
1313
1414bool APISound::is_sound (const nyan::Object &obj) {
15- for (auto &parent : obj.get_parents ()) {
16- if (parent == " engine.util.sound.Sound" ) {
17- return true ;
18- }
19- }
20-
21- return false ;
15+ return obj.extends (" engine.util.sound.Sound" );
2216}
2317
2418const std::string APISound::get_sound_path (const nyan::Object &sound) {
You can’t perform that action at this time.
0 commit comments