api: allow getting current bot goal.
api: do not use buckets for nearest node search.
This commit is contained in:
parent
ca94e31472
commit
a0202efc40
5 changed files with 26 additions and 9 deletions
|
|
@ -12,6 +12,9 @@ class YaPBModule : public IYaPBModule {
|
|||
public:
|
||||
virtual ~YaPBModule () override = default;
|
||||
|
||||
public:
|
||||
CR_DECLARE_DESTRUCTOR ();
|
||||
|
||||
private:
|
||||
Bot *getBot (int index) {
|
||||
if (index < 1) {
|
||||
|
|
@ -39,7 +42,7 @@ public:
|
|||
// gets the node nearest to origin
|
||||
virtual int getNearestNode (float *origin) override {
|
||||
if (graph.length () > 0) {
|
||||
return graph.getNearest (origin);
|
||||
return graph.getNearestNoBuckets (origin);
|
||||
}
|
||||
return kInvalidNodeIndex;
|
||||
}
|
||||
|
|
@ -79,6 +82,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual int getBotGoal (int entity) override {
|
||||
auto bot = getBot (entity);
|
||||
|
||||
if (bot) {
|
||||
return bot->m_chosenGoalIndex == kInvalidNodeIndex ? bot->getTask ()->data : bot->m_chosenGoalIndex;
|
||||
}
|
||||
return kInvalidNodeIndex;
|
||||
}
|
||||
|
||||
// force bot to go to selected origin
|
||||
virtual void setBotGoalOrigin (int entity, float *origin) override {
|
||||
auto bot = getBot (entity);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue