当前位置: 首页>>代码示例>>C++>>正文


C++ ActionType::ID方法代码示例

本文整理汇总了C++中ActionType::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionType::ID方法的具体用法?C++ ActionType::ID怎么用?C++ ActionType::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionType的用法示例。


在下文中一共展示了ActionType::ID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setRepetitionThreshold

void DFBB_BuildOrderSearchParameters::setRepetitionThreshold(const ActionType & a, const UnitCountType & thresh)	
{ 
    BOSS_ASSERT(a.ID() >= 0 && a.ID() < repetitionThresholds.size(), "Action type not valid");
    BOSS_ASSERT(a.getRace() == race, "Action type race doesn't match this parameter object");

    repetitionThresholds[a.ID()] = thresh; 
}
开发者ID:DantesGearbox,项目名称:ualbertabot,代码行数:7,代码来源:DFBB_BuildOrderSearchParameters.cpp

示例2: 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);
    }
}
开发者ID:edran,项目名称:ualbertabot,代码行数:26,代码来源:UnitData.cpp

示例3: 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();
	}
}
开发者ID:edran,项目名称:ualbertabot,代码行数:51,代码来源:UnitData.cpp

示例4: morphUnit

void UnitData::morphUnit(const ActionType & from, const ActionType & to, const FrameCountType & completionFrame)
{
    BOSS_ASSERT(getNumCompleted(from) > 0, "Must have the unit type to morph it");
    _numUnits[from.ID()]--;
    _currentSupply -= from.supplyRequired();

    if (from.isWorker())
    {
        BOSS_ASSERT(_mineralWorkers > 0, "Need mineral worker");
        _mineralWorkers--;
    }

    addActionInProgress(to, completionFrame);
}
开发者ID:edran,项目名称:ualbertabot,代码行数:14,代码来源:UnitData.cpp

示例5: 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);
    }
}
开发者ID:edran,项目名称:ualbertabot,代码行数:47,代码来源:UnitData.cpp

示例6: getNumTotal

const UnitCountType UnitData::getNumTotal(const ActionType & action) const
{
    return _numUnits[action.ID()] + (_progress.numInProgress(action) * action.numProduced());
}
开发者ID:edran,项目名称:ualbertabot,代码行数:4,代码来源:UnitData.cpp

示例7: getNumCompleted

const UnitCountType UnitData::getNumCompleted(const ActionType & action) const
{
    return _numUnits[action.ID()];
}
开发者ID:edran,项目名称:ualbertabot,代码行数:4,代码来源:UnitData.cpp

示例8: getTextureNumber

const int GUI::getTextureNumber(const ActionType & type) const
{
    return BOSS_TEXTURE_INTERVAL * type.getRace() + type.ID();
}
开发者ID:DantesGearbox,项目名称:ualbertabot,代码行数:4,代码来源:GUI.cpp


注:本文中的ActionType::ID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。