Skip to content

Commit

Permalink
Does some cleanup of unecessary code and cases of no string provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
leggettc18 committed Jul 17, 2022
1 parent 4eaf70b commit f57a912
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
12 changes: 1 addition & 11 deletions soh/soh/Enhancements/custom_message/CustomMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
3 changes: 3 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit f57a912

Please sign in to comment.