#include <gather.h>
Definition at line 33 of file gather.h.
Definition at line 13 of file gather.cpp.
References commandCenter, FastEcslent::Target::entity, FastEcslent::Entity::entityType, findNearestCommandCenter(), finished, gasEntity, mineralEntity, FastEcslent::MINERALS, FastEcslent::MOVETOMINERALS, scv, and state.
FastEcslent::CommandCenter * FastEcslent::Gather::findNearestCommandCenter | ( | ) |
Definition at line 197 of file gather.cpp.
References FastEcslent::COMMANDCENTER, and DEBUG.
Referenced by Gather(), init(), and switchState().
void FastEcslent::Gather::postProcess | ( | ) | [inline, virtual] |
Inherited from base class Command This SCV was issued another command instead of Gather. 1. The number of miners of the mineral need decrease by 1 2. If the SCV is currently mining the mineral, the miner should be removed from the mineral.
Implements FastEcslent::Command.
Definition at line 47 of file gather.cpp.
References FastEcslent::Target::entity, FastEcslent::Entity::entityType, FastEcslent::Minerals::miner, FastEcslent::MINERALS, FastEcslent::Minerals::miners, and FastEcslent::UnitCommand::target.
bool FastEcslent::Gather::done | ( | ) | [inline, virtual] |
void FastEcslent::Gather::init | ( | ) | [inline, virtual] |
Implements FastEcslent::Command.
Definition at line 31 of file gather.cpp.
References commandCenter, findNearestCommandCenter(), finished, mineralEntity, FastEcslent::Minerals::miners, FastEcslent::MOVETOMINERALS, and state.
Referenced by FastEcslent::createGatherForEntAndMineral().
void FastEcslent::Gather::tick | ( | double | dt | ) | [inline, virtual] |
Implements FastEcslent::Command.
Definition at line 77 of file gather.cpp.
References FastEcslent::GATHERINGMINERALS, gatherTick(), moveToEntityTick(), FastEcslent::MOVETOMINERALS, and FastEcslent::RETURNTOCC.
virtual Command* FastEcslent::Gather::clone | ( | ) | [inline, virtual] |
void FastEcslent::Gather::gatherTick | ( | double | dt | ) | [inline] |
Wait/Gather minerals If the SCV switched into gathering state, there are two possibilities: 1. Do nothing but wait, in case of another SCV is mining this mineral. 2. Mining, in case of nobody else is mining this mineral.
Definition at line 148 of file gather.cpp.
References FastEcslent::Entity::engine, FastEcslent::UnitCommand::entity, FastEcslent::GameMgr::findClosestEntityOfTypeWithinDistance(), FastEcslent::Engine::gameMgr, FastEcslent::Gas::gasAmount, FastEcslent::SCVehicle::gasCount, gasEntity, FastEcslent::SCVehicle::gasGatherRate, FastEcslent::SCVehicle::maxGasCount, FastEcslent::SCVehicle::maxMineralCount, FastEcslent::MaxMineralFindingDistance, FastEcslent::Gas::miner, FastEcslent::Minerals::miner, FastEcslent::Minerals::mineralAmount, FastEcslent::SCVehicle::mineralCount, mineralEntity, FastEcslent::SCVehicle::mineralGatherRate, FastEcslent::MINERALS, FastEcslent::RETURNTOCC, scv, FastEcslent::STOPPED, and switchState().
Referenced by tick().
void FastEcslent::Gather::moveToEntityTick | ( | Entity * | targetEnt, | |
double | dt | |||
) | [inline] |
The SCV moves to mining a mineral. When the SCV comes in front of the mineral, it will check if the target mineral is being mined by another SCV. If it is occupied, the SCV will check if there is optimal choice to mine (minerals with fewer miners in the same patch). If there is no optimal choice, wait until the target mineral is available. Otherwise, go to the optimal one.
Definition at line 114 of file gather.cpp.
References DEBUG, FastEcslent::Entity::desiredHeading, FastEcslent::Entity::desiredSpeed, FastEcslent::Entity::engine, FastEcslent::UnitCommand::entity, FastEcslent::Engine::gameMgr, FastEcslent::GameMgr::getMineralPatch(), FastEcslent::MineralPatch::getNextMineral(), FastEcslent::Entity::heading, FastEcslent::Entity::length, FastEcslent::Entity::maxSpeed, mineralEntity, FastEcslent::Minerals::miners, FastEcslent::Entity::pos, FastEcslent::UnitCommand::relativePos, scv, FastEcslent::Entity::speed, and switchMoveToState().
Referenced by tick().
void FastEcslent::Gather::switchState | ( | GatherState | newState | ) | [inline] |
Definition at line 57 of file gather.cpp.
References commandCenter, FastEcslent::Entity::engine, FastEcslent::UnitCommand::entity, FastEcslent::Entity::entityId, findNearestCommandCenter(), FastEcslent::Engine::gameMgr, FastEcslent::Resources::gas, FastEcslent::SCVehicle::gasCount, FastEcslent::GATHERINGMINERALS, FastEcslent::SCVehicle::mineralCount, FastEcslent::Resources::minerals, FastEcslent::MOVETOMINERALS, FastEcslent::Identity::player, FastEcslent::GameMgr::resources, FastEcslent::RETURNTOCC, scv, and state.
Referenced by gatherTick(), and switchMoveToState().
void FastEcslent::Gather::switchMoveToState | ( | ) |
Definition at line 99 of file gather.cpp.
References FastEcslent::GATHERINGMINERALS, FastEcslent::MOVETOMINERALS, FastEcslent::RETURNTOCC, and switchState().
Referenced by moveToEntityTick().
CommandCenter* FastEcslent::Gather::findNearestCommandCenter | ( | ) |
virtual void FastEcslent::Gather::postProcess | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual bool FastEcslent::Gather::done | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::init | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::tick | ( | double | dt | ) | [virtual] |
Implements FastEcslent::Command.
void FastEcslent::Gather::gatherTick | ( | double | dt | ) |
void FastEcslent::Gather::moveToEntityTick | ( | Entity * | ent, | |
double | dt | |||
) |
void FastEcslent::Gather::switchState | ( | GatherState | newState | ) |
void FastEcslent::Gather::switchMoveToState | ( | ) |
CommandCenter* FastEcslent::Gather::findNearestCommandCenter | ( | ) |
virtual void FastEcslent::Gather::postProcess | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual bool FastEcslent::Gather::done | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::init | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::tick | ( | double | dt | ) | [virtual] |
Implements FastEcslent::Command.
void FastEcslent::Gather::gatherTick | ( | double | dt | ) |
void FastEcslent::Gather::moveToEntityTick | ( | Entity * | ent, | |
double | dt | |||
) |
void FastEcslent::Gather::switchState | ( | GatherState | newState | ) |
void FastEcslent::Gather::switchMoveToState | ( | ) |
CommandCenter* FastEcslent::Gather::findNearestCommandCenter | ( | ) |
virtual void FastEcslent::Gather::postProcess | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual bool FastEcslent::Gather::done | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::init | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::tick | ( | double | dt | ) | [virtual] |
Implements FastEcslent::Command.
void FastEcslent::Gather::gatherTick | ( | double | dt | ) |
void FastEcslent::Gather::moveToEntityTick | ( | Entity * | ent, | |
double | dt | |||
) |
void FastEcslent::Gather::switchState | ( | GatherState | newState | ) |
void FastEcslent::Gather::switchMoveToState | ( | ) |
CommandCenter* FastEcslent::Gather::findNearestCommandCenter | ( | ) |
virtual void FastEcslent::Gather::postProcess | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual bool FastEcslent::Gather::done | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::init | ( | ) | [virtual] |
Implements FastEcslent::Command.
virtual void FastEcslent::Gather::tick | ( | double | dt | ) | [virtual] |
Implements FastEcslent::Command.
void FastEcslent::Gather::gatherTick | ( | double | dt | ) |
void FastEcslent::Gather::moveToEntityTick | ( | Entity * | ent, | |
double | dt | |||
) |
void FastEcslent::Gather::switchState | ( | GatherState | newState | ) |
void FastEcslent::Gather::switchMoveToState | ( | ) |
GatherState FastEcslent::Gather::state [private] |
SCVehicle* FastEcslent::Gather::scv [private] |
Definition at line 36 of file gather.h.
Referenced by Gather(), gatherTick(), moveToEntityTick(), and switchState().
bool FastEcslent::Gather::isMineral [private] |
Definition at line 40 of file gather.h.
Referenced by Gather(), gatherTick(), init(), and moveToEntityTick().
SCVehicle* FastEcslent::Gather::scv [private] |
SCVehicle* FastEcslent::Gather::scv [private] |
SCVehicle* FastEcslent::Gather::scv [private] |
SCVehicle* FastEcslent::Gather::scv [private] |