Skip to content
Permalink
Browse files

fix dev build oops

  • Loading branch information...
UnknownShadow200 committed Apr 7, 2019
1 parent 003b0b5 commit a0113e88ebc79054aab0de4f1432a4b9883f37e8
Showing with 21 additions and 8 deletions.
  1. +16 −5 src/Chat.c
  2. +3 −1 src/Game.c
  3. +2 −2 src/SelectionBox.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);
@@ -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) {
@@ -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 */

0 comments on commit a0113e8

Please sign in to comment.
You can’t perform that action at this time.