diff --git a/libgag/src/TrueTypeFont.cpp b/libgag/src/TrueTypeFont.cpp index 799f6138..6cd995e5 100644 --- a/libgag/src/TrueTypeFont.cpp +++ b/libgag/src/TrueTypeFont.cpp @@ -28,7 +28,6 @@ #include #endif -using namespace std; #define MAX_CACHE_SIZE 128 namespace GAGCore diff --git a/libusl/src/code.cpp b/libusl/src/code.cpp index 9144e910..b4f66df3 100644 --- a/libusl/src/code.cpp +++ b/libusl/src/code.cpp @@ -8,7 +8,8 @@ #include -using namespace std; +using std::ostringstream; +using std::string; ThunkPrototype* thisMember(Prototype* outer) { diff --git a/libusl/src/debug.cpp b/libusl/src/debug.cpp index 48479974..39cd4d57 100644 --- a/libusl/src/debug.cpp +++ b/libusl/src/debug.cpp @@ -3,7 +3,7 @@ #include "code.h" #include "native.h" -using namespace std; +using std::string; const Position& ThunkDebugInfo::find(size_t address) const { diff --git a/libusl/src/interpreter.cpp b/libusl/src/interpreter.cpp index 4c02e5e9..65c06735 100644 --- a/libusl/src/interpreter.cpp +++ b/libusl/src/interpreter.cpp @@ -6,7 +6,7 @@ #include -using namespace std; +using std::for_each; bool Thread::step() { @@ -81,16 +81,12 @@ size_t Thread::run() void Thread::markForGC() { - using namespace std; - // mark all frames in stack for_each(frames.begin(), frames.end(), [](auto& frame) {frame.markForGC(); }); } void Thread::Frame::markForGC() { - using namespace std; - // mark all variables in frame for_each(stack.begin(), stack.end(), [](auto& value) {value->markForGC(); }); thunk->markForGC(); diff --git a/libusl/src/lexer.cpp b/libusl/src/lexer.cpp index 19842751..3d79b429 100644 --- a/libusl/src/lexer.cpp +++ b/libusl/src/lexer.cpp @@ -4,7 +4,9 @@ #include #include -using namespace std; +using std::ostringstream; +using std::string; +using std::endl; const Token::Type Lexer::tokenTypes[] = { diff --git a/libusl/src/memory.cpp b/libusl/src/memory.cpp index a9ff53d2..46fdb5c5 100644 --- a/libusl/src/memory.cpp +++ b/libusl/src/memory.cpp @@ -2,7 +2,8 @@ #include "interpreter.h" #include "types.h" -using namespace std; +using std::for_each; +using std::mem_fun; void Heap::collectGarbage() { diff --git a/libusl/src/parser.cpp b/libusl/src/parser.cpp index 43272488..e11667b8 100644 --- a/libusl/src/parser.cpp +++ b/libusl/src/parser.cpp @@ -3,7 +3,8 @@ #include "error.h" #include -using namespace std; +using std::string; +using std::unique_ptr; void Parser::parse(BlockNode* block) { diff --git a/libusl/src/tree.cpp b/libusl/src/tree.cpp index 84e52ce5..aeed470a 100644 --- a/libusl/src/tree.cpp +++ b/libusl/src/tree.cpp @@ -5,7 +5,9 @@ #include "types.h" #include -using namespace std; +using std::stringstream; +using std::ostringstream; +using std::endl; void Node::generate(ThunkPrototype* thunk, DebugInfo* debug, Code* code) diff --git a/libusl/src/types.cpp b/libusl/src/types.cpp index 339dedf5..1d5f66b0 100644 --- a/libusl/src/types.cpp +++ b/libusl/src/types.cpp @@ -9,7 +9,6 @@ #include #include -using namespace std; void Value::dump(std::ostream &stream) const { diff --git a/libusl/src/types.h b/libusl/src/types.h index f61e8ee5..1e0bb393 100644 --- a/libusl/src/types.h +++ b/libusl/src/types.h @@ -65,13 +65,15 @@ struct Prototype: Value virtual void dumpSpecific(std::ostream& stream) const { stream << ": "; - using namespace std; + using std::transform; + using std::ostream_iterator; + using std::string; transform(members.begin(), members.end(), ostream_iterator(stream, " "), [](auto& member) {return member.first; }); } virtual void propagateMarkForGC() { - using namespace std; + using std::for_each; for_each(members.begin(), members.end(), [this](auto& member) {dynamic_cast(member.second)->markForGC(); }); } @@ -157,7 +159,8 @@ struct Scope: Thunk virtual void propagateMarkForGC() { - using namespace std; + using std::for_each; + using std::mem_fun; for_each(locals.begin(), locals.end(), mem_fun(&Value::markForGC)); } diff --git a/libusl/src/usl.cpp b/libusl/src/usl.cpp index 893c60e1..e0f2ab25 100644 --- a/libusl/src/usl.cpp +++ b/libusl/src/usl.cpp @@ -8,7 +8,12 @@ #include #include -using namespace std; +using std::ostream; +using std::ifstream; +using std::string; +using std::unique_ptr; +using std::cout; +using std::endl; void dumpCode(ThunkPrototype* thunk, ThunkDebugInfo* debug, ostream& stream) { diff --git a/src/AI.cpp b/src/AI.cpp index c1722afa..52042bcd 100644 --- a/src/AI.cpp +++ b/src/AI.cpp @@ -35,7 +35,7 @@ #include "AINicowar.h" #include "AIEcho.h" -using namespace boost; +using boost::shared_ptr; /*AI::AI(Player *player) { diff --git a/src/AICastor.cpp b/src/AICastor.cpp index 2f154d14..a075c878 100644 --- a/src/AICastor.cpp +++ b/src/AICastor.cpp @@ -34,7 +34,7 @@ #define AI_FILE_MIN_VERSION 1 #define AI_FILE_VERSION 2 -using namespace boost; +using boost::shared_ptr; // AICastor::Project part: diff --git a/src/AIEcho.cpp b/src/AIEcho.cpp index 2d98efbe..c9d5df57 100644 --- a/src/AIEcho.cpp +++ b/src/AIEcho.cpp @@ -40,7 +40,7 @@ using namespace AIEcho::Management; using namespace AIEcho::Conditions; using namespace AIEcho::SearchTools; using namespace boost::logic; -using namespace boost; +using boost::shared_ptr; diff --git a/src/AINumbi.cpp b/src/AINumbi.cpp index d42a1472..a14bf2c4 100644 --- a/src/AINumbi.cpp +++ b/src/AINumbi.cpp @@ -27,7 +27,7 @@ #include "Utilities.h" #include "Unit.h" -using namespace boost; +using boost::shared_ptr; AINumbi::AINumbi(Player *player) { diff --git a/src/AIToubib.cpp b/src/AIToubib.cpp index c4f62ead..8835b0d3 100644 --- a/src/AIToubib.cpp +++ b/src/AIToubib.cpp @@ -25,7 +25,7 @@ #include "Order.h" #include "Player.h" -using namespace boost; +using boost::shared_ptr; AIToubib::AIToubib(Player *player) { diff --git a/src/AIWarrush.cpp b/src/AIWarrush.cpp index 2a14ba55..2445f589 100644 --- a/src/AIWarrush.cpp +++ b/src/AIWarrush.cpp @@ -34,7 +34,7 @@ #define BUILDING_DELAY 30 #define AREAS_DELAY 50 -using namespace boost; +using boost::shared_ptr; void AIWarrush::init(Player *player) { diff --git a/src/Engine.cpp b/src/Engine.cpp index 6b964d68..ed183537 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -44,7 +44,6 @@ #include -using namespace boost; Engine::Engine() { diff --git a/src/Engine.h b/src/Engine.h index a9efc1db..ed17e1ca 100644 --- a/src/Engine.h +++ b/src/Engine.h @@ -36,6 +36,8 @@ class MultiplayersJoin; class NetGame; +using boost::shared_ptr; + /// Engine is the backend of the game. It is responsible for loading and setting up games and players, /// and its run function is meant to run the game that has been loaded. class Engine diff --git a/src/FertilityCalculatorDialog.cpp b/src/FertilityCalculatorDialog.cpp index da38f9e0..085e4c15 100644 --- a/src/FertilityCalculatorDialog.cpp +++ b/src/FertilityCalculatorDialog.cpp @@ -29,7 +29,7 @@ using namespace GAGCore; using namespace GAGGUI; -using namespace boost; +using boost::static_pointer_cast; FertilityCalculatorDialog::FertilityCalculatorDialog(GraphicContext *parentCtx, Map& map) : OverlayScreen(parentCtx, 200, 100), map(map), parentCtx(parentCtx), thread(map, incoming, incomingMutex) diff --git a/src/GameGUI.cpp b/src/GameGUI.cpp index 9534c800..7909a2e5 100644 --- a/src/GameGUI.cpp +++ b/src/GameGUI.cpp @@ -128,7 +128,8 @@ #define REPLAY_BAR_FAST_FORWARD_BUTTON_SPRITE 55 #define REPLAY_BAR_FAST_FORWARD_BUTTON_ACTIVE_SPRITE 54 -using namespace boost; +using boost::shared_ptr; +using boost::static_pointer_cast; enum GameGUIGfxId { diff --git a/src/Glob2.cpp b/src/Glob2.cpp index 0aeb6446..3d982214 100644 --- a/src/Glob2.cpp +++ b/src/Glob2.cpp @@ -70,6 +70,8 @@ # include #endif +using boost::shared_ptr; + /*! \mainpage Globulation 2 Reference documentation \section intro Introduction diff --git a/src/IRCTextMessageHandler.cpp b/src/IRCTextMessageHandler.cpp index 10ec5c38..66884135 100644 --- a/src/IRCTextMessageHandler.cpp +++ b/src/IRCTextMessageHandler.cpp @@ -26,7 +26,7 @@ #include "YOGConsts.h" using namespace GAGCore; -using namespace boost; +using boost::static_pointer_cast; IRCTextMessageHandler::IRCTextMessageHandler() : irc(incoming, incomingMutex) diff --git a/src/IRCThread.cpp b/src/IRCThread.cpp index ff2ecd2f..93615406 100644 --- a/src/IRCThread.cpp +++ b/src/IRCThread.cpp @@ -20,7 +20,7 @@ #include "IRCThreadMessage.h" #include -using namespace boost; +using boost::static_pointer_cast; IRCThread::IRCThread(std::queue >& outgoing, boost::recursive_mutex& outgoingMutex) : outgoing(outgoing), outgoingMutex(outgoingMutex) diff --git a/src/LANFindScreen.cpp b/src/LANFindScreen.cpp index 1bcd7fae..ad0150d3 100644 --- a/src/LANFindScreen.cpp +++ b/src/LANFindScreen.cpp @@ -34,6 +34,7 @@ #include "YOGClientGameListManager.h" using namespace GAGGUI; +using boost::shared_ptr; LANFindScreen::LANFindScreen() { diff --git a/src/LANMenuScreen.cpp b/src/LANMenuScreen.cpp index bb48f12f..598e4935 100644 --- a/src/LANMenuScreen.cpp +++ b/src/LANMenuScreen.cpp @@ -33,6 +33,8 @@ #include #include "YOGServer.h" +using boost::shared_ptr; + LANMenuScreen::LANMenuScreen() { addWidget(new TextButton(0, 70, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[host]"), HOST)); diff --git a/src/MapScriptUSL.cpp b/src/MapScriptUSL.cpp index e6755c38..404385c7 100644 --- a/src/MapScriptUSL.cpp +++ b/src/MapScriptUSL.cpp @@ -33,7 +33,12 @@ using namespace GAGCore; #include #include -using namespace std; +using std::string; +using std::unique_ptr; +using std::ifstream; +using std::istringstream; +using std::cerr; +using std::endl; template<> diff --git a/src/MultiplayerGame.cpp b/src/MultiplayerGame.cpp index f8126c9a..484cad90 100644 --- a/src/MultiplayerGame.cpp +++ b/src/MultiplayerGame.cpp @@ -26,6 +26,9 @@ #include "NetMessage.h" #include "YOGClientGameListManager.h" +using boost::shared_ptr; +using boost::static_pointer_cast; + MultiplayerGame::MultiplayerGame(boost::shared_ptr client) : client(client), creationState(YOGCreateRefusalUnknown), joinState(YOGJoinRefusalUnknown), playerManager(gameHeader) { diff --git a/src/MultiplayerGameScreen.cpp b/src/MultiplayerGameScreen.cpp index c554072e..abc55e6f 100644 --- a/src/MultiplayerGameScreen.cpp +++ b/src/MultiplayerGameScreen.cpp @@ -40,6 +40,8 @@ #include "YOGMessage.h" #include "CustomGameOtherOptions.h" +using boost::static_pointer_cast; + MultiplayerGameScreen::MultiplayerGameScreen(TabScreen* parent, boost::shared_ptr game, boost::shared_ptr client, boost::shared_ptr ircChat) : TabScreenWindow(parent, Toolkit::getStringTable()->getString("[Game]")), game(game), gameChat(new YOGClientChatChannel(static_cast(-1), client)), ircChat(ircChat) { diff --git a/src/NetConnection.cpp b/src/NetConnection.cpp index 8dbc55f0..6ef15d0a 100644 --- a/src/NetConnection.cpp +++ b/src/NetConnection.cpp @@ -24,6 +24,8 @@ #include "NetMessage.h" using namespace GAGCore; +using boost::static_pointer_cast; +using boost::shared_ptr; diff --git a/src/NetConnection.h b/src/NetConnection.h index 60c1f1fa..8c51fb3e 100644 --- a/src/NetConnection.h +++ b/src/NetConnection.h @@ -24,7 +24,7 @@ #include #include -using namespace boost; +using boost::shared_ptr; class NetListener; class NetMessage; diff --git a/src/NetConnectionThread.cpp b/src/NetConnectionThread.cpp index 1df4901d..c5b203bd 100644 --- a/src/NetConnectionThread.cpp +++ b/src/NetConnectionThread.cpp @@ -23,6 +23,7 @@ #include "boost/lexical_cast.hpp" using namespace GAGCore; +using boost::static_pointer_cast; NetConnectionThread::NetConnectionThread(std::queue >& outgoing, boost::recursive_mutex& outgoingMutex) : outgoing(outgoing), outgoingMutex(outgoingMutex) diff --git a/src/NetListener.h b/src/NetListener.h index 67d5ed84..f54d03b7 100644 --- a/src/NetListener.h +++ b/src/NetListener.h @@ -22,7 +22,6 @@ #include "SDL_net.h" #include "NetConnection.h" -using namespace boost; ///NetListener represents a low level wrapper arround SDL. ///It listens for incoming connections. One should frequently diff --git a/src/NetMessage.h b/src/NetMessage.h index b8629e39..5855601a 100644 --- a/src/NetMessage.h +++ b/src/NetMessage.h @@ -37,7 +37,7 @@ #include "YOGAfterJoinGameInformation.h" -using namespace boost; +using boost::shared_ptr; ///This is the enum of message types enum NetMessageType diff --git a/src/NetTestSuite.cpp b/src/NetTestSuite.cpp index fa88372e..155d6267 100644 --- a/src/NetTestSuite.cpp +++ b/src/NetTestSuite.cpp @@ -25,6 +25,7 @@ using namespace GAGCore; +using boost::shared_ptr; NetTestSuite::NetTestSuite() { diff --git a/src/NetTestSuite.h b/src/NetTestSuite.h index aef94207..dab080b3 100644 --- a/src/NetTestSuite.h +++ b/src/NetTestSuite.h @@ -26,8 +26,6 @@ #include "YOGMessage.h" #include -using namespace boost; - ///This is a basic test system for the low level net classes, ///NetConnection, NetListener, NetMessage, YOGGameInfo and YOGMessage ///When run, it is assumed that the host allows the program to listen on diff --git a/src/SGSL.cpp b/src/SGSL.cpp index 2bc8f295..62ddec13 100644 --- a/src/SGSL.cpp +++ b/src/SGSL.cpp @@ -41,6 +41,9 @@ #include "Unit.h" #include "Utilities.h" +using std::string; +using std::cerr; +using std::endl; SGSLToken::TokenSymbolLookupTable SGSLToken::table[] = { @@ -1090,7 +1093,6 @@ void Story::syncStep(GameGUI *gui) std::cout << "Story::syncStep : SGSL : Warning, story step took more than 256 cycles, perhaps you have infinite loop in your script" << std::endl; } -using namespace std; std::string ErrorReport::getErrorString(void) const { diff --git a/src/YOGClient.cpp b/src/YOGClient.cpp index 69f47c21..50fcd1ab 100644 --- a/src/YOGClient.cpp +++ b/src/YOGClient.cpp @@ -34,6 +34,9 @@ #include "YOGMessage.h" #include "YOGServer.h" +using boost::static_pointer_cast; +using boost::shared_ptr; + YOGClient::YOGClient(const std::string& server) { initialize(); diff --git a/src/YOGClientDownloadableMapList.cpp b/src/YOGClientDownloadableMapList.cpp index a629412a..30484994 100644 --- a/src/YOGClientDownloadableMapList.cpp +++ b/src/YOGClientDownloadableMapList.cpp @@ -21,6 +21,7 @@ #include "YOGClient.h" #include "NetMessage.h" +using boost::static_pointer_cast; YOGClientDownloadableMapList::YOGClientDownloadableMapList(YOGClient* client) : client(client) diff --git a/src/YOGClientFileAssembler.cpp b/src/YOGClientFileAssembler.cpp index 0fe2794f..83c9948a 100644 --- a/src/YOGClientFileAssembler.cpp +++ b/src/YOGClientFileAssembler.cpp @@ -25,8 +25,8 @@ #include "YOGClientFileAssembler.h" #include "YOGClient.h" -using namespace boost; using namespace GAGCore; +using boost::static_pointer_cast; YOGClientFileAssembler::YOGClientFileAssembler(boost::weak_ptr client, Uint16 fileID) : client(client), fileID(fileID) diff --git a/src/YOGClientGameConnectionDialog.cpp b/src/YOGClientGameConnectionDialog.cpp index c2f1c15f..8d29c96f 100644 --- a/src/YOGClientGameConnectionDialog.cpp +++ b/src/YOGClientGameConnectionDialog.cpp @@ -27,7 +27,6 @@ using namespace GAGCore; using namespace GAGGUI; -using namespace boost; YOGClientGameConnectionDialog::YOGClientGameConnectionDialog(GraphicContext *parentCtx, boost::shared_ptr game) : OverlayScreen(parentCtx, 200, 100), parentCtx(parentCtx), game(game) diff --git a/src/YOGClientGameListManager.cpp b/src/YOGClientGameListManager.cpp index b84a31b0..2aeafc0e 100644 --- a/src/YOGClientGameListManager.cpp +++ b/src/YOGClientGameListManager.cpp @@ -21,6 +21,8 @@ #include "NetMessage.h" #include "YOGClientGameListListener.h" +using boost::static_pointer_cast; + YOGClientGameListManager::YOGClientGameListManager(YOGClient* client) : client(client) { diff --git a/src/YOGClientMapUploader.cpp b/src/YOGClientMapUploader.cpp index 794e6cd6..9985022d 100644 --- a/src/YOGClientMapUploader.cpp +++ b/src/YOGClientMapUploader.cpp @@ -28,6 +28,7 @@ #include "Stream.h" #include "BinaryStream.h" +using boost::static_pointer_cast; YOGClientMapUploader::YOGClientMapUploader(boost::shared_ptr client) : state(Nothing), client(client) diff --git a/src/YOGClientPlayerListManager.cpp b/src/YOGClientPlayerListManager.cpp index d801ee9b..c0272173 100644 --- a/src/YOGClientPlayerListManager.cpp +++ b/src/YOGClientPlayerListManager.cpp @@ -20,6 +20,8 @@ #include "YOGClientPlayerListListener.h" #include "NetMessage.h" +using boost::static_pointer_cast; + YOGClientPlayerListManager::YOGClientPlayerListManager(YOGClient* client) : client(client) { diff --git a/src/YOGClientRouterAdministrator.cpp b/src/YOGClientRouterAdministrator.cpp index e6c0c4ce..1115ca79 100644 --- a/src/YOGClientRouterAdministrator.cpp +++ b/src/YOGClientRouterAdministrator.cpp @@ -23,6 +23,7 @@ #include "YOGClientRouterAdministrator.h" #include "YOGConsts.h" +using boost::static_pointer_cast; YOGClientRouterAdministrator::YOGClientRouterAdministrator() { diff --git a/src/YOGLoginScreen.cpp b/src/YOGLoginScreen.cpp index 5ba5cfc5..62203867 100644 --- a/src/YOGLoginScreen.cpp +++ b/src/YOGLoginScreen.cpp @@ -40,6 +40,8 @@ #include "YOGLoginScreen.h" #include "YOGRegisterScreen.h" +using boost::static_pointer_cast; + YOGLoginScreen::YOGLoginScreen(boost::shared_ptr client) : client(client) { diff --git a/src/YOGRegisterScreen.cpp b/src/YOGRegisterScreen.cpp index ac499989..55fa125c 100644 --- a/src/YOGRegisterScreen.cpp +++ b/src/YOGRegisterScreen.cpp @@ -32,6 +32,7 @@ #include "GlobalContainer.h" +using boost::static_pointer_cast; YOGRegisterScreen::YOGRegisterScreen(boost::shared_ptr client) : client(client) diff --git a/src/YOGServerFileDistributor.cpp b/src/YOGServerFileDistributor.cpp index c745e8af..2dfee230 100644 --- a/src/YOGServerFileDistributor.cpp +++ b/src/YOGServerFileDistributor.cpp @@ -25,8 +25,8 @@ #include "YOGServerFileDistributor.h" #include "YOGServerPlayer.h" -using namespace boost; using namespace GAGCore; +using boost::static_pointer_cast; YOGServerFileDistributor::YOGServerFileDistributor(Uint16 fileID) : fileID(fileID), startedLoading(false), downloadFromPlayerCanceled(false) diff --git a/src/YOGServerPlayer.cpp b/src/YOGServerPlayer.cpp index 121846c9..870200d6 100644 --- a/src/YOGServerPlayer.cpp +++ b/src/YOGServerPlayer.cpp @@ -23,6 +23,8 @@ #include "YOGServerFileDistributor.h" #include "YOGServerPlayer.h" +using boost::static_pointer_cast; + YOGServerPlayer::YOGServerPlayer(shared_ptr connection, Uint16 id, YOGServer& server) : connection(connection), server(server), playerID(id) { diff --git a/src/YOGServerPlayer.h b/src/YOGServerPlayer.h index 2e945d01..efd7f2a3 100644 --- a/src/YOGServerPlayer.h +++ b/src/YOGServerPlayer.h @@ -27,13 +27,13 @@ #include "YOGGameInfo.h" #include "YOGPlayerSessionInfo.h" -using namespace boost; class YOGServer; class YOGServerGame; class NetMessage; class P2PManager; +using boost::weak_ptr; ///This represents a connected user on the YOG server. class YOGServerPlayer { diff --git a/src/YOGServerRouter.cpp b/src/YOGServerRouter.cpp index 3afd5bfe..fd24c364 100644 --- a/src/YOGServerRouter.cpp +++ b/src/YOGServerRouter.cpp @@ -28,8 +28,8 @@ #include "YOGServerRouterPlayer.h" #include -using namespace boost; using namespace GAGCore; +using boost::static_pointer_cast; YOGServerRouter::YOGServerRouter() : nl(YOG_ROUTER_PORT), admin(this) diff --git a/src/YOGServerRouterManager.cpp b/src/YOGServerRouterManager.cpp index af2a0567..a3de922b 100644 --- a/src/YOGServerRouterManager.cpp +++ b/src/YOGServerRouterManager.cpp @@ -21,6 +21,8 @@ #include "NetConnection.h" #include "NetMessage.h" +using boost::static_pointer_cast; + YOGServerRouterManager::YOGServerRouterManager(YOGServer& server) : listener(YOG_SERVER_ROUTER_PORT), server(server) { diff --git a/src/YOGServerRouterPlayer.cpp b/src/YOGServerRouterPlayer.cpp index 725913c2..6d2845b6 100644 --- a/src/YOGServerRouterPlayer.cpp +++ b/src/YOGServerRouterPlayer.cpp @@ -23,6 +23,7 @@ #include "YOGServerGameRouter.h" #include "YOGServerRouter.h" +using boost::static_pointer_cast; YOGServerRouterPlayer::YOGServerRouterPlayer(boost::shared_ptr connection, YOGServerRouter* router) : connection(connection), router(router), isAdmin(false)