Fix windows build

This commit is contained in:
Phillip Stephens 2018-05-01 17:41:51 -07:00
parent eae0dbd2bb
commit 0aac384e60
3 changed files with 27 additions and 10 deletions

View File

@ -127,7 +127,7 @@ CVar::CVar(std::string_view name, int value, std::string_view help, CVar::EFlags
std::string CVar::help() const std::string CVar::help() const
{ {
return std::string(m_help + (m_defaultValue != std::string() ? "\ndefault: " + m_defaultValue : "") + return std::string(m_help + (m_defaultValue != std::string() ? "\ndefault: " + m_defaultValue : "") +
(isReadOnly() ? "[ReadOnly]" : "")); (isReadOnly() ? " [ReadOnly]" : ""));
} }
atVec4f CVar::toVec4f(bool* isValid) const atVec4f CVar::toVec4f(bool* isValid) const

View File

@ -276,7 +276,7 @@ void CVarManager::parseCommandLine(const std::vector<SystemString>& args)
{ {
bool oldDeveloper = suppressDeveloper(); bool oldDeveloper = suppressDeveloper();
std::string developerName = com_developer->name().data(); std::string developerName = com_developer->name().data();
ToLower(developerName); athena::utility::tolower(developerName);
for (const SystemString& arg : args) for (const SystemString& arg : args)
{ {
if (arg[0] == _S('+')) if (arg[0] == _S('+'))
@ -291,7 +291,7 @@ void CVarManager::parseCommandLine(const std::vector<SystemString>& args)
if (CVar* cv = findCVar(cvarName)) if (CVar* cv = findCVar(cvarName))
{ {
cv->fromLiteralToType(cvarValue); cv->fromLiteralToType(cvarValue);
hecl::ToLower(cvarName); athena::utility::tolower(cvarName);
if (developerName == cvarName) if (developerName == cvarName)
/* Make sure we're not overriding developer mode when we restore */ /* Make sure we're not overriding developer mode when we restore */
oldDeveloper = com_developer->toBoolean(); oldDeveloper = com_developer->toBoolean();

View File

@ -124,7 +124,12 @@ void Console::report(Level level, const char* fmt, va_list list)
{ {
char tmp[2048]; char tmp[2048];
vsnprintf(tmp, 2048, fmt, list); vsnprintf(tmp, 2048, fmt, list);
m_log.emplace_back(std::string(tmp), level); std::vector<std::string> lines = athena::utility::split(tmp, '\n');
for (const std::string& line : lines)
{
std::string v = athena::utility::sprintf("%s", line.c_str());
m_log.emplace_back(v, level);
}
printf("%s\n", tmp); printf("%s\n", tmp);
} }
@ -372,16 +377,24 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
{ {
char tmp[2048]; char tmp[2048];
vsnprintf(tmp, 2048, format, ap); vsnprintf(tmp, 2048, format, ap);
std::string v = athena::utility::sprintf("[%s] %s", modName, tmp); std::vector<std::string> lines = athena::utility::split(tmp, '\n');
m_con->m_log.emplace_back(v, Console::Level(severity)); for (const std::string& line : lines)
{
std::string v = athena::utility::sprintf("[%s] %s", modName, line.c_str());
m_con->m_log.emplace_back(v, Console::Level(severity));
}
} }
void Console::LogVisorAdapter::report(const char* modName, logvisor::Level severity, const wchar_t* format, va_list ap) void Console::LogVisorAdapter::report(const char* modName, logvisor::Level severity, const wchar_t* format, va_list ap)
{ {
wchar_t tmp[2048]; wchar_t tmp[2048];
vswprintf(tmp, 2048, format, ap); vswprintf(tmp, 2048, format, ap);
std::string v = athena::utility::sprintf("[%s] %s", modName, athena::utility::wideToUtf8(tmp).c_str()); std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
m_con->m_log.emplace_back(v, Console::Level(severity)); for (const std::string& line : lines)
{
std::string v = athena::utility::sprintf("[%s] %s", modName, line.c_str());
m_con->m_log.emplace_back(v, Console::Level(severity));
}
} }
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file, unsigned linenum, const char* format, va_list ap) void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file, unsigned linenum, const char* format, va_list ap)
@ -396,8 +409,12 @@ void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level
{ {
wchar_t tmp[2048]; wchar_t tmp[2048];
vswprintf(tmp, 2048, format, ap); vswprintf(tmp, 2048, format, ap);
std::string v = athena::utility::sprintf("[%s] %s %s:%i", modName, athena::utility::wideToUtf8(tmp).c_str(), file, linenum); std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
m_con->m_log.emplace_back(v, Console::Level(severity)); for (const std::string& line : lines)
{
std::string v = athena::utility::sprintf("[%s] %s %s:%i", modName, line.c_str(), file, linenum);
m_con->m_log.emplace_back(v, Console::Level(severity));
}
} }
void Console::dumpLog() void Console::dumpLog()