mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
avoid a few pointless int copies in chat logging, properly use CC_BUILD_MINFILES instead of CC_BUILD_WEB in Game.c
This commit is contained in:
parent
eab80ddee0
commit
04266a7412
14
src/Chat.c
14
src/Chat.c
@ -60,12 +60,12 @@ static char logPathBuffer[FILENAME_SIZE];
|
||||
static String logPath = String_FromArray(logPathBuffer);
|
||||
|
||||
static struct Stream logStream;
|
||||
static struct DateTime lastLogDate;
|
||||
static int lastLogDay, lastLogMonth, lastLogYear;
|
||||
|
||||
/* Resets log name to empty and resets last log date */
|
||||
static void ResetLogFile(void) {
|
||||
logName.length = 0;
|
||||
lastLogDate.year = -1234;
|
||||
logName.length = 0;
|
||||
lastLogYear = -123;
|
||||
}
|
||||
|
||||
/* Closes handle to the chat log file */
|
||||
@ -101,8 +101,8 @@ void Chat_SetLogName(const String* name) {
|
||||
}
|
||||
|
||||
void Chat_DisableLogging(void) {
|
||||
Chat_Logging = false;
|
||||
lastLogDate.year = -5678;
|
||||
Chat_Logging = false;
|
||||
lastLogYear = -321;
|
||||
Chat_AddRaw("&cDisabling chat logging");
|
||||
CloseLogFile();
|
||||
}
|
||||
@ -146,12 +146,12 @@ static void AppendChatLog(const String* text) {
|
||||
if (!logName.length || !Chat_Logging) return;
|
||||
DateTime_CurrentLocal(&now);
|
||||
|
||||
if (now.day != lastLogDate.day || now.month != lastLogDate.month || now.year != lastLogDate.year) {
|
||||
if (now.day != lastLogDay || now.month != lastLogMonth || now.year != lastLogYear) {
|
||||
CloseLogFile();
|
||||
OpenChatLog(&now);
|
||||
}
|
||||
|
||||
lastLogDate = now;
|
||||
lastLogDay = now.day; lastLogMonth = now.month; lastLogYear = now.year;
|
||||
if (!logStream.Meta.File) return;
|
||||
|
||||
/* [HH:mm:ss] text */
|
||||
|
@ -342,7 +342,7 @@ static void LoadOptions(void) {
|
||||
}*/
|
||||
}
|
||||
|
||||
#if defined CC_BUILD_WEB
|
||||
#ifdef CC_BUILD_MINFILES
|
||||
static void LoadPlugins(void) { }
|
||||
#else
|
||||
static void LoadPlugin(const String* path, void* obj) {
|
||||
@ -541,7 +541,7 @@ static void PerformScheduledTasks(double time) {
|
||||
}
|
||||
|
||||
void Game_TakeScreenshot(void) {
|
||||
#ifndef CC_BUILD_WEB
|
||||
#ifndef CC_BUILD_MINFILES
|
||||
String filename; char fileBuffer[STRING_SIZE];
|
||||
String path; char pathBuffer[FILENAME_SIZE];
|
||||
struct DateTime now;
|
||||
|
Loading…
x
Reference in New Issue
Block a user