コード例 #1
3
void Transporter::TransportPassengers(uint32 mapid, uint32 oldmap, float x, float y, float z)
{
    sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);

    if (mPassengers.size() > 0)
    {
        PassengerIterator itr = mPassengers.begin();
        PassengerIterator it2;

        WorldPacket Pending(SMSG_TRANSFER_PENDING, 12);
        Pending << mapid << GetEntry() << oldmap;

        WorldPacket NewWorld;
        LocationVector v;

        for (; itr != mPassengers.end();)
        {
            it2 = itr;
            ++itr;

            Player* plr = objmgr.GetPlayer(it2->first);
            if (!plr)
            {
                // remove all non players from map
                mPassengers.erase(it2);
                continue;
            }
            if (!plr->GetSession() || !plr->IsInWorld())
                continue;

            v.x = x + plr->transporter_info.x;
            v.y = y + plr->transporter_info.y;
            v.z = z + plr->transporter_info.z;
            v.o = plr->GetOrientation();

            if (mapid == 530 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_XPACK_01))
            {
                // player does not have BC content, repop at graveyard
                plr->RepopAtGraveyard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId());
                continue;
            }

            if (mapid == 571 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_XPACK_02))
            {
                plr->RepopAtGraveyard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId());
                continue;
            }

            plr->GetSession()->SendPacket(&Pending);
            plr->_Relocate(mapid, v, false, true, 0);

            // Lucky bitch. Do it like on official.
            if (plr->IsDead())
            {
                plr->ResurrectPlayer();
                plr->SetHealth(plr->GetMaxHealth());
                plr->SetPower(POWER_TYPE_MANA, plr->GetMaxPower(POWER_TYPE_MANA));
            }
        }
    }

    // Set our position
    RemoveFromWorld(false);
    SetMapId(mapid);
    SetPosition(x, y, z, m_position.o, false);
    AddToWorld();
}
コード例 #2
0
void Transporter::TransportPassengers(uint32 mapid, uint32 oldmap, float x, float y, float z)
{
	sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);

	if(mPassengers.size() > 0)
	{
		PassengerIterator itr = mPassengers.begin();
		PassengerIterator it2;

		WorldPacket Pending(SMSG_TRANSFER_PENDING, 12);
		Pending << mapid << GetEntry() << oldmap;

		WorldPacket NewWorld;
		LocationVector v;

		for(; itr != mPassengers.end();)
		{
			it2 = itr;
			++itr;

			Player *plr = objmgr.GetPlayer(it2->first);
			if(!plr)
			{
				// remove from map
				mPassengers.erase(it2);
				continue;
			}
			if(!plr->GetSession() || !plr->IsInWorld()) 
				continue;

			plr->m_lockTransportVariables = true;

			v.x = x + plr->m_TransporterX;
			v.y = y + plr->m_TransporterY;
			v.z = z + plr->m_TransporterZ;
			v.o = plr->GetOrientation();

			if(mapid == 530 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_XPACK_01))
			{
				// player is not flagged to access bc content, repop at graveyard
				plr->RepopAtGraveyard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId());
				continue;
			}

			plr->GetSession()->SendPacket(&Pending);
			plr->_Relocate(mapid, v, false, true, 0);

			// Lucky bitch. Do it like on official.
			if(plr->isDead())
			{
				plr->ResurrectPlayer();
				plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
				plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
			}
		}
	}

	// Set our position
	RemoveFromWorld(false);
	SetMapId(mapid);
	SetPosition(x,y,z,m_position.o,false);
	AddToWorld();
}
コード例 #3
0
    int DoRun()
    {
        // we must ensure that OnExit() is called even if an exception is thrown
        // from inside ProcessEvents() but we must call it from Exit() in normal
        // situations because it is supposed to be called synchronously,
        // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
        // something similar here)
    #if wxUSE_EXCEPTIONS
        for( ; ; )
        {
            try
            {
    #endif // wxUSE_EXCEPTIONS

                // this is the event loop itself
                for( ; ; )
                {
                    // generate and process idle events for as long as we don't
                    // have anything else to do
                    while ( !m_shouldExit && !Pending() && ProcessIdle() )
                        ;

                    if ( m_shouldExit )
                        break;

                    // a message came or no more idle processing to do, dispatch
                    // all the pending events and call Dispatch() to wait for the
                    // next message
                    if ( !ProcessEvents() )
                    {
                        // we got WM_QUIT
                        break;
                    }
                }

                // Process the remaining queued messages, both at the level of the
                // underlying toolkit level (Pending/Dispatch()) and wx level
                // (Has/ProcessPendingEvents()).
                //
                // We do run the risk of never exiting this loop if pending event
                // handlers endlessly generate new events but they shouldn't do
                // this in a well-behaved program and we shouldn't just discard the
                // events we already have, they might be important.
                for( ; ; )
                {
                    bool hasMoreEvents = false;
                    if ( wxTheApp && wxTheApp->HasPendingEvents() )
                    {
                        wxTheApp->ProcessPendingEvents();
                        hasMoreEvents = true;
                    }

                    if ( Pending() )
                    {
                        Dispatch();
                        hasMoreEvents = true;
                    }

                    if ( !hasMoreEvents )
                        break;
                }

    #if wxUSE_EXCEPTIONS
                // exit the outer loop as well
                break;
            }
            catch ( ... )
            {
                try
                {
                    if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() )
                    {
                        OnExit();
                        break;
                    }
                    //else: continue running the event loop
                }
                catch ( ... )
                {
                    // OnException() throwed, possibly rethrowing the same
                    // exception again: very good, but we still need OnExit() to
                    // be called
                    OnExit();
                    throw;
                }
            }
        }
    #endif // wxUSE_EXCEPTIONS

        return m_exitcode;
    }
コード例 #4
0
ファイル: evtloopcmn.cpp プロジェクト: czxxjtu/wxPython-1
int wxEventLoopManual::Run()
{
    // event loops are not recursive, you need to create another loop!
    wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") );

    // ProcessIdle() and Dispatch() below may throw so the code here should
    // be exception-safe, hence we must use local objects for all actions we
    // should undo
    wxEventLoopActivator activate(wx_static_cast(wxEventLoop *, this));

    // we must ensure that OnExit() is called even if an exception is thrown
    // from inside Dispatch() but we must call it from Exit() in normal
    // situations because it is supposed to be called synchronously,
    // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
    // something similar here)
#if wxUSE_EXCEPTIONS
    for ( ;; )
    {
        try
        {
#endif // wxUSE_EXCEPTIONS

            // this is the event loop itself
            for ( ;; )
            {
                // give them the possibility to do whatever they want
                OnNextIteration();

                // generate and process idle events for as long as we don't
                // have anything else to do
                while ( !Pending() && (wxTheApp && wxTheApp->ProcessIdle()) )
                    ;

                // if the "should exit" flag is set, the loop should terminate
                // but not before processing any remaining messages so while
                // Pending() returns true, do process them
                if ( m_shouldExit )
                {
                    while ( Pending() )
                        Dispatch();

                    break;
                }

                // a message came or no more idle processing to do, sit in
                // Dispatch() waiting for the next message
                if ( !Dispatch() )
                {
                    // we got WM_QUIT
                    break;
                }
            }

#if wxUSE_EXCEPTIONS
            // exit the outer loop as well
            break;
        }
        catch ( ... )
        {
            try
            {
                if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() )
                {
                    OnExit();
                    break;
                }
                //else: continue running the event loop
            }
            catch ( ... )
            {
                // OnException() throwed, possibly rethrowing the same
                // exception again: very good, but we still need OnExit() to
                // be called
                OnExit();
                throw;
            }
        }
    }
#endif // wxUSE_EXCEPTIONS

    return m_exitcode;
}
コード例 #5
0
ファイル: nsBaseChannel.cpp プロジェクト: flodolo/gecko-dev
NS_IMETHODIMP
nsBaseChannel::IsPending(bool *result)
{
  *result = Pending();
  return NS_OK;
}
コード例 #6
0
ファイル: nsBaseChannel.cpp プロジェクト: flodolo/gecko-dev
bool
nsBaseChannel::HasContentTypeHint() const
{
  NS_ASSERTION(!Pending(), "HasContentTypeHint called too late");
  return !mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE);
}