diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-01 21:21:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-01 22:13:44 +0300 |
commit | 41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6 (patch) | |
tree | 75a934dd456f4079898b77f17fc2e5da631ba761 /src/net | |
parent | 33ef923235aeabd07308816bb07ef790cc6c1024 (diff) | |
download | manaverse-41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6.tar.gz manaverse-41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6.tar.bz2 manaverse-41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6.tar.xz manaverse-41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6.zip |
Fix code style.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 1 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/ipc.cpp | 18 | ||||
-rw-r--r-- | src/net/ipc.h | 6 |
4 files changed, 11 insertions, 15 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 65e14040e..7ee755a5f 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -42,7 +42,6 @@ #include "gui/windows/outfitwindow.h" #include "gui/windows/socialwindow.h" #include "gui/windows/killstats.h" -#include "gui/windows/questswindow.h" #include "utils/timer.h" diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 4f5200573..225162e9a 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -43,7 +43,6 @@ #include "resources/map/map.h" -#include "listeners/updatestatuslistener.h" #include "listeners/playerdeathlistener.h" #include "listeners/weightlistener.h" diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 22fbb4ce4..a1bed683a 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -28,8 +28,6 @@ #include "utils/sdlhelper.h" #include "utils/stringutils.h" -#include <iostream> - #include "debug.h" IPC *ipc = nullptr; @@ -66,7 +64,7 @@ bool IPC::init() { IPaddress ip; - if(TcpNet::resolveHost(&ip, nullptr, mPort) == -1) + if (TcpNet::resolveHost(&ip, nullptr, mPort) == -1) { logger->log("IPC: resolveHost error: %s\n", TcpNet::getError()); return false; @@ -95,7 +93,7 @@ int IPC::acceptLoop(void *ptr) IPC *const ipc1 = reinterpret_cast<IPC*>(ptr); const int max_length = 1024; - TcpNet::SocketSet set = TcpNet::allocSocketSet(1); + const TcpNet::SocketSet set = TcpNet::allocSocketSet(1); TcpNet::addSocket(set, ipc1->mSocket); ipc->mListen = true; while (ipc1->mListen) @@ -104,7 +102,7 @@ int IPC::acceptLoop(void *ptr) if (!TcpNet::socketReady(ipc1->mSocket)) continue; - TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket); + const TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket); if (!sock) { logger->log_r("IPC: unable to accept connection"); @@ -129,11 +127,11 @@ int IPC::acceptLoop(void *ptr) ipc1->mThreadLocked = false; ipc1->mNumReqs ++; - const std::string resp = strprintf("[%d] %s\n", + const std::string resp = strprintf("[%u] %s\n", ipc1->mNumReqs, req.c_str()); - const char *respc = resp.c_str(); - const int len = strlen(respc) + 1; + const char *const respc = resp.c_str(); + const int len = static_cast<int>(strlen(respc)) + 1; result = TcpNet::send(sock, respc, len); if (result < len) { @@ -165,13 +163,13 @@ void IPC::start() unsigned short port(44007); if (getenv("IPC_PORT")) - port = atoi(getenv("IPC_PORT")); + port = static_cast<unsigned short>(atoi(getenv("IPC_PORT"))); logger->log("Starting IPC..."); ipc = new IPC; for (int f = port; f < 65535; f ++) { - ipc->setPort(f); + ipc->setPort(static_cast<unsigned short>(f)); logger->log(" -> trying port %d...", f); if (ipc->init()) { diff --git a/src/net/ipc.h b/src/net/ipc.h index 739eb746e..b1216815b 100644 --- a/src/net/ipc.h +++ b/src/net/ipc.h @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef IPC_H -#define IPC_H +#ifndef NET_IPC_H +#define NET_IPC_H #include "net/sdltcpnet.h" @@ -72,4 +72,4 @@ class IPC final extern IPC *ipc; -#endif // IPC_H +#endif // NET_IPC_H |