mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Fix three Windows-specific compile errors
- logger.cpp: use localtime_s on Windows (reversed arg order vs localtime_r) - process.hpp: drop constexpr on INVALID_PROCESS (INVALID_HANDLE_VALUE is a reinterpret_cast, not valid in constexpr context) - world_packets.hpp: push/pop ERROR macro around CharCreateResult enum to avoid clash with wingdi.h #define ERROR 0
This commit is contained in:
parent
aba701aeda
commit
f67a6f1692
3 changed files with 13 additions and 1 deletions
|
|
@ -176,6 +176,11 @@ public:
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
// WoW 3.3.5a ResponseCodes for character creation (from ResponseCodes enum)
|
// WoW 3.3.5a ResponseCodes for character creation (from ResponseCodes enum)
|
||||||
|
// Windows wingdi.h defines ERROR as 0; undefine it for this enum scope.
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma push_macro("ERROR")
|
||||||
|
#undef ERROR
|
||||||
|
#endif
|
||||||
enum class CharCreateResult : uint8_t {
|
enum class CharCreateResult : uint8_t {
|
||||||
// Success codes
|
// Success codes
|
||||||
SUCCESS = 0x2F, // CHAR_CREATE_SUCCESS
|
SUCCESS = 0x2F, // CHAR_CREATE_SUCCESS
|
||||||
|
|
@ -224,6 +229,9 @@ enum class CharCreateResult : uint8_t {
|
||||||
NAME_RUSSIAN_SILENT_AT_BEGIN_OR_END = 0x66, // CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END
|
NAME_RUSSIAN_SILENT_AT_BEGIN_OR_END = 0x66, // CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END
|
||||||
NAME_DECLENSION_DOESNT_MATCH = 0x67, // CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME
|
NAME_DECLENSION_DOESNT_MATCH = 0x67, // CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME
|
||||||
};
|
};
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma pop_macro("ERROR")
|
||||||
|
#endif
|
||||||
|
|
||||||
struct CharCreateData {
|
struct CharCreateData {
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
using ProcessHandle = HANDLE;
|
using ProcessHandle = HANDLE;
|
||||||
inline constexpr ProcessHandle INVALID_PROCESS = INVALID_HANDLE_VALUE;
|
inline const ProcessHandle INVALID_PROCESS = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,11 @@ void Logger::log(LogLevel level, const std::string& message) {
|
||||||
now.time_since_epoch()) % 1000;
|
now.time_since_epoch()) % 1000;
|
||||||
|
|
||||||
std::tm tm;
|
std::tm tm;
|
||||||
|
#ifdef _WIN32
|
||||||
|
localtime_s(&tm, &time);
|
||||||
|
#else
|
||||||
localtime_r(&time, &tm);
|
localtime_r(&time, &tm);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Format: [YYYY-MM-DD HH:MM:SS.mmm] [LEVEL] message
|
// Format: [YYYY-MM-DD HH:MM:SS.mmm] [LEVEL] message
|
||||||
std::ostringstream line;
|
std::ostringstream line;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue