本文整理汇总了C++中ActionType::numProduced方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionType::numProduced方法的具体用法?C++ ActionType::numProduced怎么用?C++ ActionType::numProduced使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionType
的用法示例。
在下文中一共展示了ActionType::numProduced方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCompletedBuilding
// only used for adding existing buildings from a BWAPI Game * object
void UnitData::addCompletedBuilding(const ActionType & action, const FrameCountType timeUntilFree, const ActionType & constructing, const ActionType & addon)
{
_numUnits[action.ID()] += action.numProduced();
_maxSupply += action.supplyProvided();
// if it's an extractor
if (action.isRefinery())
{
// take those workers from minerals and put them into it
_mineralWorkers -= 3; _gasWorkers += 3;
}
// if it's a building that can produce units, add it to the building data
if (action.isBuilding() && !action.isSupplyProvider())
{
_buildings.addBuilding(action, timeUntilFree, constructing, addon);
}
// special case for hatcheries
if (action.isBuilding() && (action.getUnitType() == BWAPI::UnitTypes::Zerg_Hatchery))
{
_hatcheryData.addHatchery(1);
}
}
示例2: removeCompletedAction
void UnitData::removeCompletedAction(const ActionType & action)
{
//Logger::LogAppendToFile(BOSS_LOGFILE, "Unit removed " + action.getName());
const static ActionType Lair = ActionTypes::GetActionType("Zerg_Lair");
const static ActionType Hive = ActionTypes::GetActionType("Zerg_Hive");
_numUnits[action.ID()] -= action.numProduced();
// a lair or hive from a hatchery don't produce additional supply
if (action != Lair && action != Hive)
{
_maxSupply -= action.supplyProvided();
}
if (action.isWorker())
{
if (_mineralWorkers > 0)
{
_mineralWorkers--;
}
else if (_gasWorkers > 0)
{
_gasWorkers--;
}
}
// if it's an extractor
if (action.isRefinery())
{
// take those workers from minerals and put them into it
_mineralWorkers += 3; _gasWorkers -= 3;
}
BOSS_ASSERT(_mineralWorkers >= 0, "Can't have negative mineral workers");
BOSS_ASSERT(_gasWorkers >= 0, "Can't have negative gas workers");
// if it's a building that can produce units, add it to the building data
if (action.isBuilding() && !action.isSupplyProvider())
{
if (!action.isMorphed())
{
_buildings.removeBuilding(action, ActionTypes::None);
}
}
// special case for hatcheries
if (action.isBuilding() && (action.getUnitType() == BWAPI::UnitTypes::Zerg_Hatchery))
{
_hatcheryData.removeHatchery();
}
}
示例3: addCompletedAction
void UnitData::addCompletedAction(const ActionType & action, bool wasBuilt)
{
const static ActionType Lair = ActionTypes::GetActionType("Zerg_Lair");
const static ActionType Hive = ActionTypes::GetActionType("Zerg_Hive");
_numUnits[action.ID()] += action.numProduced();
if (wasBuilt)
{
// a lair or hive from a hatchery don't produce additional supply
if (action != Lair && action != Hive)
{
_maxSupply += action.supplyProvided();
}
}
else
{
_maxSupply += action.supplyProvided();
}
if (action.isWorker())
{
_mineralWorkers++;
}
// if it's an extractor
if (action.isRefinery())
{
// take those workers from minerals and put them into it
_mineralWorkers -= 3; _gasWorkers += 3;
}
// if it's a building that can produce units, add it to the building data
if (action.isBuilding() && !action.isSupplyProvider())
{
if (!action.isMorphed())
{
_buildings.addBuilding(action, ActionTypes::None);
}
}
// special case for hatcheries
if (action.isBuilding() && (action.getUnitType() == BWAPI::UnitTypes::Zerg_Hatchery))
{
_hatcheryData.addHatchery(wasBuilt ? 1 : 3);
}
}
示例4: addActionInProgress
void UnitData::addActionInProgress(const ActionType & action, const FrameCountType & completionFrame, bool queueAction)
{
FrameCountType finishTime = (action.isBuilding() && !action.isMorphed()) ? completionFrame + Constants::BUILDING_PLACEMENT : completionFrame;
// add it to the actions in progress
_progress.addAction(action, finishTime);
if (!action.isMorphed())
{
_currentSupply += action.supplyRequired() * action.numProduced();
}
if (queueAction && action.whatBuildsIsBuilding())
{
// add it to a free building, which MUST be free since it's called from doAction
// which must be already fastForwarded to the correct time
_buildings.queueAction(action);
}
}
示例5: getNumTotal
const UnitCountType UnitData::getNumTotal(const ActionType & action) const
{
return _numUnits[action.ID()] + (_progress.numInProgress(action) * action.numProduced());
}