From 0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22 Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:03:24 +0100 Subject: split functions into basic and entity prettify --- src/WorldStorage/NamespaceSerializer.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/WorldStorage/NamespaceSerializer.cpp') diff --git a/src/WorldStorage/NamespaceSerializer.cpp b/src/WorldStorage/NamespaceSerializer.cpp index 910054ff7..fd02fec68 100644 --- a/src/WorldStorage/NamespaceSerializer.cpp +++ b/src/WorldStorage/NamespaceSerializer.cpp @@ -1,7 +1,6 @@ #include "Globals.h" #include "NamespaceSerializer.h" -#include @@ -552,17 +551,11 @@ eMonsterType NamespaceSerializer::ToMonsterType(const std::string_view a_ID) -AString NamespaceSerializer::Prettify(AString a_Name, const bool a_IsTamed) +AString NamespaceSerializer::Prettify(AString a_ID) { - // In older vanilla Minecraft version (before 1.14) ocelots and cats were the same mob. - // So after killing a tamed ocelot without a custom name the message will say "Cat was slain by [PlayerName]". - if ((a_Name == "ocelot") && a_IsTamed) - { - return "Cat"; - } bool NextLetterCapitalized = true; - std::for_each(a_Name.begin(), a_Name.end(), [&](char & a_Letter) + std::for_each(a_ID.begin(), a_ID.end(), [&](char & a_Letter) { if (NextLetterCapitalized) { @@ -575,5 +568,20 @@ AString NamespaceSerializer::Prettify(AString a_Name, const bool a_IsTamed) NextLetterCapitalized = true; } }); - return a_Name; + return a_ID; +} + + + + + +AString NamespaceSerializer::PrettifyEntityName(const AString & a_ID, const bool a_IsTamed) +{ + // In older vanilla Minecraft version (before 1.14) ocelots and cats were the same mob. + // So after killing a tamed ocelot without a custom name the message will say "Cat was slain by [PlayerName]". + if ((a_ID == "ocelot") && a_IsTamed) + { + return "Cat"; + } + return Prettify(a_ID); } -- cgit v1.2.3