forked from cafeberry/cafeberry
LCEMP commit: prepare code for dedicated server support
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <time.h>
|
||||
#include "..\..\Minecraft.World\net.minecraft.world.entity.item.h"
|
||||
#include "..\..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
@@ -236,6 +238,26 @@ void CMinecraftApp::DebugPrintf(const char *szFormat, ...)
|
||||
vsnprintf(buf, sizeof(buf), szFormat, ap);
|
||||
va_end(ap);
|
||||
OutputDebugStringA(buf);
|
||||
#ifdef _DEDICATED_SERVER
|
||||
bool hasContent = false;
|
||||
for (const char *p = buf; *p; p++) {
|
||||
if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' && *p != '=') {
|
||||
hasContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasContent)
|
||||
{
|
||||
size_t len = strlen(buf);
|
||||
while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r'))
|
||||
buf[--len] = '\0';
|
||||
|
||||
time_t now = time(NULL);
|
||||
struct tm t;
|
||||
localtime_s(&t, &now);
|
||||
printf("[%02d:%02d:%02d] [Server thread/INFO]: %s\n", t.tm_hour, t.tm_min, t.tm_sec, buf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -298,6 +320,9 @@ LPCWSTR CMinecraftApp::GetString(int iID)
|
||||
{
|
||||
//return L"Değişiklikler ve Yenilikler";
|
||||
//return L"ÕÕÕÕÖÖÖÖ";
|
||||
#ifdef _DEDICATED_SERVER
|
||||
if (!app.m_stringTable) return L"";
|
||||
#endif
|
||||
return app.m_stringTable->getString(iID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user