mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 23:51:09 -04:00
[Server] Avoid duplicates of the same player in a cell's loaders
This commit is contained in:
parent
b94c0a9991
commit
f532ab241d
@ -29,8 +29,17 @@ Cell::Iterator Cell::end() const
|
|||||||
|
|
||||||
void Cell::addPlayer(Player *player)
|
void Cell::addPlayer(Player *player)
|
||||||
{
|
{
|
||||||
auto it = find(player->cells.begin(), player->cells.end(), this);
|
// Ensure the player hasn't already been added
|
||||||
if (it == player->cells.end())
|
auto it = find(begin(), end(), player);
|
||||||
|
|
||||||
|
if (it != end())
|
||||||
|
{
|
||||||
|
LOG_APPEND(Log::LOG_INFO, "- Attempt to add %s to Cell %s again was ignored", player->npc.mName.c_str(), getDescription().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto it2 = find(player->cells.begin(), player->cells.end(), this);
|
||||||
|
if (it2 == player->cells.end())
|
||||||
{
|
{
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Adding %s to Player %s", getDescription().c_str(), player->npc.mName.c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Adding %s to Player %s", getDescription().c_str(), player->npc.mName.c_str());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user