From 0bb0b26d3e6cbac0dd7b0a19e7f6901f8c16b4b6 Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 28 Jul 2024 11:42:25 +0200 Subject: [PATCH] feat: added Unit::has_plan --- src/unit.cpp | 4 ++++ src/unit.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/unit.cpp b/src/unit.cpp index 8e58a74..5e749f0 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -99,6 +99,10 @@ int Unit::get_configure_team() const { return this->team; } +bool Unit::has_plan() const { + return !this->current_plan.size(); +} + void Unit::set_goal_and_plan(gd::Ref goal) { this->current_goal = goal; this->current_plan = this->planner->plan_for_goal(goal); diff --git a/src/unit.hpp b/src/unit.hpp index 400aea3..ee0e31f 100644 --- a/src/unit.hpp +++ b/src/unit.hpp @@ -41,6 +41,7 @@ public: UnitTeam get_team() const; void set_configure_team(int value); int get_configure_team() const; + bool has_plan() const; private: void set_goal_and_plan(gd::Ref goal); void destroy_state();