From 9264aa86ebd0813b9fc878cc454808b3b7339b4d Mon Sep 17 00:00:00 2001 From: lotodore Date: Fri, 25 Feb 2011 17:10:02 +0000 Subject: [PATCH] Fixing cppcheck issue. Adding parameter to set first player name. --- src/load.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/load.cpp b/src/load.cpp index 6c88fb37..c80af48d 100644 --- a/src/load.cpp +++ b/src/load.cpp @@ -38,7 +38,7 @@ namespace po = boost::program_options; #define BUF_SIZE 1024 struct NetSession { - NetSession(boost::asio::io_service &ioService) : recBufPos(0), socket(ioService) {} + NetSession(boost::asio::io_service &ioService) : recBufPos(0), authSession(NULL), socket(ioService) {} boost::array recBuf; size_t recBufPos; boost::array sendBuf; @@ -114,6 +114,7 @@ main(int argc, char *argv[]) ("server,s", po::value(), "PokerTH server name") ("port,P", po::value(), "PokerTH server port") ("numGames,n", po::value(), "Number of games to open") + ("firstId,f", po::value(), "First id of username testx") ; po::variables_map vm; @@ -124,7 +125,7 @@ main(int argc, char *argv[]) cout << desc << endl; return 1; } - if (!vm.count("server") || !vm.count("port") || !vm.count("numGames")) { + if (!vm.count("server") || !vm.count("port") || !vm.count("numGames") || !vm.count("firstId")) { cout << "Missing option!" << endl << desc << endl; return 1; } @@ -132,6 +133,7 @@ main(int argc, char *argv[]) string server(vm["server"].as()); string port = vm["port"].as(); unsigned numGames = vm["numGames"].as(); + int firstId = vm["firstId"].as(); // Initialise gsasl. Gsasl *authContext; @@ -193,7 +195,7 @@ main(int argc, char *argv[]) int errorCode = gsasl_client_start(authContext, "SCRAM-SHA-1", &session->authSession); if (errorCode == GSASL_OK) { ostringstream param; - param << "test" << i + 1; + param << "test" << i + firstId; cout << "User " << param.str() << " logging in." << endl; session->name = param.str(); gsasl_property_set(session->authSession, GSASL_AUTHID, session->name.c_str());