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


C++ BattleGround::SetMaxPlayersPerTeam方法代码示例

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


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

示例1: CreateBattleGround

// used to create the BG templates
uint32 BattleGroundMgr::CreateBattleGround(uint32 bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
{
    // Create the BG
    BattleGround *bg = NULL;

    switch(bgTypeId)
    {
        case BATTLEGROUND_AV: 
            bg = new BattleGroundAV; 
            bg->SetName("Alterac Valley");
            bg->SetMapId(30);
        break;
        case BATTLEGROUND_WS: 
            bg = new BattleGroundWS;
            bg->SetName("Warsong Gulch");
            bg->SetMapId(489);
        break;
        case BATTLEGROUND_AB: 
            bg = new BattleGroundAB;
            bg->SetName("Arathi Basin");
            bg->SetMapId(529);
        break;

        default:bg = new BattleGround;   break;             // placeholder for non implemented BG
    }

    bg->Reset();

    bg->SetTypeID(bgTypeId);
    bg->SetInstanceID(0);                               // template bg, instance id is 0
    bg->SetMinPlayersPerTeam(MinPlayersPerTeam);
    bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
    bg->SetMinPlayers(MinPlayersPerTeam*2);
    bg->SetMaxPlayers(MaxPlayersPerTeam*2);
    bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
    bg->SetTeamStartLoc(HORDE,    Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
    bg->SetLevelRange(LevelMin, LevelMax);

    //add BattleGround instance to FreeSlotQueue (.back() will return the template!)
    if (bgTypeId < MAX_BATTLEGROUND_TYPES ) // anti-crash
        bg->AddToBGFreeSlotQueue();

    // do NOT add to update list, since this is a template battleground!

    // return some not-null value, bgTypeId is good enough for me
    return bgTypeId;
}
开发者ID:mynew,项目名称:TrinityCore-1,代码行数:48,代码来源:BattleGroundMgr.cpp

示例2: CreateBattleGround

uint32 BattleGroundMgr::CreateBattleGround(uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, std::string BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
{
    // Create the BG
    BattleGround *bg = new BattleGround;

    bg->SetMapId(MapID);
    bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
    bg->SetMaxPlayers(MaxPlayersPerTeam*2);
    bg->SetName(BattleGroundName);
    bg->SetTeamStartLoc(0, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
    bg->SetTeamStartLoc(1, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
    bg->SetLevelRange(LevelMin, LevelMax);

    uint32 BattleGroundID = m_BattleGrounds.size();         // this will be replaced with instance ID later.
    if(BattleGroundID == 0) BattleGroundID = 1;

    bg->SetID(BattleGroundID);

    AddBattleGround(BattleGroundID, bg);
    sLog.outString("BattleGroundMgr: Created new battleground: %u %s (Map %u, %u players per team, Levels %u-%u)", BattleGroundID, bg->m_Name.c_str(), bg->m_MapId, bg->m_MaxPlayersPerTeam, bg->m_LevelMin, bg->m_LevelMax);
    return BattleGroundID;
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:22,代码来源:BattleGroundMgr.cpp


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