Does some cleanup of unecessary code and cases of no string provided.

This commit is contained in:
Christopher Leggett 2022-07-17 13:31:38 -04:00
parent 4eaf70b859
commit f57a912ca1
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
3 changed files with 4 additions and 13 deletions

View File

@ -60,8 +60,6 @@ void CustomMessage::CreateGetItemMessage(GetItemID giid, ItemID iid, std::string
ReplaceColors(formattedMessage);
formattedMessage += MESSAGE_END();
this->getItemMessageTable[i].emplace(giid, formattedMessage);
} else {
this->getItemMessageTable[i].emplace(giid, MESSAGE_END());
}
}
}
@ -70,15 +68,7 @@ std::string CustomMessage::RetrieveGetItemMessage(GetItemID giid) {
std::unordered_map<GetItemID, std::string>::const_iterator result =
getItemMessageTable[gSaveContext.language].find(giid);
if (result == getItemMessageTable[gSaveContext.language].end()) {
switch (gSaveContext.language) {
case LANGUAGE_FRA:
return "Il n'y a pas de message personnalisé pour cet élément.";
case LANGUAGE_GER:
return "Für diesen Artikel gibt es keine benutzerdefinierte Nachricht.";
case LANGUAGE_ENG:
default:
return "There is no custom message for this item.";
}
return "";
}
return result->second;
}

View File

@ -1,8 +1,6 @@
#include "randomizer.h"
#include "soh/Enhancements/custom_message/CustomMessage.h"
using namespace std::literals::string_literals;
#define MESSAGES(eng, ger, fra) (new std::string[]{eng, ger, fra})
void Randomizer::CreateCustomMessages() {

View File

@ -1507,5 +1507,8 @@ extern "C" s32 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck
extern "C" int Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize) {
const std::string& getItemText = OTRGlobals::Instance->gRandomizer->GetCustomGetItemMessage(giid);
if (getItemText == "") {
return false;
}
return CopyStringToCharBuffer(getItemText, buffer, maxBufferSize);
}