From a0113e88ebc79054aab0de4f1432a4b9883f37e8 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 7 Apr 2019 18:08:00 +1000 Subject: [PATCH] fix dev build oops --- src/Chat.c | 21 ++++++++++++++++----- src/Game.c | 4 +++- src/SelectionBox.c | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Chat.c b/src/Chat.c index 7c78d2ada..25651003f 100644 --- a/src/Chat.c +++ b/src/Chat.c @@ -48,6 +48,13 @@ static void Chat_AppendLogTime(void) { Chat_LogTimes[Chat_LogTimesCount++] = now; } +#ifdef CC_BUILD_WEB +static void Chat_ResetLog(void) { } +static void Chat_CloseLog(void) { } +void Chat_SetLogName(const String* name) { } +static void Chat_OpenLog(struct DateTime* now) { } +static void Chat_AppendLog(const String* text) { } +#else static char Chat_LogNameBuffer[STRING_SIZE]; static String Chat_LogName = String_FromArray(Chat_LogNameBuffer); static char Chat_LogPathBuffer[FILENAME_SIZE]; @@ -56,6 +63,13 @@ static String Chat_LogPath = String_FromArray(Chat_LogPathBuffer); static struct Stream Chat_LogStream; static struct DateTime ChatLog_LastLogDate; +static void Chat_ResetLog(void) { + Chat_LogName.length = 0; + ChatLog_LastLogDate.Day = 0; + ChatLog_LastLogDate.Month = 0; + ChatLog_LastLogDate.Year = 0; +} + static void Chat_CloseLog(void) { ReturnCode res; if (!Chat_LogStream.Meta.File) return; @@ -153,6 +167,7 @@ static void Chat_AppendLog(const String* text) { Chat_DisableLogging(); Logger_Warn2(res, "writing to", &Chat_LogPath); } +#endif void Chat_Add1(const char* format, const void* a1) { Chat_Add4(format, a1, NULL, NULL, NULL); @@ -574,11 +589,7 @@ static void Chat_Init(void) { static void Chat_Reset(void) { Chat_CloseLog(); - Chat_LogName.length = 0; - - ChatLog_LastLogDate.Day = 0; - ChatLog_LastLogDate.Month = 0; - ChatLog_LastLogDate.Year = 0; + Chat_ResetLog(); /* reset CPE messages */ Chat_AddOf(&String_Empty, MSG_TYPE_ANNOUNCEMENT); diff --git a/src/Game.c b/src/Game.c index 523d90ec1..82d12e720 100644 --- a/src/Game.c +++ b/src/Game.c @@ -598,6 +598,7 @@ static void Game_DoScheduledTasks(double time) { } void Game_TakeScreenshot(void) { +#ifndef CC_BUILD_WEB String filename; char fileBuffer[STRING_SIZE]; String path; char pathBuffer[FILENAME_SIZE]; struct DateTime now; @@ -617,7 +618,7 @@ void Game_TakeScreenshot(void) { res = Stream_CreateFile(&stream, &path); if (res) { Logger_Warn2(res, "creating", &path); return; } - res = Gfx_TakeScreenshot(&stream, Game.Width, Game.Height); + res = Gfx_TakeScreenshot(&stream); if (res) { Logger_Warn2(res, "saving to", &path); stream.Close(&stream); return; } @@ -626,6 +627,7 @@ void Game_TakeScreenshot(void) { if (res) { Logger_Warn2(res, "closing", &path); return; } Chat_Add1("&eTaken screenshot as: %s", &filename); +#endif } static void Game_RenderFrame(double delta) { diff --git a/src/SelectionBox.c b/src/SelectionBox.c index 2439e489d..d7f1223a3 100644 --- a/src/SelectionBox.c +++ b/src/SelectionBox.c @@ -18,12 +18,12 @@ struct SelectionBox { #define SelectionBox_X(x) x,0,0, x,1,0, x,1,1, x,0,1, static void SelectionBox_Render(struct SelectionBox* box, VertexP3fC4b** faceVertices, VertexP3fC4b** edgeVertices) { - static uint8_t faceIndices[72] = { + const static uint8_t faceIndices[72] = { SelectionBox_Y(0) SelectionBox_Y(1) /* YMin, YMax */ SelectionBox_Z(0) SelectionBox_Z(1) /* ZMin, ZMax */ SelectionBox_X(0) SelectionBox_X(1) /* XMin, XMax */ }; - static uint8_t edgeIndices[72] = { + const static uint8_t edgeIndices[72] = { 0,0,0, 1,0,0, 1,0,0, 1,0,1, 1,0,1, 0,0,1, 0,0,1, 0,0,0, /* YMin */ 0,1,0, 1,1,0, 1,1,0, 1,1,1, 1,1,1, 0,1,1, 0,1,1, 0,1,0, /* YMax */ 0,0,0, 0,1,0, 1,0,0, 1,1,0, 1,0,1, 1,1,1, 0,0,1, 0,1,1, /* X/Z */