示例#1
0
文件: party.cpp 项目: maxper/darkstar
void CParty::RemovePartyLeader(CBattleEntity* PEntity)
{
	DSP_DEBUG_BREAK_IF(members.empty());

    int ret = Sql_Query(SqlHandle, "SELECT charname FROM accounts_sessions JOIN chars ON accounts_sessions.charid = chars.charid \
                                    JOIN accounts_parties ON accounts_parties.charid = chars.charid WHERE partyid = %u AND NOT partyflag & %d \
                                    ORDER BY timestamp ASC LIMIT 1;", m_PartyID, PARTY_LEADER);
    if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0 && Sql_NextRow(SqlHandle) == SQL_SUCCESS)
    {
        SetLeader(Sql_GetData(SqlHandle, 0));
    }
    if (m_PLeader == PEntity)
    {
        DisbandParty();
    }
    else
    {
        RemoveMember(PEntity);
    }
}
示例#2
0
void CParty::RemovePartyLeader(CBattleEntity* PEntity)
{
	DSP_DEBUG_BREAK_IF(members.empty());
	DSP_DEBUG_BREAK_IF(m_PLeader != PEntity);
    DSP_DEBUG_BREAK_IF(PEntity->objtype != TYPE_PC);

	if (members.size() == 1)
	{
		DisbandParty();
	}
    else
    {
		for (uint32 i = 0; i < members.size(); ++i)
		{
			if (PEntity != members.at(i))
			{
				SetLeader(members.at(i));
				break;
			}
		}
        RemoveMember(PEntity);
	}
}