Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/AI/ActionInterface/Headers/AISceneImpl.h

Diff revisions: vs.
  @@ -55,20 +55,24 @@
55 55 inline GOAPWorldState& worldState() { return _worldState; }
56 56 inline const GOAPWorldState& worldStateConst() const { return _worldState; }
57 57
58 - /// Register a specific action. This only holds a reference to the action itself and does not create a local copy!
58 + /// Register a specific action.
59 + /// This only holds a reference to the action itself and does not create a local copy!
59 60 virtual void registerAction(GOAPAction* const action) {
60 61 _actionSet.push_back(action);
61 62 }
62 - /// Register a specific action. This only holds a reference to the action itself and does not create a local copy!
63 + /// Register a specific action.
64 + /// This only holds a reference to the action itself and does not create a local copy!
63 65 virtual void registerGoal(const GOAPGoal& goal) {
64 66 _goals.push_back(goal);
65 67 }
66 68
67 69 virtual GOAPGoal* findGoal(const stringImpl& goalName) {
68 70 vectorImpl<GOAPGoal >::iterator it;
69 - it = std::find_if( _goals.begin(), _goals.end(), [&goalName]( const GOAPGoal& goal )->bool {
70 - return goal.getName().compare(goalName.c_str()) == 0;
71 - });
71 + it = std::find_if(_goals.begin(), _goals.end(),
72 + [&goalName]( const GOAPGoal& goal )->bool {
73 + return goal.getName().compare(goalName.c_str()) == 0;
74 + });
75 +
72 76 if (it != _goals.end()) {
73 77 return &(*it);
74 78 }
  @@ -90,7 +94,8 @@
90 94 activateGoal(stringAlg::toBase(goal.getName()));
91 95 }
92 96 }
93 - /// Although we want the goal to be activated, it might not be the most relevant in the current scene state
97 + /// Although we want the goal to be activated,
98 + /// it might not be the most relevant in the current scene state
94 99 inline bool activateGoal(const stringImpl& name) {
95 100 GOAPGoal* goal = findGoal(name);
96 101 if (goal != nullptr) {
  @@ -105,9 +110,12 @@
105 110 if (_activeGoals.empty()) {
106 111 return nullptr;
107 112 }
108 - std::sort(_activeGoals.begin(), _activeGoals.end(), [](GOAPGoal const* a, GOAPGoal const* b) {
109 - return a->relevancy() < b->relevancy();
110 - });
113 +
114 + std::sort(_activeGoals.begin(), _activeGoals.end(),
115 + [](GOAPGoal const* a, GOAPGoal const* b) {
116 + return a->relevancy() < b->relevancy();
117 + });
118 +
111 119 _activeGoal = _activeGoals.back();
112 120 _currentStep = -1;
113 121 return _activeGoal;
  @@ -121,9 +129,11 @@
121 129 return false;
122 130 }
123 131 vectorImpl<GOAPGoal* >::iterator it;
124 - it = vectorAlg::find_if(_activeGoals.begin(), _activeGoals.end(), [goal](GOAPGoal const* actGoal) {
125 - return actGoal->getName().compare(goal->getName()) == 0;
126 - });
132 + it = vectorAlg::find_if(_activeGoals.begin(), _activeGoals.end(),
133 + [goal](GOAPGoal const* actGoal) {
134 + return actGoal->getName().compare(goal->getName()) == 0;
135 + });
136 +
127 137 if (it == _activeGoals.end()) {
128 138 return false;
129 139 }