Index: source/network/NetMessage.cpp =================================================================== --- source/network/NetMessage.cpp +++ source/network/NetMessage.cpp @@ -21,6 +21,7 @@ #include "ps/CLogger.h" #include "ps/Game.h" +#include "ps/Util.h" #include "simulation2/Simulation2.h" #undef ALLNETMSGS_DONT_CREATE_NMTS @@ -216,7 +217,8 @@ break; default: - LOGERROR("CNetMessageFactory::CreateMessage(): Unknown message type '%d' received", header.GetType()); + LOGERROR("CNetMessageFactory::CreateMessage(): Unknown message type '%d' received", + ToUnderlying(header.GetType())); break; } Index: source/ps/Util.h =================================================================== --- source/ps/Util.h +++ source/ps/Util.h @@ -23,6 +23,8 @@ #include "lib/status.h" #include "ps/CStr.h" +#include + class Tex; void WriteSystemInfo(); @@ -38,4 +40,10 @@ std::string Hexify(const std::string& s); std::string Hexify(const u8* s, size_t length); +template +std::underlying_type_t ToUnderlying(Enum e) +{ + return static_cast>(e); +} + #endif // PS_UTIL_H Index: source/simulation2/serialization/BinarySerializer.cpp =================================================================== --- source/simulation2/serialization/BinarySerializer.cpp +++ source/simulation2/serialization/BinarySerializer.cpp @@ -22,6 +22,7 @@ #include "lib/alignment.h" #include "lib/utf8.h" #include "ps/CLogger.h" +#include "ps/Util.h" #include "scriptinterface/FunctionWrapper.h" #include "scriptinterface/ScriptExtraHeaders.h" #include "scriptinterface/ScriptRequest.h" @@ -52,7 +53,7 @@ case js::Scalar::Uint8Clamped: return SCRIPT_TYPED_ARRAY_UINT8_CLAMPED; default: - LOGERROR("Cannot serialize unrecognized typed array view: %d", arrayType); + LOGERROR("Cannot serialize unrecognized typed array view: %d", ToUnderlying(arrayType)); throw PSERROR_Serialize_InvalidScriptValue(); } }