From e959fb033445cf7783e676747152bea0a1528354 Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Sun, 12 Jul 2015 20:51:25 -0400 Subject: [PATCH] Added WriteChar func to JsonWriterFile --- demboyz/base/jsonfile.cpp | 9 +++++++++ demboyz/base/jsonfile.h | 1 + demboyz/netmessages/svc_serverinfo.cpp | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/demboyz/base/jsonfile.cpp b/demboyz/base/jsonfile.cpp index 455d783..afb6711 100644 --- a/demboyz/base/jsonfile.cpp +++ b/demboyz/base/jsonfile.cpp @@ -84,6 +84,15 @@ namespace base writer.Bool(value); } + void JsonWriterFile::WriteChar(const char* name, char value) + { + auto& writer = m_writer; + writer.String(name); + + char temp[2] = { value, '\0' }; + writer.String(temp); + } + void JsonWriterFile::WriteInt32(const char* name, std::int32_t value) { auto& writer = m_writer; diff --git a/demboyz/base/jsonfile.h b/demboyz/base/jsonfile.h index c258dd0..684dab0 100644 --- a/demboyz/base/jsonfile.h +++ b/demboyz/base/jsonfile.h @@ -28,6 +28,7 @@ namespace base void WriteNull(const char* name); void WriteBool(const char* name, bool value); + void WriteChar(const char* name, char value); void WriteInt32(const char* name, std::int32_t value); void WriteInt32(const char* name, std::int32_t value, bool writeCondition); void WriteInt64(const char* name, std::int64_t value); diff --git a/demboyz/netmessages/svc_serverinfo.cpp b/demboyz/netmessages/svc_serverinfo.cpp index 38ce54f..2b5c4ba 100644 --- a/demboyz/netmessages/svc_serverinfo.cpp +++ b/demboyz/netmessages/svc_serverinfo.cpp @@ -92,7 +92,7 @@ namespace NetHandlers jsonbuf.WriteUInt32("playerSlot", data->playerSlot); jsonbuf.WriteUInt32("maxClients", data->maxClients); jsonbuf.WriteFloat("tickInterval", data->tickInterval); - jsonbuf.WriteString("os", &data->os, 1); + jsonbuf.WriteChar("os", data->os); jsonbuf.WriteString("gameDir", data->gameDir); jsonbuf.WriteString("mapName", data->mapName); jsonbuf.WriteString("skyName", data->skyName);