diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2022-01-16 11:03:24 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2022-04-12 01:06:40 +0200 |
commit | 0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22 (patch) | |
tree | 0941facbffc2f4143a0091255b9e2ad2ff5262cd /src/WorldStorage/NamespaceSerializer.cpp | |
parent | Removed an implicit cast from int to char. (diff) | |
download | cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar.gz cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar.bz2 cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar.lz cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar.xz cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.tar.zst cuberite-0c04c5aaedcae6a0fc91df3f1f83746ff5eafd22.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/NamespaceSerializer.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
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 <cctype> @@ -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); } |