本文整理汇总了C++中map_session_list_t::end方法的典型用法代码示例。如果您正苦于以下问题:C++ map_session_list_t::end方法的具体用法?C++ map_session_list_t::end怎么用?C++ map_session_list_t::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map_session_list_t
的用法示例。
在下文中一共展示了map_session_list_t::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: map_cleanup
int32 map_cleanup(uint32 tick, CTaskMgr::CTask* PTask)
{
map_session_list_t::iterator it = map_session_list.begin();
while(it != map_session_list.end())
{
map_session_data_t* map_session_data = it->second;
if( (time(NULL) - map_session_data->last_update) > (map_config.max_time_lastupdate/1000) )
{
if (map_session_data->PChar)
{
ShowWarning("map_cleanup: "CL_WHITE"%s"CL_RESET" timed out, session closed\n",map_session_data->PChar->GetName());
map_session_data->PChar->status = STATUS_SHUTDOWN;
PacketParcer[0x00D](map_session_data, map_session_data->PChar, 0);
} else {
ShowWarning("map_cleanup: "CL_WHITE"WHITHOUT CHAR"CL_RESET" timed out, session closed\n");
const int8* fmtQuery = "DELETE FROM accounts_sessions WHERE client_addr = %u AND client_port = %u";
Sql_Query(SqlHandle,fmtQuery,map_session_data->client_addr,map_session_data->client_port);
aFree(map_session_data->server_packet_data);
delete map_session_data;
map_session_list.erase(it++);
continue;
}
}
++it;
}
return 0;
}
示例2: mapsession_getbyipp
map_session_data_t* mapsession_getbyipp(uint64 ipp)
{
map_session_list_t::iterator i = map_session_list.find(ipp);
if( i == map_session_list.end() )
return NULL;
return (*i).second;
}
示例3: mapsession_getbyipp
map_session_data_t* mapsession_getbyipp(uint64 ipp)
{
map_session_list_t::iterator i = map_session_list.begin();
while (i != map_session_list.end())
{
if ((*i).first == ipp)
return (*i).second;
i++;
}
return nullptr;
}
示例4: map_cleanup
int32 map_cleanup(uint32 tick, CTaskMgr::CTask* PTask)
{
map_session_list_t::iterator it = map_session_list.begin();
while (it != map_session_list.end())
{
map_session_data_t* map_session_data = it->second;
CCharEntity* PChar = map_session_data->PChar;
if ((time(nullptr) - map_session_data->last_update) > 5)
{
if (PChar != nullptr && !(PChar->nameflags.flags & FLAG_DC))
{
PChar->nameflags.flags |= FLAG_DC;
PChar->updatemask |= UPDATE_HP;
if (PChar->status == STATUS_NORMAL)
{
PChar->loc.zone->SpawnPCs(PChar);
}
}
if ((time(nullptr) - map_session_data->last_update) > map_config.max_time_lastupdate)
{
if (PChar != nullptr)
{
if (map_session_data->shuttingDown == 0)
{
//[Alliance] fix to stop server crashing:
//if a party within an alliance only has 1 char (that char will be party leader)
//if char then disconnects we need to tell the server about the alliance change
if (PChar->PParty != nullptr && PChar->PParty->m_PAlliance != nullptr && PChar->PParty->GetLeader() == PChar)
{
if (PChar->PParty->members.size() == 1)
{
if (PChar->PParty->m_PAlliance->partyList.size() == 1)
{
PChar->PParty->m_PAlliance->dissolveAlliance();
}
else
{
PChar->PParty->m_PAlliance->removeParty(PChar->PParty);
}
}
}
// uncharm pet if player d/c
if (PChar->PPet != nullptr && PChar->PPet->objtype == TYPE_MOB)
{
petutils::DespawnPet(PChar);
}
PChar->StatusEffectContainer->SaveStatusEffects(true);
ShowDebug(CL_CYAN"map_cleanup: %s timed out, closing session\n" CL_RESET, PChar->GetName());
PChar->status = STATUS_SHUTDOWN;
PacketParser[0x00D](map_session_data, PChar, 0);
}
else
{
map_session_data->PChar->StatusEffectContainer->SaveStatusEffects(true);
Sql_Query(SqlHandle, "DELETE FROM accounts_sessions WHERE charid = %u;", map_session_data->PChar->id);
aFree(map_session_data->server_packet_data);
delete map_session_data->PChar;
delete map_session_data;
map_session_data = nullptr;
map_session_list.erase(it++);
continue;
}
}
else if (map_session_data->shuttingDown == 0)
{
ShowWarning(CL_YELLOW"map_cleanup: WHITHOUT CHAR timed out, session closed\n" CL_RESET);
const int8* Query = "DELETE FROM accounts_sessions WHERE client_addr = %u AND client_port = %u";
Sql_Query(SqlHandle, Query, map_session_data->client_addr, map_session_data->client_port);
aFree(map_session_data->server_packet_data);
map_session_list.erase(it++);
delete map_session_data;
continue;
}
}
}
else if (PChar != nullptr && (PChar->nameflags.flags & FLAG_DC))
{
PChar->nameflags.flags &= ~FLAG_DC;
PChar->updatemask |= UPDATE_HP;
PChar->pushPacket(new CCharUpdatePacket(PChar));
if (PChar->status == STATUS_NORMAL)
{
PChar->loc.zone->SpawnPCs(PChar);
}
charutils::SaveCharStats(PChar);
}
//.........这里部分代码省略.........