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

C++ GetStartTime函数代码示例

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

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



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

示例1: Update

void BattlegroundRL::Update (uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47 * MINUTE * IN_MILLISECONDS)          // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }
}
开发者ID:814077430,项目名称:ArkCORE,代码行数:13,代码来源:BattlegroundRL.cpp


示例2: Update

void BattlegroundDS::Update(uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    if (getWaterFallTimer() < diff)
    {
        if (GetBgMap(false))
            if (isWaterFallActive())
            {
                setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, getWaterFallTimer());
                setWaterFallActive(false);
            }
            else
            {
                setWaterFallTimer(BG_DS_WATERFALL_DURATION);
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, RESPAWN_IMMEDIATELY);
                setWaterFallActive(true);
            }
    }
    else
        setWaterFallTimer(getWaterFallTimer() - diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if(m_knockback < diff && m_knockbackCheck)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); itr++)
            {
                Player * plr = sObjectMgr->GetPlayer(itr->first);
                if (plr->GetTeam() == ALLIANCE && plr->GetDistance2d(1214, 765) <= 50 && plr->GetPositionZ() > 10)
                    KnockBackPlayer(plr, 6.15f, 50.00f, 7.00f);
                if (plr->GetTeam() == HORDE && plr->GetDistance2d(1369, 817) <= 50 && plr->GetPositionZ() > 10)
                    KnockBackPlayer(plr, 3.10f, 50.00f, 7.00f);
                plr->RemoveAurasDueToSpell(48018);
            }
            m_knockbackCheck = false;
        } else m_knockback -= diff;
    }
}
开发者ID:fragiami,项目名称:ZoneLimit,代码行数:51,代码来源:BattlegroundDS.cpp


示例3: GetStartTime

BOOL CMAPIAppointment::GetStartTime(CString& strStartTime, LPCTSTR szFormat)
{
	SYSTEMTIME tm;
	if(GetStartTime(tm)) 
	{
		TCHAR szTime[256];
		if(!szFormat) szFormat=_T("MM/dd/yyyy hh:mm:ss tt");
		GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &tm, szFormat, szTime, 256);
		GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &tm, szTime, szTime, 256);
		strStartTime=szTime;
		return TRUE;
	}
	return FALSE;
}
开发者ID:DenSumy,项目名称:MapiEx,代码行数:14,代码来源:MAPIAppointment.cpp


示例4: InitializeObjects

void BattlegroundNA::InitializeObjects()
{
    ObjectGUIDsByType.resize(BG_NA_OBJECT_MAX);
    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i)
        SpawnGameObject(i, RESPAWN_IMMEDIATELY);
}
开发者ID:TrueWoW,项目名称:TrinityCore,代码行数:15,代码来源:BattlegroundNA.cpp


示例5: CheckMaxTime

void CheckMaxTime()
	{
	if (0 == g_ulMaxSecs.get())
		return;

	time_t Now = time(0);
	time_t ElapsedSecs = Now - GetStartTime();
	if (ElapsedSecs <= (time_t) g_ulMaxSecs.get())
		return;

	Log("Max time %s exceeded, elapsed seconds = %ul\n",
	  MaxSecsToStr(), ElapsedSecs);

	SaveCurrentAlignment();
	exit(EXIT_Success);
	}
开发者ID:Wyss,项目名称:mauve-py,代码行数:16,代码来源:savebest.cpp


示例6: GetStartTime

void ThreadProc::run (void)
{

    GetStartTime ();
    SocketReBuild();
    for(;!gameOver;)
    {
        if(!IsWorkinPermit())
        {
            msleep(10);
            continue;
        }
        GoGoStatusMachineRecv();
        DelaySRTime();
        GoGoStatusMachineSend ();
        OverTimeProc ();
    }
}
开发者ID:crazybun,项目名称:FreshTerminalOperatingTools,代码行数:18,代码来源:threadproc.cpp


示例7: ReadOptionsDirectTimeRange

void ReadOptionsDirectTimeRange(struct options_direct *opts,struct input *X)
{
  if(opts->t_start_flag==0)
    {
      opts->t_start = GetStartTime(X);
      opts->t_start_flag=1;
      mexWarnMsgIdAndTxt("STAToolkit:ReadOptionsTimeRange:missingParameter","Missing parameter start_time. Extracting from input: %f.\n",opts->t_start);
    }

  if(opts->t_end_flag==0)
    {
      opts->t_end = GetEndTime(X);
      opts->t_end_flag=1;
      mexWarnMsgIdAndTxt("STAToolkit:ReadOptionsTimeRange:missingParameter","Missing parameter end_time. Extracting from input: %f.\n",opts->t_end);
    }

  if((opts->t_start)>(opts->t_end))
      mexErrMsgIdAndTxt("STAToolkit:ReadOptionsTimeRange:badRange","Lower limit greater than upper limit for start_time and end_time.\n");
}
开发者ID:Field-Lab,项目名称:matlab,代码行数:19,代码来源:direct_mx.c


示例8: CRC32_Init

unsigned int CPhonemeTag::ComputeDataCheckSum()
{
	CRC32_t crc;
	CRC32_Init( &crc );

	// Checksum the text
	CRC32_ProcessBuffer( &crc, m_szPhoneme, Q_strlen( m_szPhoneme ) );
	int phonemeCode = GetPhonemeCode();
	CRC32_ProcessBuffer( &crc, &phonemeCode, sizeof( int ) );

	// Checksum timestamps
	float startTime = GetStartTime();
	float endTime = GetEndTime();
	CRC32_ProcessBuffer( &crc, &startTime, sizeof( float ) );
	CRC32_ProcessBuffer( &crc, &endTime, sizeof( float ) );

	CRC32_Final( &crc );

	return ( unsigned int )crc;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:20,代码来源:sentence.cpp


示例9: return

bool TimedObject::OverlapWith(TimedObject* other)
{
	if(other == NULL)
		return false;
	
	TimedObject *first, *second;
    
	if(GetStartTime() <= other->GetStartTime()) 
    {
		first = this;
		second = other;
	} 
    else 
    {
		first = other;
		second = this;
	}
	    
	return (first->GetEndTime() >= second->GetStartTime());
}
开发者ID:AIDman,项目名称:Kaldi,代码行数:20,代码来源:timedobject.cpp


示例10: PostUpdateImpl

void BattlegroundDS::PostUpdateImpl(uint32 diff)
{
        if (GetStartTime() >= 75*IN_MILLISECONDS)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
            {
                Player *plr = ObjectAccessor::FindPlayer(itr->first);
                if (plr && plr->isAlive() && plr->GetPositionX() < 1260 && plr->GetPositionY() >755 && plr->GetPositionY() < 775 && plr->GetPositionZ() > 13)
                {
                    KnockBackPlayer(plr, 6.15f, 50.00f, 5.00f);
                    plr->RemoveAurasDueToSpell(48018);
                } 
                if (plr && plr->isAlive() && plr->GetPositionX() > 1330 && plr->GetPositionY() >805 && plr->GetPositionY() < 825 && plr->GetPositionZ() > 13)
                {
                    KnockBackPlayer(plr, 3.10f, 50.00f, 5.00f);
                    plr->RemoveAurasDueToSpell(48018);
                }
            }
        }

        if (getWaterFallTimer() < diff)
        {
            if (isWaterFallActive())
            {
                setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, getWaterFallTimer());
                setWaterFallActive(false);
            }
            else
            {
                setWaterFallTimer(BG_DS_WATERFALL_DURATION);
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, RESPAWN_IMMEDIATELY);
                setWaterFallActive(true);
            }
        }
        else
            setWaterFallTimer(getWaterFallTimer() - diff);
}
开发者ID:FirstCore,项目名称:FunCore,代码行数:40,代码来源:BattlegroundDS.cpp


示例11: GetStartTime

void UMovieSceneSubSection::TrimSection( float TrimTime, bool bTrimLeft )
{
	if ( !IsTimeWithinSection( TrimTime ) )
	{
		return;
	}

	float InitialStartTime = GetStartTime();
	float InitialStartOffset = StartOffset;

	UMovieSceneSection::TrimSection( TrimTime, bTrimLeft );

	// If trimming off the left, set the offset of the shot
	if ( bTrimLeft )
	{
		float NewStartOffset = ( TrimTime - InitialStartTime ) / TimeScale;
		NewStartOffset += InitialStartOffset;

		// Ensure start offset is not less than 0
		StartOffset = FMath::Max( NewStartOffset, 0.f );
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:22,代码来源:MovieSceneSubSection.cpp


示例12: QDialog

//---------------------------------------------------------------------------
satpassdialog::satpassdialog(PList *_satList, QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::satpassdialog)
{
 TSat *sat;
 int i, flags;
 double daynum = GetStartTime(QDateTime::currentDateTime().toUTC());;

    m_ui->setupUi(this);
    setLayout(m_ui->gridLayout);

    mw = (MainWindow *) parent;
    satList = _satList;

    flags = 0;
    for(i=0; i<satList->Count; i++) {
        sat = (TSat *) satList->ItemAt(i);

        sat->daynum = daynum;
        sat->Calc();
        if(sat->IsGeostationary() || sat->Decayed(0))
            continue;

        m_ui->satListWidget->addItem(sat->name);

        flags |= sat->isActive() ? 1:0;
    }

    m_ui->activeSatBtn->setVisible(flags ? true:false);
    m_ui->dateEdit->setDate(QDate::currentDate());

    if(flags)
        on_activeSatBtn_clicked();
    else if(m_ui->satListWidget->count())
        on_satListWidget_currentItemChanged(m_ui->satListWidget->item(0), NULL);
    else
        QMessageBox::critical(this, "No satellites found!", "Click menu Satellite->Keplerian elements to download.");
}
开发者ID:poes-weather,项目名称:poes-usrp,代码行数:39,代码来源:satpassdialog.cpp


示例13: assert

bool C4TableGraph::DumpToFile(const StdStrBuf &rszFilename,
                              bool fAppend) const {
  assert(!!rszFilename);
  // nothing to write?
  if (!fWrapped && !iBackLogPos) return false;
  // try append if desired; create if unsuccessful
  CStdFile out;
  if (fAppend)
    if (!out.Append(rszFilename.getData())) fAppend = false;
  if (!fAppend) {
    if (!out.Create(rszFilename.getData())) return false;
    // print header
    out.WriteString("t\tv\n\r");
  }
  // write out current timeframe
  int iEndTime = GetEndTime();
  StdStrBuf buf;
  for (int iWriteTime = GetStartTime(); iWriteTime < iEndTime; ++iWriteTime) {
    buf.Format("%d\t%d\n\r", (int)iWriteTime, (int)GetValue(iWriteTime));
    out.WriteString(buf.getData());
  }
  return true;
}
开发者ID:ev1313,项目名称:yaC,代码行数:23,代码来源:C4Network2Stats.cpp


示例14: Update

void BattlegroundNA::Update(uint32 diff)
{
    Battleground::Update(diff);

    if(GetStatus() == STATUS_IN_PROGRESS)
    {
        if(GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }

        if(m_uiTeleport < diff)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
            {
                Player* pPlayer = sObjectMgr->GetPlayer(itr->first);
                if(pPlayer && pPlayer->GetPositionZ() < 10)
                    pPlayer->TeleportTo(pPlayer->GetMapId(), 4056.513f, 2921.693f, 13.932f, pPlayer->GetOrientation(), false);
            }
            m_uiTeleport = 1000;
        } else m_uiTeleport -= diff;
    }
}
开发者ID:FreedomEmu,项目名称:FreedomEmu,代码行数:24,代码来源:BattlegroundNA.cpp


示例15: GetMangosString

void BattleGround::EndBattleGround(uint32 winner)
{
    this->RemoveFromBGFreeSlotQueue();

    uint32 loser_rating = 0;
    uint32 winner_rating = 0;
    WorldPacket data;
    Player *Source = NULL;
    const char *winmsg = "";

    if(winner == ALLIANCE)
    {
        winmsg = GetMangosString(LANG_BG_A_WINS);

        PlaySoundToAll(SOUND_ALLIANCE_WINS);                // alliance wins sound

        SetWinner(WINNER_ALLIANCE);
    }
    else if(winner == HORDE)
    {
        winmsg = GetMangosString(LANG_BG_H_WINS);

        PlaySoundToAll(SOUND_HORDE_WINS);                   // horde wins sound

        SetWinner(WINNER_HORDE);
    }
    else
    {
        SetWinner(3);
    }

    SetStatus(STATUS_WAIT_LEAVE);
    m_EndTime = 0;

    for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
    {
        Player *plr = sObjectMgr.GetPlayer(itr->first);
        if(!plr)
        {
            sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
            continue;
        }

        // should remove spirit of redemption
        if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
            plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);

        if(!plr->isAlive())
        {
            plr->ResurrectPlayer(1.0f);
            plr->SpawnCorpseBones();
        }
        else
        {
            //needed cause else in av some creatures will kill the players at the end
            plr->CombatStop();
            plr->getHostileRefManager().deleteReferences();
        }

        uint32 team = itr->second.Team;
        if(!team) team = plr->GetTeam();

        if(team == winner)
        {
            if(!Source)
                Source = plr;
            RewardMark(plr,ITEM_WINNER_COUNT);
            RewardQuestComplete(plr);
        }
        else
            RewardMark(plr,ITEM_LOSER_COUNT);

        plr->CombatStopWithPets(true);

        BlockMovement(plr);

        sBattleGroundMgr.BuildPvpLogDataPacket(&data, this);
        plr->GetSession()->SendPacket(&data);

        uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID());
        sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetTeam(), plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime());
        plr->GetSession()->SendPacket(&data);
    }

    // inform invited players about the removal
    sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID())].BGEndedRemoveInvites(this);

    if(Source)
    {
        ChatHandler(Source).FillMessageData(&data, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, Source->GetGUID(), winmsg);
        SendPacketToAll(&data);
    }
}
开发者ID:magomags,项目名称:mangoszero,代码行数:93,代码来源:BattleGround.cpp


示例16: WaveClip

bool WaveClip::ClearAndAddCutLine(double t0, double t1)
{
   if (t0 > GetEndTime() || t1 < GetStartTime())
      return true; // time out of bounds
      
   WaveClip *newClip = new WaveClip(mSequence->GetDirManager(),
                                    mSequence->GetSampleFormat(),
                                    mRate);
   double clip_t0 = t0;
   double clip_t1 = t1;
   if (clip_t0 < GetStartTime())
      clip_t0 = GetStartTime();
   if (clip_t1 > GetEndTime())
      clip_t1 = GetEndTime();

   if (!newClip->CreateFromCopy(clip_t0, clip_t1, this))
      return false;
   newClip->SetOffset(clip_t0-mOffset);

   // Sort out cutlines that belong to the new cutline
   WaveClipList::compatibility_iterator nextIt;

   for (WaveClipList::compatibility_iterator it = mCutLines.GetFirst(); it; it=nextIt)
   {
      nextIt = it->GetNext();
      WaveClip* clip = it->GetData();
      double cutlinePosition = mOffset + clip->GetOffset();
      if (cutlinePosition >= t0 && cutlinePosition <= t1)
      {
         clip->SetOffset(cutlinePosition - newClip->GetOffset() - mOffset);
         newClip->mCutLines.Append(clip);
         mCutLines.DeleteNode(it);
      } else
      if (cutlinePosition >= t1)
      {
         clip->Offset(clip_t0-clip_t1);
      }
   }
   
   // Clear actual audio data
   sampleCount s0, s1;

   TimeToSamplesClip(t0, &s0);
   TimeToSamplesClip(t1, &s1);
   
   if (GetSequence()->Delete(s0, s1-s0))
   {
      // Collapse envelope
      GetEnvelope()->CollapseRegion(t0, t1);
      if (t0 < GetStartTime())
         Offset(-(GetStartTime() - t0));

      MarkChanged();

      mCutLines.Append(newClip);
      return true;
   } else
   {
      delete newClip;
      return false;
   }
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:62,代码来源:WaveClip.cpp


示例17: GetStartTime

double NoteTrack::GetEndTime()
{
   return GetStartTime() + (mSeq ? mSeq->get_real_dur() : 0.0);
}
开发者ID:dannyflax,项目名称:audacity,代码行数:4,代码来源:NoteTrack.cpp


示例18: Update

void BattlegroundDS::Update(uint32 diff)
{
    Battleground::Update(diff);

    if(GetStatus() != STATUS_IN_PROGRESS)
        return;

    if(GetStatus() == STATUS_IN_PROGRESS)
    {
        if(GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }
    if(getPipeKnockBackCount() < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
    {
        if(getPipeKnockBackTimer() < diff)
        {
            for(uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i)
                if(Creature* waterSpout = GetBgMap()->GetCreature(BGArrayForCreatures[i]))
                    waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);

            setPipeKnockBackCount(getPipeKnockBackCount() + 1);
            setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_DELAY);
        }
        else
            setPipeKnockBackTimer(getPipeKnockBackTimer() - diff);
    }

    //if(!m_knockback && m_teleport)
    //{
    //    if(m_teleport <= diff)
    //    {
    //        for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
    //        {
    //            Player* plr = ObjectAccessor::FindPlayer(itr->first);
    //            if(!plr)
    //                continue;

    //            if(plr->GetPositionZ() > 13.0f)
    //                HandlePlayerUnderMap(plr);
    //        }
    //        m_teleport = 5 * IN_MILLISECONDS;
    //    }
    //    else
    //        m_teleport -= diff;
    //}

    if(getWaterFallTimer() < diff)
    {
        switch(getWaterFallStatus())
        {
        case BG_DS_WATERFALL_STATUS_OFF: // Add the water
            DoorClose(BG_DS_OBJECT_WATER_2);
            setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION);
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING);
            break;
        case BG_DS_WATERFALL_STATUS_WARNING: // Active collision and start knockback timer
            if(GameObject* gob = GetBgMap()->GetGameObject(BGArrayForObjects[BG_DS_OBJECT_WATER_1]))
                gob->SetGoState(GO_STATE_READY);

            setWaterFallTimer(BG_DS_WATERFALL_DURATION);
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_ON);
            setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER);
            break;
        case BG_DS_WATERFALL_STATUS_ON: // Remove collision and water
            // turn off collision
            if(GameObject* gob = GetBgMap()->GetGameObject(BGArrayForObjects[BG_DS_OBJECT_WATER_1]))
                gob->SetGoState(GO_STATE_ACTIVE);

            DoorOpen(BG_DS_OBJECT_WATER_2);
            setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF);
            break;
        }
    }
    else
        setWaterFallTimer(getWaterFallTimer() - diff);
}
开发者ID:Darkelmo,项目名称:MythCore,代码行数:80,代码来源:BattlegroundDS.cpp


示例19: handlePacket

void Session::handlePacket(Packet* packet)
{

    isActive=true;
    lastUpdate=GetStartTime();
    unsigned char ID=packet->buffer[0];

    if(status == STATE_CONNECTING_2 || status == STATE_CONNECTED)
    {
        packet->decode();

        if(ID>=0x80 && ID<=0x8f)
        {
            if(DATA_PACKET_4* datapk=dynamic_cast<DATA_PACKET_4*>(packet))
            {
                int SeqNum=datapk->seqNumber;
                ACKQueue.push_back(SeqNum);
                std::vector<EncapsulatedPacket> packets=datapk->packets;
                for(auto iter=packets.cbegin(); iter!=packets.cend(); iter++)
                    handleEncapsulatedPacketRoute(*iter);

            }

        }


    }
    else if(ID>0x00 && ID<0x80)
    {
        packet->decode();

        if(OPEN_CONNECTION_REQUEST_1* pk_=dynamic_cast<OPEN_CONNECTION_REQUEST_1*>(packet))
        {
            //  std::cout<<"received a OPEN_CONNECTION_REQUEST_1 packet from ("<<address<<":"<<port<<")"<<std::endl;
            OPEN_CONNECTION_REPLY_1 reply;
            reply.mtuSize=pk_->mtuSize;
            reply.serverId=Manager->getID();
            reply.encode();
            sendPacket(reply);
            status=STATE_CONNECTING_1;


        }
        else
        {

            if((status==STATE_CONNECTING_1 ))


                if(OPEN_CONNECTION_REQUEST_2* pk=dynamic_cast<OPEN_CONNECTION_REQUEST_2*>(packet) )
                {
                    id=pk->clientID;

                    if(pk->serverPort == Manager->getPort())
                    {
                        mtuSize=std::max(abs(pk->mtuSize),1464);
                        OPEN_CONNECTION_REPLY_2 replyt;
                        replyt.mtuSize=mtuSize;
                        replyt.serverId=Manager->getID();
                        replyt.clientAddress=address;
                        replyt.clientPort=port;
                        replyt.encode();
                        sendPacket(replyt);
                        status=STATE_CONNECTING_2;
                    }
                }

        }

    }

}
开发者ID:K099,项目名称:ZhyCore,代码行数:72,代码来源:Session.cpp


示例20: GetTrinityString

void BattleGround::EndBattleGround(uint32 winner)
{
    this->RemoveFromBGFreeSlotQueue();
    uint32 almost_winning_team = HORDE;
    uint32 loser_rating = 0;
    uint32 winner_rating = 0;
    WorldPacket data;
    Player *Source = NULL;
    const char *winmsg = "";

    if(winner == ALLIANCE)
    {
        winmsg = GetTrinityString(LANG_BG_A_WINS);

        PlaySoundToAll(SOUND_ALLIANCE_WINS);                // alliance wins sound

        SetWinner(WINNER_ALLIANCE);
    }
    else if(winner == HORDE)
    {
        winmsg = GetTrinityString(LANG_BG_H_WINS);

        PlaySoundToAll(SOUND_HORDE_WINS);                   // horde wins sound

        SetWinner(WINNER_HORDE);
    }
    else
    {
        SetWinner(3);
    }

    SetStatus(STATUS_WAIT_LEAVE);
    m_EndTime = 0;

    for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
    {
        Player *plr = objmgr.GetPlayer(itr->first);
        if(!plr)
        {
            sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
            continue;
        }

        // should remove spirit of redemption
        if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
            plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);

        if(!plr->isAlive())
        {
            plr->ResurrectPlayer(1.0f);
            plr->SpawnCorpseBones();
        }

        uint32 team = itr->second.Team;
        if(!team) team = plr->GetTeam();


        if(team == winner)
        {
            if(!Source)
                Source = plr;
            RewardMark(plr,ITEM_WINNER_COUNT);
            UpdatePlayerScore(plr, SCORE_BONUS_HONOR, 20);
            RewardQuest(plr);
        }
        else if(winner !=0)
        {
        RewardMark(plr,ITEM_LOSER_COUNT);
        }
    else if(winner == 0)
    {
        if(sWorld.getConfig(CONFIG_PREMATURE_BG_REWARD))    // We're feeling generous, giving rewards to people who not earned them ;)
        {    //nested ifs for the win! its boring writing that, forgive me my unfunniness
            
            if(almost_winning_team == team)                    //player's team had more points
                RewardMark(plr,ITEM_WINNER_COUNT);
            else
                RewardMark(plr,ITEM_LOSER_COUNT);            // if scores were the same, each team gets 1 mark.
        }
    }

        plr->CombatStopWithPets(true);

        BlockMovement(plr);

        sBattleGroundMgr.BuildPvpLogDataPacket(&data, this);
        plr->GetSession()->SendPacket(&data);

        uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(GetTypeID());
        sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetTeam(), plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime());
        plr->GetSession()->SendPacket(&data);
    }

    // inform invited players about the removal
    sBattleGroundMgr.m_BattleGroundQueues[sBattleGroundMgr.BGQueueTypeId(GetTypeID())].BGEndedRemoveInvites(this);

    if(Source)
    {
        ChatHandler(Source).FillMessageData(&data, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, Source->GetGUID(), winmsg);
        SendPacketToAll(&data);
//.........这里部分代码省略.........
开发者ID:mynew,项目名称:TrinityCore-1,代码行数:101,代码来源:BattleGround.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetStartupInfo函数代码示例发布时间:2022-05-30
下一篇:
C++ GetStartPosition函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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