chore(ui): implement SetNonSpaceWrap() for error messages

This commit is contained in:
VDm 2024-02-25 01:04:55 +04:00
parent 5b55f8cc20
commit c03ea57e21
7 changed files with 40 additions and 16 deletions

View File

@ -19,6 +19,7 @@
#include <bc/Debug.hpp>
#include <common/Prop.hpp>
#include <storm/Error.hpp>
#include <storm/Log.hpp>
#include <bc/os/Path.hpp>
CVar* Client::g_accountListVar;
@ -150,6 +151,7 @@ void SetPaths() {
datadir = buffer;
}
SLogSetDefaultDirectory(datadir);
SFile::SetBasePath(datadir);
SFile::SetDataPath("Data\\");
@ -368,7 +370,7 @@ void StormInitialize() {
// TODO
// SStrInitialize();
// SErrInitialize();
// SLogInitialize();
SLogInitialize();
// SFile::Initialize();
Blizzard::Debug::SetAssertHandler(BlizzardAssertCallback);

View File

@ -16,7 +16,7 @@
#include "ui/ScriptFunctions.hpp"
#include "console/CVar.hpp"
#include "util/Filesystem.hpp"
#include "util/Log.hpp"
#include "util/SysMessage.hpp"
#include <cstdio>
#include <common/MD5.hpp>
@ -523,7 +523,7 @@ void CGlueMgr::Resume() {
CWOWClientStatus status;
if (!SLogCreate("Logs\\GlueXML.log", 0, status.m_logFile)) {
if (!SLogCreate("Logs\\GlueXML.log", 0, &status.m_logFile)) {
SysMsgPrintf(SYSMSG_WARNING, "Cannot create WOWClient log file \"%s\"!", "Logs\\GlueXML.log");
}

View File

@ -748,6 +748,17 @@ void CSimpleFontString::SetJustifyH(uint8_t justify) {
void CSimpleFontString::SetNonSpaceWrap(int32_t a2) {
// TODO
// Proper implementation
uint32_t styleFlags = a2
? this->m_styleFlags | 0x1000
: this->m_styleFlags & ~0x1000;
if (this->m_styleFlags != styleFlags) {
this->m_styleFlags = styleFlags;
if (this->m_string) {
this->UpdateString();
}
}
}
void CSimpleFontString::SetSpacing(float spacing) {

View File

@ -4,8 +4,14 @@
CStatus CStatus::s_errorList;
void CStatus::Add(const CStatus& status) {
void CStatus::Add(const CStatus& source) {
// TODO
// Remove const_cast<> workaround
CStatus& src = const_cast<CStatus&>(source);
for (auto i = src.statusList.Head(); i; i = src.statusList.Next(i)) {
this->Add(i->severity, i->text);
}
}
void CStatus::Add(STATUS_TYPE severity, const char* format, ...) {

View File

@ -1,6 +1,9 @@
#ifndef UTIL_C_STATUS_HPP
#define UTIL_C_STATUS_HPP
#include <storm/List.hpp>
#include <storm/Log.hpp>
enum STATUS_TYPE {
STATUS_INFO = 0x0,
STATUS_WARNING = 0x1,
@ -10,6 +13,13 @@ enum STATUS_TYPE {
};
class CStatus {
public:
struct STATUSENTRY {
char* text;
STATUS_TYPE severity;
TSLink<CStatus::STATUSENTRY> link;
};
public:
// Static variables
static CStatus s_errorList;
@ -17,11 +27,14 @@ class CStatus {
// Member functions
void Add(const CStatus&);
void Add(STATUS_TYPE, const char*, ...);
public:
STORM_EXPLICIT_LIST(CStatus::STATUSENTRY, link) statusList;
};
class CWOWClientStatus : public CStatus {
public:
void* m_logFile = nullptr;
HSLOG m_logFile = nullptr;
};
CStatus& GetGlobalStatusObj(void);

View File

@ -1,10 +1,4 @@
#include "util/Log.hpp"
bool SLogCreate(const char* filename, uint32_t flags, void* log) {
// TODO
return true;
}
#include "util/SysMessage.hpp"
void SysMsgPrintf(SYSMSG_TYPE severity, const char* format, ...) {
// TODO

View File

@ -1,5 +1,5 @@
#ifndef UTIL_LOG_HPP
#define UTIL_LOG_HPP
#ifndef UTIL_SYSMESSAGE_HPP
#define UTIL_SYSMESSAGE_HPP
#include <cstdint>
@ -11,8 +11,6 @@ enum SYSMSG_TYPE {
SYSMSG_NUMTYPES = 0x4
};
bool SLogCreate(const char*, uint32_t, void*);
void SysMsgPrintf(SYSMSG_TYPE, const char*, ...);
#endif