示例#1
0
bool CSector::MoveCharToSector( CChar * pChar )
{
	ADDTOCALLSTACK("CSector::MoveCharToSector");
	// Move a CChar into this CSector.
	// ASSUME: called from CChar.MoveToChar() assume ACtive char.

	if ( IsCharActiveIn(pChar) )
		return false;	// already here

	// Check my save parity vs. this sector's
	if ( pChar->IsStatFlag( STATF_SaveParity ) != m_fSaveParity )
	{
		if ( g_World.IsSaving())
		{
			if ( m_fSaveParity == g_World.m_fSaveParity )
			{
				// Save out the CChar now. the sector has already been saved.
				if ( pChar->m_pPlayer )
					pChar->r_WriteParity(g_World.m_FilePlayers);
				else
					pChar->r_WriteParity(g_World.m_FileWorld);
			}
			else
			{
				// We need to write out this CSector now. (before adding client)
				r_Write();
			}
		}
	}

	m_Chars_Active.AddCharToSector(pChar);	// remove from previous spot.
	return true;
}
示例#2
0
bool CSector::MoveCharToSector( CChar * pChar )
{
	ADDTOCALLSTACK("CSector::MoveCharToSector");
	// Move a CChar into this CSector.
    ASSERT(pChar);

	if ( IsCharActiveIn(pChar) )
		return false;	// already here

	// Check my save parity vs. this sector's
	if ( pChar->IsStatFlag( STATF_SAVEPARITY ) != m_fSaveParity )
	{
		if ( g_World.IsSaving())
		{
			if ( m_fSaveParity == g_World.m_fSaveParity )
			{
				// Save out the CChar now. the sector has already been saved.
				if ( pChar->m_pPlayer )
					pChar->r_WriteParity(g_World.m_FilePlayers);
				else
					pChar->r_WriteParity(g_World.m_FileWorld);
			}
			else
			{
				// We need to write out this CSector now. (before adding client)
				r_Write();
			}
		}
	}

    m_Chars_Active.AddCharActive(pChar);	// remove from previous spot.
    if (IsSleeping())
    {
        CClient *pClient = pChar->GetClient();
        if (pClient)    // A client just entered
        {
            GoAwake();    // Awake the sector
        }
        else if (!pChar->IsSleeping())    // An NPC entered, but the sector is sleeping
        {
            pChar->GoSleep(); // then make the NPC sleep too.
        }
    }
    else
    {
        if (pChar->m_pNPC && pChar->IsSleeping())
        {
            pChar->GoAwake();
        }
    }
	
	return true;
}
示例#3
0
bool CSector::MoveCharToSector(CChar * pChar)
{
	ADDTOCALLSTACK("CSector::MoveCharToSector");
	// Move a CChar into this CSector.
	// NOTE:
	//   m_pt is still the old location. Not moved yet!
	// ASSUME: called from CChar.MoveToChar() assume Active char.

	if (IsCharActiveIn(pChar))
		return false;	// already here

	CheckSaveParity(pChar);

	m_Chars_Active.AddCharToSector(pChar);	// remove from previous spot.
	return(true);
}