BWAPI
|
#include <AdvancedGroup.h>
Public Member Functions | |
AdvancedGroup () | |
void | update (Goal goal) |
void | addUnit (Unit unit) |
void | removeUnits (Unit unit) |
Private Attributes | |
UnitGroup | mAllUnits |
std::map< Unit, Behaviour > | mUnitBehaviours |
Goal | mLastGoal |
UnitGroup | mCurrectGoalGroup |
UnitGroup | mReinforcements |
std::list< std::pair < UnitGroup, Goal > > | mStrandedUnits |
Definition at line 8 of file AdvancedGroup.h.
void AdvancedGroup::addUnit | ( | Unit | unit | ) |
Definition at line 20 of file AdvancedGroup.cpp.
References UnitGroup::insert(), mAllUnits, mReinforcements, and mUnitBehaviours.
{ mUnitBehaviours[unit] = Behaviour(unit); mReinforcements.insert(unit); mAllUnits.insert(unit); }
void AdvancedGroup::removeUnits | ( | Unit | unit | ) |
Definition at line 27 of file AdvancedGroup.cpp.
References UnitGroup::erase(), mCurrectGoalGroup, mReinforcements, mStrandedUnits, and mUnitBehaviours.
{ mCurrectGoalGroup.erase(unit); mReinforcements.erase(unit); for(std::list<std::pair<UnitGroup, Goal>>::iterator it = mStrandedUnits.begin(); it != mStrandedUnits.end(); ++it) it->first.erase(unit); mUnitBehaviours[unit].onDeleted(); mUnitBehaviours.erase(unit); }
void AdvancedGroup::update | ( | Goal | goal | ) |
Definition at line 3 of file AdvancedGroup.cpp.
References UnitGroup::count(), UnitGroup::empty(), UnitGroup::getClosestUnit(), Goal::getPositionForMerge(), mAllUnits, mCurrectGoalGroup, and mLastGoal.
{ // Reshuffle the groups // closest unit to the goal is start of that group if(mAllUnits.empty()) return; Unit closestUnit = mAllUnits.getClosestUnit(goal.getPositionForMerge()); if(mCurrectGoalGroup.count(closestUnit) == 0) { ; } mLastGoal = goal; }
UnitGroup AdvancedGroup::mAllUnits [private] |
Definition at line 19 of file AdvancedGroup.h.
UnitGroup AdvancedGroup::mCurrectGoalGroup [private] |
Definition at line 23 of file AdvancedGroup.h.
Referenced by removeUnits(), and update().
Goal AdvancedGroup::mLastGoal [private] |
Definition at line 22 of file AdvancedGroup.h.
Referenced by update().
UnitGroup AdvancedGroup::mReinforcements [private] |
Definition at line 25 of file AdvancedGroup.h.
Referenced by addUnit(), and removeUnits().
std::list<std::pair<UnitGroup, Goal> > AdvancedGroup::mStrandedUnits [private] |
Definition at line 27 of file AdvancedGroup.h.
Referenced by removeUnits().
std::map<Unit, Behaviour> AdvancedGroup::mUnitBehaviours [private] |
Definition at line 20 of file AdvancedGroup.h.
Referenced by addUnit(), and removeUnits().