Add prototype to header and some comments

This commit is contained in:
maron2000 2025-04-26 09:01:14 +09:00
parent bf6e0af798
commit a45168c7e5
2 changed files with 6 additions and 6 deletions

View File

@ -189,8 +189,9 @@ extern bool sse2_available;
extern bool avx2_available;
#endif
void MSG_Add(const char*,const char*); //add messages to the internal languagefile
const char* MSG_Get(char const *); //get messages from the internal languagefile
void MSG_Add(const char*,const char*); // Add messages to the internal languagefile
const char* MSG_Get(char const *); // Get messages from the internal languagefile
std::string formatString(const char* format, ...); // Generates a formatted string using a format specifier and variable arguments.
void DOSBOX_RunMachine();
void DOSBOX_SetLoop(LoopHandler * handler);

View File

@ -66,13 +66,12 @@ struct MessageBlock {
MessageBlock(const char* _name, const char* _val) : name(_name), val(_val) {}
};
// List to maintain insertion order
std::list<MessageBlock> LangList;
std::list<MessageBlock> LangList; // list of translation messages, order maintained in inserted order
// Map for fast lookup
std::unordered_map<std::string, std::list<MessageBlock>::iterator> LangMap;
void MSG_Add(const char* _name, const char* _val) {
void MSG_Add(const char* _name, const char* _val) { //add messages to the translation message list
// If the message already exists, ignore it
if(LangMap.find(_name) != LangMap.end()) return;
@ -97,7 +96,7 @@ void MSG_Replace(const char* _name, const char* _val) {
}
}
const char* MSG_Get(const char* msg) {
const char* MSG_Get(const char* msg) { // add messages to the translation message list
auto it = LangMap.find(msg);
if(it != LangMap.end())