From b151ad7c750f4bdc4e0b69240a98d854843615c6 Mon Sep 17 00:00:00 2001 From: Japa Illo Date: Tue, 7 Feb 2017 11:09:39 +0530 Subject: [PATCH] always make sure the name prefix has an underscore at the end of it. --- plugins/generated-creature-renamer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/generated-creature-renamer.cpp b/plugins/generated-creature-renamer.cpp index 9463773b2..df7b5c0d3 100644 --- a/plugins/generated-creature-renamer.cpp +++ b/plugins/generated-creature-renamer.cpp @@ -16,7 +16,7 @@ using namespace DFHack; DFHACK_PLUGIN("generated-creature-renamer"); REQUIRE_GLOBAL(world); -#define RENAMER_VERSION 2 +#define RENAMER_VERSION 3 command_result list_creatures(color_ostream &out, std::vector & parameters); @@ -147,6 +147,10 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan descriptor[j] = toupper(descriptor[j]); } + auto prefix = prefixes[prefixIndex]; + if (prefix[prefix.length() - 1] != '_') + prefix.append("_"); + creatureRaw->creature_id = prefixes[prefixIndex] + descriptor; if (descriptorCount[foundIndex] > 0)