rename Assert to beammp_assert

This commit is contained in:
Lion Kortlepel 2021-09-16 01:04:38 +02:00
parent dd4e4c4467
commit f5b2be0a03
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B
3 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ inline void _assert([[maybe_unused]] const char* file, [[maybe_unused]] const ch
} }
} }
#define Assert(cond) _assert(__FILE__, __func__, __LINE__, #cond, (cond)) #define beammp_assert(cond) _assert(__FILE__, __func__, __LINE__, #cond, (cond))
#define AssertNotReachable() _assert(__FILE__, __func__, __LINE__, "reached unreachable code", false) #define AssertNotReachable() _assert(__FILE__, __func__, __LINE__, "reached unreachable code", false)
#else #else
// In release build, these macros turn into NOPs. The compiler will optimize these out. // In release build, these macros turn into NOPs. The compiler will optimize these out.

View File

@ -39,6 +39,6 @@ void TLuaEngine::CollectPlugins() {
} }
void TLuaEngine::InitializePlugin(const fs::path& folder) { void TLuaEngine::InitializePlugin(const fs::path& folder) {
Assert(fs::exists(folder)); beammp_assert(fs::exists(folder));
Assert(fs::is_directory(folder)); beammp_assert(fs::is_directory(folder));
} }

View File

@ -542,7 +542,7 @@ void TNetwork::UpdatePlayer(TClient& Client) {
} }
void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr, bool kicked) { void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr, bool kicked) {
Assert(!ClientPtr.expired()); beammp_assert(!ClientPtr.expired());
auto LockedClientPtr = ClientPtr.lock(); auto LockedClientPtr = ClientPtr.lock();
TClient& c = *LockedClientPtr; TClient& c = *LockedClientPtr;
beammp_info(c.GetName() + (" Connection Terminated")); beammp_info(c.GetName() + (" Connection Terminated"));
@ -591,7 +591,7 @@ int TNetwork::OpenID() {
} }
void TNetwork::OnConnect(const std::weak_ptr<TClient>& c) { void TNetwork::OnConnect(const std::weak_ptr<TClient>& c) {
Assert(!c.expired()); beammp_assert(!c.expired());
beammp_info("Client connected"); beammp_info("Client connected");
auto LockedClient = c.lock(); auto LockedClient = c.lock();
LockedClient->SetID(OpenID()); LockedClient->SetID(OpenID());
@ -843,7 +843,7 @@ bool TNetwork::SyncClient(const std::weak_ptr<TClient>& c) {
void TNetwork::SendToAll(TClient* c, const std::string& Data, bool Self, bool Rel) { void TNetwork::SendToAll(TClient* c, const std::string& Data, bool Self, bool Rel) {
if (!Self) if (!Self)
Assert(c); beammp_assert(c);
char C = Data.at(0); char C = Data.at(0);
bool ret = true; bool ret = true;
mServer.ForEachClient([&](std::weak_ptr<TClient> ClientPtr) -> bool { mServer.ForEachClient([&](std::weak_ptr<TClient> ClientPtr) -> bool {