Skip to content

Commit

Permalink
Revert "Add Random() debug logging for testing purposes"
Browse files Browse the repository at this point in the history
This reverts commit f9c2a68.
  • Loading branch information
Fulgen301 committed Aug 2, 2024
1 parent cd5d677 commit 24293c8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,6 @@ if (WIN32)
target_link_options(clonk PRIVATE "/alternatename:_WINRT_IMPL_GetSystemTimePreciseAsFileTime@4=_Clonk_GetSystemTimePreciseAsFileTime@4")
endif ()
endif ()

target_link_options(clonk PRIVATE "/PDBALTPATH:%_PDB%")
endif ()

if (APPLE)
Expand Down
29 changes: 0 additions & 29 deletions src/C4Random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,8 @@
#include <C4Include.h>
#include <C4Random.h>

#ifdef LOG_RANDOM

#include <ranges>
#include <stacktrace>

#endif

C4Random C4Random::Default{0};

#ifdef LOG_RANDOM

void C4Random::Log(const int range)
{
if (!logger)
{
logger = CreateLogger("C4Random::Default", {.GuiLogLevel = spdlog::level::off});
}

const std::stacktrace trace{std::stacktrace::current()};

const auto string = trace
| std::views::take(10)
| std::views::transform([](const auto &frame) { return std::to_string(frame); })
| std::views::join_with('\n')
| std::ranges::to<std::string>();

logger->debug("range: {}, randomCount: {}, randomHold: {}\n{}", range, randomCount, randomHold, string);
}

#endif

// Random3

const int FRndRes = 500;
Expand Down
24 changes: 0 additions & 24 deletions src/C4Random.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
#include <atomic>
#endif

#ifndef __APPLE__
#define LOG_RANDOM
#endif

#ifdef LOG_RANDOM
#include "C4Log.h"
#endif

#include <cstdint>
#include <cstdlib>
#include <ctime>
Expand All @@ -50,14 +42,6 @@ class C4Random
{
// next pseudorandom value
randomCount++;

#ifdef LOG_RANDOM
if (this == &Default)
{
Log(range);
}
#endif

#ifdef DEBUGREC
C4RCRandom rc;
rc.Cnt = randomCount;
Expand All @@ -83,10 +67,6 @@ class C4Random
std::uint32_t GetRandomCount() const noexcept { return randomCount; }
C4Random Clone() noexcept { return C4Random{randomHold}; }

#ifdef LOG_RANDOM
void Log(int range);
#endif

public:
static C4Random Default;

Expand All @@ -101,10 +81,6 @@ class C4Random
std::uint32_t id{NextId.fetch_add(1, std::memory_order_acq_rel)};
#endif

#ifdef LOG_RANDOM
std::shared_ptr<spdlog::logger> logger;
#endif

friend inline void FixedRandom(uint32_t);
};

Expand Down

0 comments on commit 24293c8

Please sign in to comment.