Controls gathering workers for GathererModule.
More...
#include <gathererc.h>
Inherits cherrypi::SharedController.
|
void | micro (State *, Unit *worker, Unit *resource) |
| Decide what to do with a worker this frame. More...
|
|
void | gather (State *, Unit *worker, Unit *resource, bool dropResources=false) |
| Issue a UPC to command a worker to gather a resource. More...
|
|
void | flee (State *, Unit *worker, Unit *resource) |
| Issue a UPC to command a worker to flee. More...
|
|
void | chase (State *, Unit *worker, Unit *target) |
| Issue a UPC to command a worker to chase an enemy proxy builder, to ensure that they don't do anything sneaky out of our vision. More...
|
|
void | attack (State *, Unit *worker, Unit *target) |
| Issue a UPC to command a worker to attack a unit. More...
|
|
void | postUpcs (State *state) |
| Posts scheduled UPCs to the Blackboard. More...
|
|
template<typename... Args> |
void | addUpc (Unit *unit, Args &&...args) |
| Schedules an action (as a UPC) for the given unit which will be posted after doStep(). More...
|
|
|
template<typename T > |
static std::shared_ptr< T > | globalInstance (State *state, Module *module, std::string name=std::string()) |
| Retrieves the global instance of a shared controller. More...
|
|
Controls gathering workers for GathererModule.
- Bookkeeping for SharedController lives in gathererc.cpp
- Micromanagement and worker defense lives in gatherermicro.cpp
void cherrypi::GathererController::addUnit |
( |
State * |
state, |
|
|
Unit * |
unit, |
|
|
UpcId |
id |
|
) |
| |
|
overridevirtual |
Add a unit to this controller.
This is usually called whenever a new Task for a controller is being cretaed. Re-implement this function if you need to update internal data structures when gaining control of units but make sure to also call the base class method.
Reimplemented from cherrypi::ControllerBase.
void cherrypi::GathererController::attack |
( |
State * |
state, |
|
|
Unit * |
worker, |
|
|
Unit * |
target |
|
) |
| |
|
protected |
Issue a UPC to command a worker to attack a unit.
void cherrypi::GathererController::chase |
( |
State * |
state, |
|
|
Unit * |
worker, |
|
|
Unit * |
target |
|
) |
| |
|
protected |
Issue a UPC to command a worker to chase an enemy proxy builder, to ensure that they don't do anything sneaky out of our vision.
void cherrypi::GathererController::flee |
( |
State * |
state, |
|
|
Unit * |
worker, |
|
|
Unit * |
resource |
|
) |
| |
|
protected |
Issue a UPC to command a worker to flee.
void cherrypi::GathererController::gather |
( |
State * |
state, |
|
|
Unit * |
worker, |
|
|
Unit * |
resource, |
|
|
bool |
dropResources = false |
|
) |
| |
|
protected |
Issue a UPC to command a worker to gather a resource.
virtual const char* cherrypi::GathererController::getName |
( |
| ) |
const |
|
inlineoverridevirtual |
bool cherrypi::GathererController::keepUnit |
( |
State * |
state, |
|
|
Unit * |
unit |
|
) |
| const |
|
overridevirtual |
Decide whether to keep a unit.
By default, this returns false for dead and non-allied units.
Reimplemented from cherrypi::ControllerBase.
void cherrypi::GathererController::micro |
( |
State * |
state, |
|
|
Unit * |
worker, |
|
|
Unit * |
resource |
|
) |
| |
|
protected |
Decide what to do with a worker this frame.
void cherrypi::GathererController::removeUnit |
( |
State * |
state, |
|
|
Unit * |
unit, |
|
|
UpcId |
id |
|
) |
| |
|
overridevirtual |
Remove a unit from this controller.
This is usually called from Task::update() to remove units that were assigned to other Tasks, or for which keepUnit() returns false. Re-implement this function if you need to update internal data structures when gaining control of units but make sure to also call the base class method.
Reimplemented from cherrypi::ControllerBase.
void cherrypi::GathererController::step |
( |
State * |
state | ) |
|
|
overridevirtual |
Advance controller state and produce UPCs.
This is intended to be called from Module::step() of the instantiating module. The default implementation does nothing.
Reimplemented from cherrypi::ControllerBase.
std::vector<Unit*> cherrypi::GathererController::bastions |
|
protected |
std::vector<Unit*> cherrypi::GathererController::invaders |
|
protected |
std::vector<Unit*> cherrypi::GathererController::proxies |
|
protected |
std::vector<Unit*> cherrypi::GathererController::proxyBuilders |
|
protected |
bool cherrypi::GathererController::wasProxied = false |
|
protected |
True if we have ever been proxied (an enemy attempted to build structures in or near our base.
The documentation for this class was generated from the following files:
- src/modules/gatherer/gathererc.h
- src/modules/gatherer/gathererc.cpp
- src/modules/gatherer/gatherermicro.cpp