• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ bwapi::Player类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中bwapi::Player的典型用法代码示例。如果您正苦于以下问题:C++ Player类的具体用法?C++ Player怎么用?C++ Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: InitPlayers

//----------------------------------------------------------------------------------------------
void DefinitionCrossMapping::InitPlayers()
{
	vector< pair<TID, MetaData::PlayerType> > m_players;
	set<BWAPI::Player*> &players = Broodwar->getPlayers();
	BWAPI::Player *pPlayer;

	for(set<BWAPI::Player*>::const_iterator i = players.begin();
		i != players.end();
		++i)
	{
		pPlayer = (*i);

		if(pPlayer->getType().getID() == PlayerTypes::Player.getID())
			m_players.push_back(make_pair(pPlayer->getID(), PLAYER_Self));
		else if(pPlayer->getType().getID() == PlayerTypes::Computer.getID())
			m_players.push_back(make_pair(pPlayer->getID(), PLAYER_Enemy));
		else if(pPlayer->isNeutral())
			m_players.push_back(make_pair(pPlayer->getID(), PLAYER_Neutral));
	}

	PlayerMapping = CrossMap<TID, MetaData::PlayerType>(m_players);
}
开发者ID:anas-salama,项目名称:IStrategizer,代码行数:23,代码来源:DefinitionCrossMapping.cpp


示例2: onPlayerLeft

void ExampleAIModule::onPlayerLeft(BWAPI::Player player)
{
  // Interact verbally with the other players in the game by
  // announcing that the other player has left.
  Broodwar->sendText("Goodbye %s!", player->getName().c_str());
}
开发者ID:vilbeyli,项目名称:ITUBot,代码行数:6,代码来源:ExampleAIModule(new).cpp


示例3: onReceiveText

void ExampleAIModule::onReceiveText(BWAPI::Player player, std::string text)
{
  // Parse the received text
  Broodwar << player->getName() << " said \"" << text << "\"" << std::endl;
}
开发者ID:vilbeyli,项目名称:ITUBot,代码行数:5,代码来源:ExampleAIModule(new).cpp


示例4: getNextExpansion

BWAPI::TilePosition MapTools::getNextExpansion(BWAPI::Player player)
{
    BWTA::BaseLocation * closestBase = nullptr;
    double minDistance = 100000;

    BWAPI::TilePosition homeTile = player->getStartLocation();

    // for each base location
    for (BWTA::BaseLocation * base : BWTA::getBaseLocations())
    {
        // if the base has gas
        if (!base->isMineralOnly() && !(base == BWTA::getStartLocation(player)))
        {
            // get the tile position of the base
            BWAPI::TilePosition tile = base->getTilePosition();
            bool buildingInTheWay = false;

            for (int x = 0; x < BWAPI::Broodwar->self()->getRace().getCenter().tileWidth(); ++x)
            {
                for (int y = 0; y < BWAPI::Broodwar->self()->getRace().getCenter().tileHeight(); ++y)
                {
                    BWAPI::TilePosition tp(tile.x + x, tile.y + y);

                    for (auto & unit : BWAPI::Broodwar->getUnitsOnTile(tp))
                    {
                        if (unit->getType().isBuilding() && !unit->isFlying())
                        {
                            buildingInTheWay = true;
                            break;
                        }
                    }
                }
            }
            
            if (buildingInTheWay)
            {
                continue;
            }

            // the base's distance from our main nexus
            BWAPI::Position myBasePosition(player->getStartLocation());
            BWAPI::Position thisTile = BWAPI::Position(tile);
            double distanceFromHome = MapTools::Instance().getGroundDistance(thisTile,myBasePosition);

            // if it is not connected, continue
            if (!BWTA::isConnected(homeTile,tile) || distanceFromHome < 0)
            {
                continue;
            }

            if (!closestBase || distanceFromHome < minDistance)
            {
                closestBase = base;
                minDistance = distanceFromHome;
            }
        }

    }

    if (closestBase)
    {
        return closestBase->getTilePosition();
    }
    else
    {
        return BWAPI::TilePositions::None;
    }
}
开发者ID:DantesGearbox,项目名称:ualbertabot,代码行数:68,代码来源:MapTools.cpp


示例5: onPlayerLeft

void SwarmCAT::onPlayerLeft(BWAPI::Player player)
{
	Broodwar->sendText("Goodbye %s!", player->getName().c_str());
}
开发者ID:4rChon,项目名称:ACT-AI,代码行数:4,代码来源:SwarmCAT.cpp


示例6: onReceiveText

void SwarmCAT::onReceiveText(BWAPI::Player player, std::string text)
{
	Broodwar << player->getName() << " said \"" << text << "\"" << std::endl;
}
开发者ID:4rChon,项目名称:ACT-AI,代码行数:4,代码来源:SwarmCAT.cpp


示例7: getScore

const int StrategyManager::getScore(BWAPI::Player player) const
{
	return player->getBuildingScore() + player->getKillScore() + player->getRazingScore() + player->getUnitScore();
}
开发者ID:0x4849,项目名称:c350,代码行数:4,代码来源:StrategyManager.cpp


示例8: onReceiveText

void OpprimoBot::onReceiveText(BWAPI::Player player, std::string text)
{
    Broodwar << player->getName() << " said '" << text << "'" << endl;
}
开发者ID:n9jlo,项目名称:OpprimoBot,代码行数:4,代码来源:OpprimoBot.cpp


示例9: onReceiveText

void TurkAnalyzer::onReceiveText(BWAPI::Player player, std::string text)
{
	// Parse the received text
	Broodwar << player->getName() << " said \"" << text << "\"" << std::endl;
}
开发者ID:cowden,项目名称:Turk,代码行数:5,代码来源:TurkAnalyzer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ bwapi::Position类代码示例发布时间:2022-05-31
下一篇:
C++ bulkio::StreamSRISequence_var类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap