From a55315343173f9f742b6a49cdd10f9aeaf2202c0 Mon Sep 17 00:00:00 2001 From: theluda Date: Wed, 22 Aug 2007 08:31:53 +0000 Subject: [PATCH] [4365] Applied MaNGOS coding style to src/mangosd. --- src/mangosd/CliRunnable.cpp | 57 +++++++++++++++++++++---------------------- src/mangosd/Main.cpp | 4 +-- src/mangosd/Master.cpp | 2 +- src/mangosd/RASocket.cpp | 4 +-- src/mangosd/WorldRunnable.cpp | 3 +-- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index dee1f6f4..c7058102 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -101,7 +101,7 @@ void CliWritePlayerDump(char*command,pPrintf zprintf) { char * file = strtok(command, " "); char * p2 = strtok(NULL, " "); - if(!file || !p2) + if(!file || !p2) { zprintf("Syntax is: writepdump $filename $playerGUID\r\n"); return; @@ -259,7 +259,7 @@ void CliInfo(char*,pPrintf zprintf) return; } - int linesize = 1+15+2+20+3+15+2+4+1+5+3; // see format string + int linesize = 1+15+2+20+3+15+2+4+1+5+3; // see format string char* buf = new char[resultDB->GetRowCount()*linesize+1]; char* bufPos = buf; @@ -389,8 +389,7 @@ void CliBan(char*command,pPrintf zprintf) char* reason = strtok(NULL," "); char* duration = strtok(NULL," "); - - if(!type||!nameOrIP||!reason) // ?!? input of single char "0"-"9" wouldn't detect when with: || !atoi(duration) + if(!type||!nameOrIP||!reason) // ?!? input of single char "0"-"9" wouldn't detect when with: || !atoi(duration) { zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \r\n"); return; @@ -401,18 +400,18 @@ void CliBan(char*command,pPrintf zprintf) switch (sWorld.BanAccount(type, nameOrIP, duration, reason, "Set by console.")) { - case BAN_SUCCESS: - if(atoi(duration)>0) - zprintf("%s is banned for %s. Reason: %s.\r\n",nameOrIP,secsToTimeString(TimeStringToSecs(duration),true,false).c_str(),reason); - else - zprintf("%s is banned permanently. Reason: %s.\r\n",nameOrIP,reason); - break; - case BAN_NOTFOUND: - zprintf("%s %s not found\r\n", type, nameOrIP); - break; - case BAN_SYNTAX_ERROR: - zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \r\n"); - break; + case BAN_SUCCESS: + if(atoi(duration)>0) + zprintf("%s is banned for %s. Reason: %s.\r\n",nameOrIP,secsToTimeString(TimeStringToSecs(duration),true,false).c_str(),reason); + else + zprintf("%s is banned permanently. Reason: %s.\r\n",nameOrIP,reason); + break; + case BAN_NOTFOUND: + zprintf("%s %s not found\r\n", type, nameOrIP); + break; + case BAN_SYNTAX_ERROR: + zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \r\n"); + break; } } @@ -481,7 +480,7 @@ void CliSetGM(char *command,pPrintf zprintf) char *szAcc = strtok(command," "); char *szLevel = strtok(NULL," "); - if(!szAcc||!szLevel) //wrong syntax 'setgm' without name + if(!szAcc||!szLevel) //wrong syntax 'setgm' without name { zprintf("Syntax is: setgm $character $number (0 - normal, 3 - gamemaster)>\r\n"); return; @@ -574,15 +573,15 @@ void ParseCommand( pPrintf zprintf, char* input) ///- Circle through the command table and, if found, put the command in the queue for ( x=0;x 1)|| (lev < 0)) { @@ -722,7 +721,7 @@ void CliSend(char *playerN,pPrintf zprintf) zprintf("Player %s not found!\r\n", plr); return; } - + if (rPlayer->GetSession()->isLogingOut()) { zprintf("Cannot send message while player %s is logging out!\r\n",plr); @@ -733,7 +732,7 @@ void CliSend(char *playerN,pPrintf zprintf) //Use SendAreaTriggerMessage for fastest delivery. rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg); rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); - + //Confirmation message zprintf("Message '%s' sent to %s\r\n",msg , plr); } diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 035eec42..1817d2a7 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -28,8 +28,8 @@ #include "SystemConfig.h" #ifdef DO_POSTGRESQL -DatabasePostgre sDatabase; ///< Accessor to the mangos server database -DatabasePostgre loginDatabase; ///< Accessor to the realm/login database +DatabasePostgre sDatabase; ///< Accessor to the mangos server database +DatabasePostgre loginDatabase; ///< Accessor to the realm/login database #else DatabaseMysql sDatabase; ///< Accessor to the mangos server database DatabaseMysql loginDatabase; ///< Accessor to the realm/login database diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 4ad6cbee..5d1c72da 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -210,7 +210,7 @@ void Master::Run() ///- Clean database before leaving clearOnlineAccounts(); - + ///- Wait for delay threads to end sDatabase.HaltDelayThread(); loginDatabase.HaltDelayThread(); diff --git a/src/mangosd/RASocket.cpp b/src/mangosd/RASocket.cpp index cc8647bc..7d263e14 100644 --- a/src/mangosd/RASocket.cpp +++ b/src/mangosd/RASocket.cpp @@ -80,8 +80,8 @@ void RASocket::OnAccept() if(iUsers) dropclient - ///- Else print Motd - Sendf("%s\r\n",sWorld.GetMotd()); + ///- Else print Motd + Sendf("%s\r\n",sWorld.GetMotd()); } /// Read data from the network diff --git a/src/mangosd/WorldRunnable.cpp b/src/mangosd/WorldRunnable.cpp index a7fa0c21..23e6dc8d 100644 --- a/src/mangosd/WorldRunnable.cpp +++ b/src/mangosd/WorldRunnable.cpp @@ -61,10 +61,9 @@ void WorldRunnable::run() sWorld.Update( diff ); realPrevTime = realCurrTime; - // diff (D0) include time of previous sleep (d0) + tick time (t0) // we want that next d1 + t1 == WORLD_SLEEP_CONST - // we can't know next t1 and then can use (t0 + d1) == WORLD_SLEEP_CONST requirement + // we can't know next t1 and then can use (t0 + d1) == WORLD_SLEEP_CONST requirement // d1 = WORLD_SLEEP_CONST - t0 = WORLD_SLEEP_CONST - (D0 - d0) = WORLD_SLEEP_CONST + d0 - D0 if (diff <= WORLD_SLEEP_CONST+prevSleepTime) { -- 2.11.4.GIT