Renames some variables for clarity

This commit is contained in:
Christopher Leggett 2022-07-26 19:07:54 -04:00
parent 59dc52f394
commit 0ed8c277e8
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79

View File

@ -71,43 +71,43 @@ void CustomMessageManager::FormatCustomMessage(std::string& message) {
} }
bool CustomMessageManager::InsertCustomMessage(std::string tableID, uint16_t textID, CustomMessageEntry messages) { bool CustomMessageManager::InsertCustomMessage(std::string tableID, uint16_t textID, CustomMessageEntry messages) {
auto result = messageTables.find(tableID); auto foundMessageTable = messageTables.find(tableID);
if (result == messageTables.end()) { if (foundMessageTable == messageTables.end()) {
return false; return false;
} }
auto& messageTable = result->second; auto& messageTable = foundMessageTable->second;
auto success = messageTable.emplace(textID, messages); auto messageInsertResult = messageTable.emplace(textID, messages);
return success.second; return messageInsertResult.second;
} }
bool CustomMessageManager::CreateGetItemMessage(std::string tableID, GetItemID giid, ItemID iid, CustomMessageEntry messages) { bool CustomMessageManager::CreateGetItemMessage(std::string tableID, GetItemID giid, ItemID iid, CustomMessageEntry messageEntry) {
FormatCustomMessage(messages.english, iid); FormatCustomMessage(messageEntry.english, iid);
FormatCustomMessage(messages.german, iid); FormatCustomMessage(messageEntry.german, iid);
FormatCustomMessage(messages.french, iid); FormatCustomMessage(messageEntry.french, iid);
const uint16_t textID = giid; const uint16_t textID = giid;
return InsertCustomMessage(tableID, textID, messages); return InsertCustomMessage(tableID, textID, messageEntry);
} }
bool CustomMessageManager::CreateMessage(std::string tableID, uint16_t textID, CustomMessageEntry messages) { bool CustomMessageManager::CreateMessage(std::string tableID, uint16_t textID, CustomMessageEntry messageEntry) {
FormatCustomMessage(messages.english); FormatCustomMessage(messageEntry.english);
FormatCustomMessage(messages.german); FormatCustomMessage(messageEntry.german);
FormatCustomMessage(messages.french); FormatCustomMessage(messageEntry.french);
return InsertCustomMessage(tableID, textID, messages); return InsertCustomMessage(tableID, textID, messageEntry);
} }
CustomMessageEntry CustomMessageManager::RetrieveMessage(std::string tableID, uint16_t textID) { CustomMessageEntry CustomMessageManager::RetrieveMessage(std::string tableID, uint16_t textID) {
std::unordered_map<std::string, CustomMessageTable>::const_iterator result = messageTables.find(tableID); std::unordered_map<std::string, CustomMessageTable>::const_iterator foundMessageTable = messageTables.find(tableID);
if (result == messageTables.end()) { if (foundMessageTable == messageTables.end()) {
return NULL_CUSTOM_MESSAGE; return NULL_CUSTOM_MESSAGE;
} }
CustomMessageTable messageTable = result->second; CustomMessageTable messageTable = foundMessageTable->second;
std::unordered_map<uint16_t, CustomMessageEntry>::const_iterator message_pair = messageTable.find(textID); std::unordered_map<uint16_t, CustomMessageEntry>::const_iterator foundMessage = messageTable.find(textID);
if (message_pair == messageTable.end()) { if (foundMessage == messageTable.end()) {
return NULL_CUSTOM_MESSAGE; return NULL_CUSTOM_MESSAGE;
} }
CustomMessageEntry message = message_pair->second; CustomMessageEntry message = foundMessage->second;
return message; return message;
} }