summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-04-02 21:31:33 +0200
committerMichael Lutz <michi@icosahedron.de>2019-04-09 22:45:15 +0200
commite804173595d49a537503ea08bec4663117bae047 (patch)
treeaca1af9b44daefab8ded671615d87e08a3a96059 /src/console_cmds.cpp
parentc7b9987d081ae4e0103309b18c93deecc395dec9 (diff)
downloadopenttd-e804173595d49a537503ea08bec4663117bae047.tar.xz
Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector.
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 00b953694..7a7d4827d 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -553,7 +553,7 @@ DEF_CONSOLE_CMD(ConUnBan)
/* Try by IP. */
uint index;
for (index = 0; index < _network_ban_list.size(); index++) {
- if (strcmp(_network_ban_list[index], argv[1]) == 0) break;
+ if (_network_ban_list[index] == argv[1]) break;
}
/* Try by index. */
@@ -563,9 +563,8 @@ DEF_CONSOLE_CMD(ConUnBan)
if (index < _network_ban_list.size()) {
char msg[64];
- seprintf(msg, lastof(msg), "Unbanned %s", _network_ban_list[index]);
+ seprintf(msg, lastof(msg), "Unbanned %s", _network_ban_list[index].c_str());
IConsolePrint(CC_DEFAULT, msg);
- free(_network_ban_list[index]);
_network_ban_list.erase(_network_ban_list.begin() + index);
} else {
IConsolePrint(CC_DEFAULT, "Invalid list index or IP not in ban-list.");
@@ -585,8 +584,8 @@ DEF_CONSOLE_CMD(ConBanList)
IConsolePrint(CC_DEFAULT, "Banlist: ");
uint i = 1;
- for (char *entry : _network_ban_list) {
- IConsolePrintF(CC_DEFAULT, " %d) %s", i, entry);
+ for (const auto &entry : _network_ban_list) {
+ IConsolePrintF(CC_DEFAULT, " %d) %s", i, entry.c_str());
}
return true;