Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarChatProcessor.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
commit332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch)
treefd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/game/StarChatProcessor.cpp
parent14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff)
The Formatting String Catastrophe
Diffstat (limited to 'source/game/StarChatProcessor.cpp')
-rw-r--r--source/game/StarChatProcessor.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/game/StarChatProcessor.cpp b/source/game/StarChatProcessor.cpp
index c298e13..2082529 100644
--- a/source/game/StarChatProcessor.cpp
+++ b/source/game/StarChatProcessor.cpp
@@ -8,7 +8,7 @@ String ChatProcessor::connectClient(ConnectionId clientId, String nick) {
RecursiveMutexLocker locker(m_mutex);
if (nick.empty())
- nick = strf("Player_%s", clientId);
+ nick = strf("Player_{}", clientId);
nick = makeNickUnique(nick);
@@ -17,7 +17,7 @@ String ChatProcessor::connectClient(ConnectionId clientId, String nick) {
{MessageContext::Broadcast},
ServerConnectionId,
ServerNick,
- strf("Player '%s' connected", nick)
+ strf("Player '{}' connected", nick)
});
}
@@ -41,7 +41,7 @@ List<ChatReceivedMessage> ChatProcessor::disconnectClient(ConnectionId clientId)
{MessageContext::Broadcast},
ServerConnectionId,
ServerNick,
- strf("Player '%s' disconnected", clientInfo.nick)
+ strf("Player '{}' disconnected", clientInfo.nick)
});
}
@@ -229,17 +229,17 @@ bool ChatProcessor::handleCommand(ChatReceivedMessage& message) {
if (command == "nick") {
auto newNick = renick(message.fromConnection, commandLine.trim());
- response = strf("Nick changed to %s", newNick);
+ response = strf("Nick changed to {}", newNick);
} else if (command == "w") {
String target = commandLine.extract();
if (m_nicks.contains(target))
whisper(message.fromConnection, m_nicks.get(target), commandLine.trim());
else
- response = strf("No such nick %s", target);
+ response = strf("No such nick {}", target);
} else if (m_commandHandler) {
response = m_commandHandler(message.fromConnection, command, commandLine);
} else {
- response = strf("No such command %s", command);
+ response = strf("No such command {}", command);
}
if (!response.empty()) {