mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 18:25:16 +01:00
Move StrCatFTime into Chat.cpp, its only user
This commit is contained in:
@@ -207,6 +207,21 @@ void ChatDraw(DrawPixelInfo& dpi, ColourWithFlags chatBackgroundColor)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* strftime wrapper which appends to an existing string.
|
||||
*/
|
||||
static size_t StrCatFTime(char* buffer, size_t bufferSize, const char* format, const struct tm* tp)
|
||||
{
|
||||
size_t stringLen = strnlen(buffer, bufferSize);
|
||||
if (stringLen < bufferSize)
|
||||
{
|
||||
char* dst = buffer + stringLen;
|
||||
size_t dstMaxSize = bufferSize - stringLen;
|
||||
return strftime(dst, dstMaxSize, format, tp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ChatAddHistory(std::string_view s)
|
||||
{
|
||||
// Format a timestamp
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <random>
|
||||
|
||||
/* Case insensitive logical compare */
|
||||
@@ -191,18 +190,3 @@ uint8_t SoftLight(uint8_t a, uint8_t b)
|
||||
}
|
||||
return static_cast<uint8_t>(std::clamp(fr, 0.0f, 1.0f) * 255.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* strftime wrapper which appends to an existing string.
|
||||
*/
|
||||
size_t StrCatFTime(char* buffer, size_t bufferSize, const char* format, const struct tm* tp)
|
||||
{
|
||||
size_t stringLen = strnlen(buffer, bufferSize);
|
||||
if (stringLen < bufferSize)
|
||||
{
|
||||
char* dst = buffer + stringLen;
|
||||
size_t dstMaxSize = bufferSize - stringLen;
|
||||
return strftime(dst, dstMaxSize, format, tp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "../core/Money.hpp"
|
||||
#include "../core/StringTypes.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
int32_t StrLogicalCmp(char const* a, char const* b);
|
||||
char* SafeStrCpy(char* destination, const char* source, size_t num);
|
||||
char* SafeStrCat(char* destination, const char* source, size_t size);
|
||||
@@ -48,8 +46,6 @@ uint8_t Lerp(uint8_t a, uint8_t b, float t);
|
||||
float FLerp(float a, float b, float t);
|
||||
uint8_t SoftLight(uint8_t a, uint8_t b);
|
||||
|
||||
size_t StrCatFTime(char* buffer, size_t bufferSize, const char* format, const struct tm* tp);
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr uint64_t EnumToFlag(T v)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user