Skip to content

Commit

Permalink
Naming and doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aestek committed Jul 16, 2016
1 parent 5edccba commit a9a7df5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
3 changes: 1 addition & 2 deletions Source/Core/Core/NetPlayClient.cpp
Expand Up @@ -457,8 +457,7 @@ void NetPlayClient::DisplayPlayersPing() {

u32 NetPlayClient::GetPlayersMaxPing() const {
return std::max_element(m_players.begin(), m_players.end(),
[](const std::pair<PlayerId, Player> &a,
const std::pair<PlayerId, Player> &b) {
[](const auto &a, const auto &b) {
return a.second.ping < b.second.ping;
})->second.ping;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DolphinWX/NetPlay/NetWindow.cpp
Expand Up @@ -688,20 +688,20 @@ void NetPlayDialog::AddChatMessage(ChatMessageType type, const std::string& msg)
switch (type)
{
case ChatMessageType::Info:
colour = wxColour(0, 150, 150);
colour = wxColour(0, 150, 150); // cyan
break;

case ChatMessageType::Error:
colour = *wxRED;
break;

case ChatMessageType::UserIn:
colour = wxColour(0, 150, 0);
colour = wxColour(0, 150, 0); // green
printed_msg = "" + msg;
break;

case ChatMessageType::UserOut:
colour = wxColour(50, 50, 50);
colour = wxColour(100, 100, 100); // grey
printed_msg = "" + msg;
break;
}
Expand Down
26 changes: 13 additions & 13 deletions Source/Core/VideoCommon/OnScreenDisplay.cpp
Expand Up @@ -18,20 +18,20 @@
namespace OSD
{
static std::multimap<CallbackType, Callback> s_callbacks;
static std::multimap<MessageType, Message> s_msg_list;
static std::mutex s_msg_list_mutex;
static std::multimap<MessageType, Message> s_messages;
static std::mutex s_messages_mutex;

void AddTypedMessage(MessageType type, const std::string& message, u32 ms, u32 rgba)
{
std::lock_guard<std::mutex> lock(s_msg_list_mutex);
s_msg_list.erase(type);
s_msg_list.emplace(type, Message(message, Common::Timer::GetTimeMs() + ms, rgba));
std::lock_guard<std::mutex> lock(s_messages_mutex);
s_messages.erase(type);
s_messages.emplace(type, Message(message, Common::Timer::GetTimeMs() + ms, rgba));
}

void AddMessage(const std::string& message, u32 ms, u32 rgba)
{
std::lock_guard<std::mutex> lock(s_msg_list_mutex);
s_msg_list.emplace(MessageType::Typeless,
std::lock_guard<std::mutex> lock(s_messages_mutex);
s_messages.emplace(MessageType::Typeless,
Message(message, Common::Timer::GetTimeMs() + ms, rgba));
}

Expand All @@ -49,20 +49,20 @@ void DrawMessages()
return;

{
std::lock_guard<std::mutex> lock(s_msg_list_mutex);
std::lock_guard<std::mutex> lock(s_messages_mutex);

u32 now = Common::Timer::GetTimeMs();
int left = 20, top = 35;

auto it = s_msg_list.begin();
while (it != s_msg_list.end())
auto it = s_messages.begin();
while (it != s_messages.end())
{
const Message& msg = it->second;
int time_left = (int)(msg.m_timestamp - now);
DrawMessage(msg, top, left, time_left);

if (time_left <= 0)
it = s_msg_list.erase(it);
it = s_messages.erase(it);
else
++it;
top += 15;
Expand All @@ -72,8 +72,8 @@ void DrawMessages()

void ClearMessages()
{
std::lock_guard<std::mutex> lock(s_msg_list_mutex);
s_msg_list.clear();
std::lock_guard<std::mutex> lock(s_messages_mutex);
s_messages.clear();
}

// On-Screen Display Callbacks
Expand Down

0 comments on commit a9a7df5

Please sign in to comment.