1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 09:44:52 +01:00

Use std::string_view where appropriate in network code

Co-authored-by: Ted John <ted@brambles.org>
This commit is contained in:
ζeh Matt
2021-09-17 23:46:58 +03:00
parent 77141f57b0
commit 2529568bfc
14 changed files with 77 additions and 83 deletions

View File

@@ -207,7 +207,7 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
}
}
void chat_history_add(const char* src)
void chat_history_add(std::string_view s)
{
// Format a timestamp
time_t timer{};
@@ -217,7 +217,7 @@ void chat_history_add(const char* src)
strcatftime(timeBuffer, sizeof(timeBuffer), "[%H:%M] ", tmInfo);
std::string buffer = timeBuffer;
buffer += src;
buffer += s;
// Add to history list
int32_t index = _chatHistoryIndex % CHAT_HISTORY_SIZE;
@@ -227,7 +227,7 @@ void chat_history_add(const char* src)
_chatHistoryIndex++;
// Log to file (src only as logging does its own timestamp)
network_append_chat_log(src);
network_append_chat_log(s);
Mixer_Play_Effect(OpenRCT2::Audio::SoundId::NewsItem, 0, MIXER_VOLUME_MAX, 0.5f, 1.5f, true);
}