[StartupMessages] Adapt code to coding guidelines
This commit is contained in:
parent
a0b21f43a0
commit
ddd8cb8b6a
@ -2,9 +2,8 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::list<std::string> startupMessages;
|
||||
|
||||
int totalMessages = -1;
|
||||
int StartupMessages::TotalMessages = -1;
|
||||
std::list<std::string> StartupMessages::MessageList;
|
||||
|
||||
StartupMessages::StartupMessages()
|
||||
{
|
||||
@ -17,26 +16,26 @@ namespace Components
|
||||
|
||||
UIScript::Add("nextStartupMessage", [](UIScript::Token)
|
||||
{
|
||||
if (!startupMessages.size()) return;
|
||||
if (!StartupMessages::MessageList.size()) return;
|
||||
|
||||
if (totalMessages < 1)
|
||||
if (StartupMessages::TotalMessages < 1)
|
||||
{
|
||||
totalMessages = startupMessages.size();
|
||||
StartupMessages::TotalMessages = StartupMessages::MessageList.size();
|
||||
}
|
||||
|
||||
std::string message = startupMessages.front();
|
||||
startupMessages.pop_front();
|
||||
std::string message = StartupMessages::MessageList.front();
|
||||
StartupMessages::MessageList.pop_front();
|
||||
|
||||
Game::Dvar_SetStringByName("ui_startupMessage", message.data());
|
||||
Game::Dvar_SetStringByName("ui_startupMessageTitle", Utils::String::VA("Messages (%d/%d)", totalMessages - startupMessages.size(), totalMessages));
|
||||
Game::Dvar_SetStringByName("ui_startupNextButtonText", startupMessages.size() ? "Next" : "Close");
|
||||
Game::Dvar_SetStringByName("ui_startupMessageTitle", Utils::String::VA("Messages (%d/%d)", StartupMessages::TotalMessages - StartupMessages::MessageList.size(), StartupMessages::TotalMessages));
|
||||
Game::Dvar_SetStringByName("ui_startupNextButtonText", StartupMessages::MessageList.size() ? "Next" : "Close");
|
||||
Game::Cbuf_AddText(0, "openmenu startup_messages");
|
||||
});
|
||||
}
|
||||
|
||||
void StartupMessages::AddMessage(std::string message)
|
||||
{
|
||||
startupMessages.push_back(message);
|
||||
StartupMessages::MessageList.push_back(message);
|
||||
}
|
||||
|
||||
}
|
@ -12,5 +12,9 @@ namespace Components
|
||||
#endif
|
||||
|
||||
static void AddMessage(std::string message);
|
||||
|
||||
private:
|
||||
static int TotalMessages = -1;
|
||||
static std::list<std::string> MessageList;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user