From aa7b0a92d065b4435467d482ec65dd97b03459ee Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <clyne@bitgloo.com>
Date: Mon, 2 Sep 2019 18:53:21 -0400
Subject: made json names readable

---
 src/components/Light.hpp    | 8 ++++++--
 src/components/Name.hpp     | 8 ++++++--
 src/components/Player.hpp   | 4 ++++
 src/components/Position.hpp | 8 ++++++--
 src/components/Render.hpp   | 8 ++++++--
 src/components/Script.hpp   | 4 ++++
 src/components/Velocity.hpp | 8 ++++++--
 7 files changed, 38 insertions(+), 10 deletions(-)

(limited to 'src/components')

diff --git a/src/components/Light.hpp b/src/components/Light.hpp
index 2cb0e1b..6849d7c 100644
--- a/src/components/Light.hpp
+++ b/src/components/Light.hpp
@@ -51,11 +51,15 @@ public:
     }
 
     void serialize(cereal::JSONOutputArchive& ar) final {
-        ar(r, g, b, strength);
+        ar(CEREAL_NVP(r), CEREAL_NVP(g), CEREAL_NVP(b), CEREAL_NVP(strength));
     }
 
     void serialize(cereal::JSONInputArchive& ar) final {
-        ar(r, g, b, strength);
+        ar(CEREAL_NVP(r), CEREAL_NVP(g), CEREAL_NVP(b), CEREAL_NVP(strength));
+    }
+
+    std::string serializeName(void) const final {
+        return "Light";
     }
 };
 
diff --git a/src/components/Name.hpp b/src/components/Name.hpp
index b42ef46..a6a6d8a 100644
--- a/src/components/Name.hpp
+++ b/src/components/Name.hpp
@@ -40,11 +40,15 @@ public:
     }
 
     void serialize(cereal::JSONOutputArchive& ar) final {
-        ar(name);
+        ar(CEREAL_NVP(name));
     }
 
     void serialize(cereal::JSONInputArchive& ar) final {
-        ar(name);
+        ar(CEREAL_NVP(name));
+    }
+
+    std::string serializeName(void) const final {
+        return "Name";
     }
 };
 
diff --git a/src/components/Player.hpp b/src/components/Player.hpp
index 95b2a96..33db1eb 100644
--- a/src/components/Player.hpp
+++ b/src/components/Player.hpp
@@ -35,6 +35,10 @@ public:
 
     void serialize([[maybe_unused]] cereal::JSONOutputArchive& ar) final {}
     void serialize([[maybe_unused]] cereal::JSONInputArchive& ar) final {}
+
+    std::string serializeName(void) const final {
+        return "Player";
+    }
 };
 
 #endif // COMPONENT_PLAYER_HPP_
diff --git a/src/components/Position.hpp b/src/components/Position.hpp
index 6157265..56e8707 100644
--- a/src/components/Position.hpp
+++ b/src/components/Position.hpp
@@ -44,11 +44,15 @@ public:
     }
 
     void serialize(cereal::JSONOutputArchive& ar) final {
-        ar(x, y);
+        ar(CEREAL_NVP(x), CEREAL_NVP(y));
     }
 
     void serialize(cereal::JSONInputArchive& ar) final {
-        ar(x, y);
+        ar(CEREAL_NVP(x), CEREAL_NVP(y));
+    }
+
+    std::string serializeName(void) const final {
+        return "Position";
     }
 };
 
diff --git a/src/components/Render.hpp b/src/components/Render.hpp
index 49a9588..81ca591 100644
--- a/src/components/Render.hpp
+++ b/src/components/Render.hpp
@@ -55,11 +55,15 @@ public:
     }
 
     void serialize(cereal::JSONOutputArchive& ar) final {
-        ar(visible, flipX);
+        ar(CEREAL_NVP(visible), CEREAL_NVP(flipX));
     }
 
     void serialize(cereal::JSONInputArchive& ar) final {
-        ar(visible, flipX);
+        ar(CEREAL_NVP(visible), CEREAL_NVP(flipX));
+    }
+
+    std::string serializeName(void) const final {
+        return "Render";
     }
 };
 
diff --git a/src/components/Script.hpp b/src/components/Script.hpp
index 178c933..f792750 100644
--- a/src/components/Script.hpp
+++ b/src/components/Script.hpp
@@ -63,6 +63,10 @@ public:
 
     void serialize([[maybe_unused]] cereal::JSONOutputArchive& ar) final {}
     void serialize([[maybe_unused]] cereal::JSONInputArchive& ar) final {}
+
+    std::string serializeName(void) const final {
+        return "Scripted";
+    }
 };
 
 #endif // COMPONENT_SCRIPT_HPP_
diff --git a/src/components/Velocity.hpp b/src/components/Velocity.hpp
index 7a75706..776c1dd 100644
--- a/src/components/Velocity.hpp
+++ b/src/components/Velocity.hpp
@@ -45,11 +45,15 @@ public:
     }
 
     void serialize(cereal::JSONOutputArchive& ar) final {
-        ar(x, y);
+        ar(CEREAL_NVP(x), CEREAL_NVP(y));
     }
 
     void serialize(cereal::JSONInputArchive& ar) final {
-        ar(x, y);
+        ar(CEREAL_NVP(x), CEREAL_NVP(y));
+    }
+
+    std::string serializeName(void) const final {
+        return "Velocity";
     }
 };
 
-- 
cgit v1.2.3