Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang python3-pip
sudo apt-get install -y clang-16 python3-pip
ln -sf /usr/bin/clang-16 /usr/bin/clang && ln -sf /usr/bin/clang++-16 /usr/bin/clang++
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
clang --version
Expand Down
4 changes: 2 additions & 2 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class MMSPluginConfig(object):
'-fPIC',
]

cxx.cxxflags += ['-std=c++17']
cxx.cxxflags += ['-std=c++20']
if (cxx.version >= 'gcc-4.0') or cxx.family == 'clang':
cxx.cflags += ['-fvisibility=hidden']
cxx.cxxflags += ['-fvisibility-inlines-hidden']
Expand Down Expand Up @@ -184,7 +184,7 @@ class MMSPluginConfig(object):
cxx.cflags += [
'/W3',
'/Zi',
'/std:c++17',
'/std:c++20',
]
cxx.cxxflags += ['/TP']

Expand Down
9 changes: 5 additions & 4 deletions src/client_cvar_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "client_cvar_value.h"
#include "sdk/recipientfilters.h"
#include <networksystem/inetworkserializer.h>
#include <networksystem/inetworkmessages.h>
#include <inetchannel.h>
Expand Down Expand Up @@ -146,8 +147,8 @@ int ClientCvarValue::SendCvarValueQueryToClient(CPlayerSlot nSlot, const char* p
msg->set_cookie(iQueryCvarCookie);
msg->set_cvar_name(pszCvarName);

uint64 clients = { 1llu << nSlot.Get() };
g_pGameEventSystem->PostEventAbstract(-1, false, nSlot.Get() + 1, &clients, pMsg, msg, 0, BUF_RELIABLE);
CSingleRecipientFilter filter(nSlot);
g_pGameEventSystem->PostEventAbstract(0, false, &filter, pMsg, msg, 0);

delete msg;

Expand Down Expand Up @@ -210,7 +211,7 @@ const char* ClientCvarValue::GetLicense()

const char* ClientCvarValue::GetVersion()
{
return "1.0.8";
return "1.0.9";
}

const char* ClientCvarValue::GetDate()
Expand All @@ -225,7 +226,7 @@ const char* ClientCvarValue::GetLogTag()

const char* ClientCvarValue::GetAuthor()
{
return u8"Phoenix (˙·٠●Феникс●٠·˙)";
return "Phoenix (˙·٠●Феникс●٠·˙)";
}

const char* ClientCvarValue::GetDescription()
Expand Down
56 changes: 56 additions & 0 deletions src/sdk/recipientfilters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once
#include "irecipientfilter.h"
#include <bit>

class CRecipientFilter : public IRecipientFilter
{
public:
CRecipientFilter(NetChannelBufType_t nBufType = BUF_RELIABLE, bool bInitMessage = false) :
m_nBufType(nBufType), m_bInitMessage(bInitMessage) {}

CRecipientFilter(IRecipientFilter* source, CPlayerSlot exceptSlot = -1)
{
m_Recipients = source->GetRecipients();
m_nBufType = source->GetNetworkBufType();
m_bInitMessage = source->IsInitMessage();

if (exceptSlot != -1)
m_Recipients.Clear(exceptSlot.Get());
}

~CRecipientFilter() override {}

NetChannelBufType_t GetNetworkBufType(void) const override { return m_nBufType; }
bool IsInitMessage(void) const override { return m_bInitMessage; }
const CPlayerBitVec& GetRecipients(void) const override { return m_Recipients; }

void AddRecipient(CPlayerSlot slot)
{
if (slot.Get() >= 0 && slot.Get() < ABSOLUTE_PLAYER_LIMIT)
m_Recipients.Set(slot.Get());
}

int GetRecipientCount()
{
const uint64 bits = *reinterpret_cast<const uint64*>(&GetRecipients());

return std::popcount(bits);
}

protected:
NetChannelBufType_t m_nBufType;
bool m_bInitMessage;
CPlayerBitVec m_Recipients;
};

// Simple filter for when only 1 recipient is needed
class CSingleRecipientFilter : public CRecipientFilter
{
public:
CSingleRecipientFilter(CPlayerSlot nRecipientSlot, NetChannelBufType_t nBufType = BUF_RELIABLE, bool bInitMessage = false) :
CRecipientFilter(nBufType, bInitMessage)
{
if (nRecipientSlot.Get() >= 0 && nRecipientSlot.Get() < ABSOLUTE_PLAYER_LIMIT)
m_Recipients.Set(nRecipientSlot.Get());
}
};
Loading