Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d855646
default initalize members
Pirulax Nov 2, 2020
ed53c93
Move consturctor to header
Pirulax Nov 3, 2020
813cade
Remove DeleteAll, move it to the destructor
Pirulax Nov 3, 2020
e691219
Use range based for loop in DoPulse
Pirulax Nov 3, 2020
ad9a1b4
Use range based for loop in PulseZombieCheck
Pirulax Nov 3, 2020
3429e5b
refactor Create()
Pirulax Nov 3, 2020
8d6b3f8
Refactor CountJoined
Pirulax Nov 3, 2020
878be4a
Refactor Get by nick
Pirulax Nov 3, 2020
1a048df
Add GetNetServerReliability and GetNetServerPriority to CPacket
Pirulax Nov 3, 2020
e5d7002
OPTIMIZE and refactor Broadcast* to use a predicate based generic DoB…
Pirulax Nov 3, 2020
9429c64
Add CNetBufferWatchdog include to CPlayerMgr
Pirulax Nov 3, 2020
f379144
Move IsValidPlayerModel to the header
Pirulax Nov 3, 2020
8b40ec1
add noexcept to SetScriptDebugging
Pirulax Nov 3, 2020
c7e329a
refactor OnPlayerJoin
Pirulax Nov 3, 2020
31fae7f
refactor AddToList
Pirulax Nov 3, 2020
699e761
Refactor RemoveFromList
Pirulax Nov 3, 2020
b1b718a
Various small refactors
Pirulax Nov 3, 2020
3434913
Refactor CSendList: Rename and add a few methods, move it out to CSen…
Pirulax Nov 4, 2020
ea4b71c
Add some notes about potential optimizations to CPlayer.h
Pirulax Nov 3, 2020
58d7ba7
Refactor CStaticFunDefs::GetRandomPlayer - add CPlayerMgr::GetRandom
Pirulax Nov 3, 2020
ac06e58
Refactor all IterBegin(), IterEnd()'s to IterJoined, and GetAllPlayer…
Pirulax Nov 3, 2020
4212960
Make use of BroadcastJoinedIf
Pirulax Nov 3, 2020
99ebedb
remove include CCommon.h from playermgr
Pirulax Nov 3, 2020
0dd6a80
Add somem more dassert's
Pirulax Nov 3, 2020
e03f529
Add BroadcastAll
Pirulax Nov 10, 2020
96968a9
Refactor CResource::SendNoClientCacheScripts to use the improved broa…
Pirulax Nov 4, 2020
ac53f33
Fixup some rebase fuckup
Pirulax Nov 4, 2020
0e2403d
finally fix CNetBufferWatchdog?
Pirulax Nov 9, 2020
9a2537e
add std hash overload for NetServerPlayerId
Pirulax Nov 9, 2020
53cc161
add friend GetEmptyMapKey and GetDeletedMapKey to NetServerPlayerID
Pirulax Nov 9, 2020
c6d0b36
Use CSendList instead of custm typedef in CPlayerManager
Pirulax Nov 10, 2020
9f2ab41
add include CGame.h to CPlayerManager.. <sad face>
Pirulax Nov 10, 2020
4eb3554
Make GetBitStreamVersion a const function (addendum to next)
Pirulax Nov 10, 2020
3c193a1
Fix CPlayerManager::BroadcastIf
Pirulax Nov 10, 2020
ef670c9
Try to fix cyclic CGame ref
Pirulax Nov 10, 2020
b38e58e
remove unnecessary cplyrmgr from crpcfunctions.h
Pirulax Nov 10, 2020
917c785
remove unnecessary cplyrmgr from cbanmgr.h
Pirulax Nov 10, 2020
02dfae1
Fix compilation error in CNetBuffer.cpp caused by changed return type…
Pirulax Nov 10, 2020
5367583
Add CPlayerManager::HasAnyJoined
Pirulax Nov 10, 2020
732a528
Fix CConsoleCommands::WhoIs
Pirulax Nov 10, 2020
6f68c7d
restore .gitignore
Pirulax Nov 10, 2020
86907d9
fix noshit_playerid.h
Pirulax Nov 11, 2020
dd2b410
fix noshit_playerid.h
Pirulax Nov 11, 2020
2b54fbe
fix AddToList
Pirulax Nov 11, 2020
34aa6f3
Add a few more checks to cplayermgr
Pirulax Nov 11, 2020
99208c1
Merge branch 'master' of https://github.com/multitheftauto/mtasa-blue…
Pirulax Jan 17, 2021
e6d42e9
Remove misleading comments
Pirulax Jan 24, 2021
cbc25c4
Add some comments
Pirulax Jan 24, 2021
8df2a9d
Fix member variable comments in header
Pirulax Jan 24, 2021
7a11759
Merge branch 'master' of https://github.com/multitheftauto/mtasa-blue…
Pirulax Jan 30, 2021
8e4f177
Fix errors created by merging master
Pirulax Jan 30, 2021
89beb08
Update Server/mods/deathmatch/logic/CResource.cpp
Pirulax Jan 31, 2021
04f9994
Remove _t suffix from template typenames
Pirulax Jan 31, 2021
448b46c
CResource.cpp format fix
Pirulax Jan 31, 2021
0b2620e
Add note about potential issue
Pirulax Jan 31, 2021
b38f48b
Fix format string
Pirulax Jan 31, 2021
bd5abd0
Add HasAnyConnected(), and small refactor to HasAnyJoined(). Fix CCOn…
Pirulax Jan 31, 2021
57ec714
Addendum to 04f9994efe019
Pirulax Jan 31, 2021
24566bf
Add debug stuff to CSendList::Insert
Pirulax Jan 31, 2021
325e70e
Fix GetRandom() returning IsBeingDeleted() players
Pirulax Mar 1, 2021
7f34c39
Merge branch 'master' of https://github.com/multitheftauto/mtasa-blue…
Pirulax Mar 17, 2021
afcaf8a
Fix GetRandom() compilation issue
Pirulax Mar 17, 2021
9560766
CSendList: erase group from version map if empty
Pirulax Mar 17, 2021
c9981fa
Optimize CPlayerManager::Get()
Pirulax Mar 17, 2021
a8a38a7
Optimize DoBroadcastIf
Pirulax Mar 17, 2021
2dcc979
Optimize Broadcast functions when pSkip == nullptr
Pirulax Mar 17, 2021
c985014
Fix min client version stuff in player manager
Pirulax Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 37 additions & 49 deletions Server/mods/deathmatch/logic/ASE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,35 +293,29 @@ std::string ASE::QueryFull()
char szTemp[256] = {'\0'};
CPlayer* pPlayer = NULL;

list<CPlayer*>::const_iterator pIter = m_pPlayerManager->IterBegin();
for (; pIter != m_pPlayerManager->IterEnd(); pIter++)
{
pPlayer = *pIter;
if (pPlayer->IsJoined())
{
reply << ucFlags;
// nick
std::string strPlayerName = RemoveColorCodes(pPlayer->GetNick());
if (strPlayerName.length() == 0)
strPlayerName = pPlayer->GetNick();
reply << (unsigned char)(strPlayerName.length() + 1);
reply << strPlayerName.c_str();
// team (skip)
reply << (unsigned char)1;
// skin (skip)
reply << (unsigned char)1;
// score
const std::string& strScore = pPlayer->GetAnnounceValue("score");
reply << (unsigned char)(strScore.length() + 1);
reply << strScore.c_str();
// ping
snprintf(szTemp, 255, "%u", pPlayer->GetPing());
reply << (unsigned char)(strlen(szTemp) + 1);
reply << szTemp;
// time (skip)
reply << (unsigned char)1;
}
}
m_pPlayerManager->IterateJoined([&](CPlayer* pPlayer) {
reply << ucFlags;
// nick
std::string strPlayerName = RemoveColorCodes(pPlayer->GetNick());
if (strPlayerName.length() == 0)
strPlayerName = pPlayer->GetNick();
reply << (unsigned char)(strPlayerName.length() + 1);
reply << strPlayerName.c_str();
// team (skip)
reply << (unsigned char)1;
// skin (skip)
reply << (unsigned char)1;
// score
const std::string& strScore = pPlayer->GetAnnounceValue("score");
reply << (unsigned char)(strScore.length() + 1);
reply << strScore.c_str();
// ping
snprintf(szTemp, 255, "%u", pPlayer->GetPing());
reply << (unsigned char)(strlen(szTemp) + 1);
reply << szTemp;
// time (skip)
reply << (unsigned char)1;
});

return reply.str();
}
Expand Down Expand Up @@ -463,26 +457,20 @@ std::string ASE::QueryLight()
int iBytesLeft = 1340 - (int)reply.tellp();
int iPlayersLeft = iJoinedPlayers;

list<CPlayer*>::const_iterator pIter = m_pPlayerManager->IterBegin();
for (; pIter != m_pPlayerManager->IterEnd(); pIter++)
{
pPlayer = *pIter;
if (pPlayer->IsJoined())
{
// nick
std::string strPlayerName = RemoveColorCodes(pPlayer->GetNick());
if (strPlayerName.length() == 0)
strPlayerName = pPlayer->GetNick();

// Check if we can fit more names
iBytesLeft -= strPlayerName.length() + 1;
if (iBytesLeft < iPlayersLeft--)
strPlayerName = "";

reply << (unsigned char)(strPlayerName.length() + 1);
reply << strPlayerName.c_str();
}
}
m_pPlayerManager->IterateJoined([&](CPlayer* pPlayer) {
// nick
std::string strPlayerName = RemoveColorCodes(pPlayer->GetNick());
if (strPlayerName.length() == 0)
strPlayerName = pPlayer->GetNick();

// Check if we can fit more names
iBytesLeft -= strPlayerName.length() + 1;
if (iBytesLeft < iPlayersLeft--)
strPlayerName = "";

reply << (unsigned char)(strPlayerName.length() + 1);
reply << strPlayerName.c_str();
});

return reply.str();
}
Expand Down
1 change: 0 additions & 1 deletion Server/mods/deathmatch/logic/CBanManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#pragma once

#include "CClient.h"
#include "CPlayerManager.h"

class CBanManager
{
Expand Down
27 changes: 9 additions & 18 deletions Server/mods/deathmatch/logic/CConsoleCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,29 +1175,20 @@ bool CConsoleCommands::WhoIs(CConsole* pConsole, const char* szArguments, CClien
// Any player requested?
if (strcmp(szArguments, "*") == 0)
{
// Iterate the players and echo their IPs and ports if anyone was requested
unsigned int uiCount = 0;
CPlayerManager* pPlayerManager = pConsole->GetPlayerManager();
CPlayer* pPlayer;
list<CPlayer*>::const_iterator iter = pPlayerManager->IterBegin();
for (; iter != pPlayerManager->IterEnd(); iter++)
if (pConsole->GetPlayerManager()->HasAnyConnected())
{
// Is he joined?
pPlayer = *iter;
if (pPlayer->IsJoined())
if (pConsole->GetPlayerManager()->HasAnyJoined())
{
// Echo him
pClient->SendEcho(SString("%s - %s:%u", pPlayer->GetNick(), pPlayer->GetSourceIP(), pPlayer->GetSourcePort()));

++uiCount;
// Iterate the players and echo their IPs and ports if anyone was requested
pConsole->GetPlayerManager()->IterateJoined([&](CPlayer* pPlayer) {
pClient->SendEcho(SString("%s - %s:%u", pPlayer->GetNick(), pPlayer->GetSourceIP(), pPlayer->GetSourcePort()));
});
}
else
pClient->SendEcho("whois: No players joined (there might be players connected, who aren't joined yet)");
}

// No players?
if (uiCount == 0)
{
else
pClient->SendEcho("whois: No players connected");
}
}
else
{
Expand Down
Loading