diff --git a/components/openmw-mp/Master/PacketMasterAnnounce.cpp b/components/openmw-mp/Master/PacketMasterAnnounce.cpp index 629d55756..5c6049eee 100644 --- a/components/openmw-mp/Master/PacketMasterAnnounce.cpp +++ b/components/openmw-mp/Master/PacketMasterAnnounce.cpp @@ -5,7 +5,6 @@ using namespace mwmp; using namespace RakNet; -using namespace std; PacketMasterAnnounce::PacketMasterAnnounce(RakNet::RakPeerInterface *peer) : BasePacket(peer) { diff --git a/components/openmw-mp/Master/PacketMasterQuery.cpp b/components/openmw-mp/Master/PacketMasterQuery.cpp index d882e6ef5..b81d3f305 100644 --- a/components/openmw-mp/Master/PacketMasterQuery.cpp +++ b/components/openmw-mp/Master/PacketMasterQuery.cpp @@ -6,7 +6,6 @@ using namespace mwmp; -using namespace std; using namespace RakNet; PacketMasterQuery::PacketMasterQuery(RakNet::RakPeerInterface *peer) : BasePacket(peer) @@ -26,12 +25,12 @@ void PacketMasterQuery::Packet(RakNet::BitStream *newBitstream, bool send) RW(serversCount, send); - map::iterator serverIt; + std::map::iterator serverIt; if (send) serverIt = servers->begin(); QueryData server; - string addr; + std::string addr; uint16_t port; while (serversCount--) { @@ -55,12 +54,12 @@ void PacketMasterQuery::Packet(RakNet::BitStream *newBitstream, bool send) if (send) serverIt++; else - servers->insert(pair(SystemAddress(addr.c_str(), port), server)); + servers->insert(std::pair(SystemAddress(addr.c_str(), port), server)); } } -void PacketMasterQuery::SetServers(map *serverMap) +void PacketMasterQuery::SetServers(std::map *serverMap) { servers = serverMap; } diff --git a/components/openmw-mp/Master/PacketMasterUpdate.cpp b/components/openmw-mp/Master/PacketMasterUpdate.cpp index ba3eaf5df..16016b460 100644 --- a/components/openmw-mp/Master/PacketMasterUpdate.cpp +++ b/components/openmw-mp/Master/PacketMasterUpdate.cpp @@ -3,7 +3,6 @@ #include "ProxyMasterPacket.hpp" using namespace mwmp; -using namespace std; using namespace RakNet; PacketMasterUpdate::PacketMasterUpdate(RakNet::RakPeerInterface *peer) : BasePacket(peer) @@ -19,7 +18,7 @@ void PacketMasterUpdate::Packet(RakNet::BitStream *newBitstream, bool send) if (send) bs->Write(packetID); - string addr = server->first.ToString(false); + std::string addr = server->first.ToString(false); uint16_t port = server->first.GetPort(); RW(addr, send); diff --git a/components/openmw-mp/Master/ProxyMasterPacket.hpp b/components/openmw-mp/Master/ProxyMasterPacket.hpp index 2b0fca1dc..14a0733f5 100644 --- a/components/openmw-mp/Master/ProxyMasterPacket.hpp +++ b/components/openmw-mp/Master/ProxyMasterPacket.hpp @@ -22,22 +22,20 @@ namespace mwmp template static void addServer(Packet *packet, QueryData &server, bool send) { - using namespace std; - int32_t rulesSize = server.rules.size(); packet->RW(rulesSize, send); if (rulesSize > QueryData::maxRules) rulesSize = 0; - map::iterator ruleIt; + std::map::iterator ruleIt; if (send) ruleIt = server.rules.begin(); while (rulesSize--) { ServerRule *rule = nullptr; - string key; + std::string key; if (send) { key = ruleIt->first; @@ -47,7 +45,7 @@ namespace mwmp packet->RW(key, send, false, QueryData::maxStringLength); if (!send) { - ruleIt = server.rules.insert(pair(key, ServerRule())).first; + ruleIt = server.rules.insert(std::pair(key, ServerRule())).first; rule = &ruleIt->second; } @@ -62,7 +60,7 @@ namespace mwmp ruleIt++; } - vector::iterator plIt; + std::vector::iterator plIt; int32_t playersCount = server.players.size(); packet->RW(playersCount, send); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerBook.cpp b/components/openmw-mp/Packets/Player/PacketPlayerBook.cpp index 58146af92..c1e425c91 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerBook.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerBook.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerBook.hpp" -using namespace std; using namespace mwmp; PacketPlayerBook::PacketPlayerBook(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp b/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp index 79a8b0b80..2e321b6cb 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerFaction.hpp" -using namespace std; using namespace mwmp; PacketPlayerFaction::PacketPlayerFaction(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp b/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp index 4eb568456..324950037 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerInventory.hpp" -using namespace std; using namespace mwmp; PacketPlayerInventory::PacketPlayerInventory(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp b/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp index 0f60736df..4948bb750 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerJournal.hpp" -using namespace std; using namespace mwmp; PacketPlayerJournal::PacketPlayerJournal(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp b/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp index 093124cb0..7df91dc62 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp @@ -1,7 +1,6 @@ #include "PacketPlayerPosition.hpp" #include -using namespace std; using namespace mwmp; PacketPlayerPosition::PacketPlayerPosition(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerQuickKeys.cpp b/components/openmw-mp/Packets/Player/PacketPlayerQuickKeys.cpp index 3818d7e23..e2b18a261 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerQuickKeys.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerQuickKeys.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerQuickKeys.hpp" -using namespace std; using namespace mwmp; PacketPlayerQuickKeys::PacketPlayerQuickKeys(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp index f8ca8c6d8..9d93107f2 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerSpellbook.hpp" -using namespace std; using namespace mwmp; PacketPlayerSpellbook::PacketPlayerSpellbook(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp b/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp index a00706bbc..16ed4ba43 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp @@ -1,7 +1,6 @@ #include #include "PacketPlayerTopic.hpp" -using namespace std; using namespace mwmp; PacketPlayerTopic::PacketPlayerTopic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) diff --git a/components/openmw-mp/Packets/Worldstate/PacketWorldMap.cpp b/components/openmw-mp/Packets/Worldstate/PacketWorldMap.cpp index 885829ecb..51e2f47d1 100644 --- a/components/openmw-mp/Packets/Worldstate/PacketWorldMap.cpp +++ b/components/openmw-mp/Packets/Worldstate/PacketWorldMap.cpp @@ -2,7 +2,6 @@ #include #include "PacketWorldMap.hpp" -using namespace std; using namespace mwmp; PacketWorldMap::PacketWorldMap(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer) diff --git a/components/openmw-mp/TimedLog.cpp b/components/openmw-mp/TimedLog.cpp index 345a72436..bd7f50aa5 100644 --- a/components/openmw-mp/TimedLog.cpp +++ b/components/openmw-mp/TimedLog.cpp @@ -8,8 +8,6 @@ #include #include "TimedLog.hpp" -using namespace std; - TimedLog *TimedLog::sTimedLog = nullptr; TimedLog::TimedLog(int logLevel) : logLevel(logLevel) @@ -99,15 +97,15 @@ void TimedLog::print(int level, bool hasPrefix, const char *file, int line, cons sstr << '\n'; va_list args; va_start(args, message); - vector buf((unsigned long) (vsnprintf(nullptr, 0, sstr.str().c_str(), args) + 1)); + std::vector buf((unsigned long) (vsnprintf(nullptr, 0, sstr.str().c_str(), args) + 1)); va_end(args); va_start(args, message); vsnprintf(buf.data(), buf.size(), sstr.str().c_str(), args); va_end(args); - cout << buf.data() << flush; + std::cout << buf.data() << std::flush; } -string TimedLog::getFilenameTimestamp() +std::string TimedLog::getFilenameTimestamp() { time_t rawtime = time(0); struct tm *timeinfo = localtime(&rawtime); diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index 45eb889fa..b7ccc9951 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -11,8 +11,6 @@ #include #include -using namespace std; - #ifdef _WIN32 int setenv(const char *name, const char *value, int overwrite) { @@ -117,15 +115,15 @@ std::string Utils::toString(int num) return stream.str(); } -std::string Utils::replaceString(const string& source, const char* find, const char* replace) +std::string Utils::replaceString(const std::string& source, const char* find, const char* replace) { unsigned int find_len = strlen(find); unsigned int replace_len = strlen(replace); size_t pos = 0; - string dest = source; + std::string dest = source; - while ((pos = dest.find(find, pos)) != string::npos) + while ((pos = dest.find(find, pos)) != std::string::npos) { dest.replace(pos, find_len, replace); pos += replace_len; @@ -134,7 +132,7 @@ std::string Utils::replaceString(const string& source, const char* find, const c return dest; } -string& Utils::removeExtension(string& file) +std::string& Utils::removeExtension(std::string& file) { size_t pos = file.find_last_of('.'); @@ -211,23 +209,23 @@ std::string Utils::getVersionInfo(std::string appName, std::string version, std: { std::stringstream stream; - stream << appName << " " << version << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << endl; - stream << "Protocol version: " << protocol << endl; - stream << "Oldest compatible commit hash: " << commitHash.substr(0, 10) << endl; - stream << "------------------------------------------------------------" << endl; + stream << appName << " " << version << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << std::endl; + stream << "Protocol version: " << protocol << std::endl; + stream << "Oldest compatible commit hash: " << commitHash.substr(0, 10) << std::endl; + stream << "------------------------------------------------------------" << std::endl; return stream.str(); } -void Utils::printWithWidth(ostringstream &sstr, string str, size_t width) +void Utils::printWithWidth(std::ostringstream &sstr, std::string str, size_t width) { - sstr << left << setw(width) << setfill(' ') << str; + sstr << std::left << std::setw(width) << std::setfill(' ') << str; } -string Utils::intToHexStr(unsigned val) +std::string Utils::intToHexStr(unsigned val) { - ostringstream sstr; - sstr << "0x" << setfill('0') << setw(8) << uppercase << hex << val; + std::ostringstream sstr; + sstr << "0x" << std::setfill('0') << std::setw(8) << std::uppercase << std::hex << val; return sstr.str(); }