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:
UnknownShadow200 2020-05-27 00:18:25 +10:00
parent eab80ddee0
commit 04266a7412
2 changed files with 9 additions and 9 deletions

View File

@ -60,12 +60,12 @@ static char logPathBuffer[FILENAME_SIZE];
static String logPath = String_FromArray(logPathBuffer); static String logPath = String_FromArray(logPathBuffer);
static struct Stream logStream; static struct Stream logStream;
static struct DateTime lastLogDate; static int lastLogDay, lastLogMonth, lastLogYear;
/* Resets log name to empty and resets last log date */ /* Resets log name to empty and resets last log date */
static void ResetLogFile(void) { static void ResetLogFile(void) {
logName.length = 0; logName.length = 0;
lastLogDate.year = -1234; lastLogYear = -123;
} }
/* Closes handle to the chat log file */ /* Closes handle to the chat log file */
@ -102,7 +102,7 @@ void Chat_SetLogName(const String* name) {
void Chat_DisableLogging(void) { void Chat_DisableLogging(void) {
Chat_Logging = false; Chat_Logging = false;
lastLogDate.year = -5678; lastLogYear = -321;
Chat_AddRaw("&cDisabling chat logging"); Chat_AddRaw("&cDisabling chat logging");
CloseLogFile(); CloseLogFile();
} }
@ -146,12 +146,12 @@ static void AppendChatLog(const String* text) {
if (!logName.length || !Chat_Logging) return; if (!logName.length || !Chat_Logging) return;
DateTime_CurrentLocal(&now); 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(); CloseLogFile();
OpenChatLog(&now); OpenChatLog(&now);
} }
lastLogDate = now; lastLogDay = now.day; lastLogMonth = now.month; lastLogYear = now.year;
if (!logStream.Meta.File) return; if (!logStream.Meta.File) return;
/* [HH:mm:ss] text */ /* [HH:mm:ss] text */

View File

@ -342,7 +342,7 @@ static void LoadOptions(void) {
}*/ }*/
} }
#if defined CC_BUILD_WEB #ifdef CC_BUILD_MINFILES
static void LoadPlugins(void) { } static void LoadPlugins(void) { }
#else #else
static void LoadPlugin(const String* path, void* obj) { static void LoadPlugin(const String* path, void* obj) {
@ -541,7 +541,7 @@ static void PerformScheduledTasks(double time) {
} }
void Game_TakeScreenshot(void) { void Game_TakeScreenshot(void) {
#ifndef CC_BUILD_WEB #ifndef CC_BUILD_MINFILES
String filename; char fileBuffer[STRING_SIZE]; String filename; char fileBuffer[STRING_SIZE];
String path; char pathBuffer[FILENAME_SIZE]; String path; char pathBuffer[FILENAME_SIZE];
struct DateTime now; struct DateTime now;