本文整理汇总了C++中BattleGround::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleGround::Reset方法的具体用法?C++ BattleGround::Reset怎么用?C++ BattleGround::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BattleGround
的用法示例。
在下文中一共展示了BattleGround::Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBattleGroundTemplate
// create a new battleground that will really be used to play
BattleGround * BattleGroundMgr::CreateNewBattleGround(uint32 bgTypeId)
{
BattleGround *bg = NULL;
// get the template BG
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
if(!bg_template)
{
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
return 0;
}
// create a copy of the BG template
switch(bgTypeId)
{
case BATTLEGROUND_AV:
bg = new BattleGroundAV(*(BattleGroundAV*)bg_template);
break;
case BATTLEGROUND_WS:
bg = new BattleGroundWS(*(BattleGroundWS*)bg_template);
break;
case BATTLEGROUND_AB:
bg = new BattleGroundAB(*(BattleGroundAB*)bg_template);
break;
default:
//bg = new BattleGround;
return 0;
break; // placeholder for non implemented BG
}
// generate a new instance id
bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id
// reset the new bg (set status to status_wait_queue from status_none)
bg->Reset();
/* will be setup in BG::Update() when the first player is ported in
if(!(bg->SetupBattleGround()))
{
sLog.outError("BattleGround: CreateNewBattleGround: SetupBattleGround failed for bg %u", bgTypeId);
delete bg;
return 0;
}
*/
// add BG to free slot queue
bg->AddToBGFreeSlotQueue();
// add bg to update list
AddBattleGround(bg->GetInstanceID(), bg);
return bg;
}
示例2: 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;
}