diff options
-rw-r--r-- | src/game/DynamicObject.cpp | 10 | ||||
-rw-r--r-- | src/game/ObjectAccessor.cpp | 5 | ||||
-rw-r--r-- | src/trinitycore/CliRunnable.cpp | 45 | ||||
-rw-r--r-- | src/trinitycore/Main.cpp | 5 | ||||
-rw-r--r-- | src/trinitycore/Master.cpp | 22 | ||||
-rw-r--r-- | src/trinitycore/RASocket.cpp | 16 | ||||
-rw-r--r-- | src/trinitycore/WorldRunnable.cpp | 6 |
7 files changed, 56 insertions, 53 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 854d2e82e3e..5a5ba008606 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -70,7 +70,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32 return false; } - SetUInt32Value( OBJECT_FIELD_ENTRY, spellId ); + SetEntry(spellId); SetFloatValue( OBJECT_FIELD_SCALE_X, 1 ); SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() ); SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 ); @@ -153,5 +153,7 @@ void DynamicObject::Delay(int32 delaytime) bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const { - return IsInWorld() && u->IsInWorld() /*&& IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))*/; + return IsInWorld() && u->IsInWorld() + && (IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)) + || GetCasterGUID() == u->GetGUID()); } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index e5243ab941e..c03dbab09e9 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ObjectAccessor.h" @@ -612,7 +612,6 @@ ObjectAccessor::ActiveObjectsNearGrid(uint32 x, uint32 y, uint32 m_id, uint32 i_ if( (cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord) ) return true; - } return false; diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index 9c464fde9ef..065a6662a50 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup Trinityd @@ -51,7 +51,7 @@ void utf8print(const char* str) CharToOemBuffW(&wtemp_buf[0],&temp_buf[0],wtemp_len+1); printf(temp_buf); #else - printf(str); + printf(str); #endif } @@ -118,7 +118,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) return false; } - return true; + return true; } bool ChatHandler::HandleCharacterDeleteCommand(const char* args) @@ -126,18 +126,18 @@ bool ChatHandler::HandleCharacterDeleteCommand(const char* args) if(!*args) return false; - char *character_name_str = strtok((char*)args," "); + char *character_name_str = strtok((char*)args," "); if(!character_name_str) - return false; + return false; std::string character_name = character_name_str; if(!normalizePlayerName(character_name)) - return false; + return false; uint64 character_guid; uint32 account_id; - Player *player = objmgr.GetPlayer(character_name.c_str()); + Player *player = objmgr.GetPlayer(character_name.c_str()); if(player) { character_guid = player->GetGUID(); @@ -157,10 +157,10 @@ bool ChatHandler::HandleCharacterDeleteCommand(const char* args) account_id = objmgr.GetPlayerAccountIdByGUID(character_guid); } - std::string account_name; + std::string account_name; accmgr.GetName (account_id,account_name); - Player::DeleteFromDB(character_guid, account_id, true); + Player::DeleteFromDB(character_guid, account_id, true); PSendSysMessage(LANG_CHARACTER_DELETED,character_name.c_str(),GUID_LOPART(character_guid),account_name.c_str(), account_id); return true; } @@ -170,7 +170,7 @@ bool ChatHandler::HandleServerExitCommand(const char* args) { SendSysMessage(LANG_COMMAND_EXIT); World::m_stopEvent = true; - return true; + return true; } /// Display info on users currently in the realm @@ -227,7 +227,7 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args) char *szAcc = strtok((char*)args, " "); char *szPassword = strtok(NULL, " "); if(!szAcc || !szPassword) - return false; + return false; // normilized in accmgr.CreateAccount std::string account_name = szAcc; @@ -256,8 +256,8 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args) SetSentErrorMessage(true); return false; } - - return true; + + return true; } /// Set the level of logging @@ -268,10 +268,10 @@ bool ChatHandler::HandleServerSetLogLevelCommand(const char *args) char *NewLevel = strtok((char*)args, " "); if (!NewLevel) - return false; + return false; sLog.SetLogLevel(NewLevel); - return true; + return true; } /// @} @@ -325,12 +325,13 @@ void CliRunnable::run() { for(int x=0;command_str[x];x++) if(command_str[x]=='\r'||command_str[x]=='\n') - { - command_str[x]=0; - break; - } + { + command_str[x]=0; + break; + } - if(!*command_str) + + if(!*command_str) { printf("TC>"); continue; @@ -346,7 +347,9 @@ void CliRunnable::run() sWorld.QueueCliCommand(&utf8print,command.c_str()); } else if (feof(stdin)) + { World::m_stopEvent = true; + } } ///- End the database thread diff --git a/src/trinitycore/Main.cpp b/src/trinitycore/Main.cpp index e858f86d699..3767e73b844 100644 --- a/src/trinitycore/Main.cpp +++ b/src/trinitycore/Main.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup Trinityd Trinity Daemon @@ -137,7 +137,6 @@ extern int main(int argc, char **argv) sLog.outError("Could not find configuration file %s.", cfg_file); return 1; } - sLog.outString("Using configuration file %s.", cfg_file); uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0); diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index 9dcdc721f44..47a12484151 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -83,15 +83,15 @@ public: uint32 curtime = getMSTime(); //DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter); - // There is no Master anymore - // TODO: clear the rest of the code + // There is no Master anymore + // TODO: clear the rest of the code // // normal work // if(m_loops != Master::m_masterLoopCounter) // { // m_lastchange = curtime; // m_loops = Master::m_masterLoopCounter; // } -// // possible freeze +// // possible freeze // else if(getMSTimeDiff(m_lastchange,curtime) > _delaytime) // { // sLog.outError("Main/Sockets Thread hangs, kicking out server!"); @@ -104,7 +104,7 @@ public: w_lastchange = curtime; w_loops = World::m_worldLoopCounter; } - // possible freeze + // possible freeze else if(getMSTimeDiff(w_lastchange,curtime) > _delaytime) { sLog.outError("World Thread hangs, kicking out server!"); @@ -250,7 +250,7 @@ int Master::Run() ///- Launch CliRunnable thread ZThread::Thread td1(new CliRunnable); } - + ZThread::Thread td2(new RARunnable); ///- Handle affinity for multiple processors and process priority on Windows @@ -328,7 +328,7 @@ int Master::Run() } sWorldSocketMgr->Wait (); - + // set server offline loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID); @@ -339,7 +339,7 @@ int Master::Run() // since worldrunnable uses them, it will crash if unloaded after master t.wait(); td2.wait (); - + ///- Clean database before leaving clearOnlineAccounts(); @@ -459,7 +459,7 @@ bool Master::_StartDB() sWorld.LoadDBVersion(); - sLog.outString("Using %s", sWorld.GetDBVersion()); + sLog.outString("Using %s", sWorld.GetDBVersion()); return true; } @@ -471,7 +471,7 @@ void Master::clearOnlineAccounts() loginDatabase.PExecute( "UPDATE account SET online = 0 WHERE online > 0 " "AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID); - + CharacterDatabase.Execute("UPDATE characters SET online = 0"); } diff --git a/src/trinitycore/RASocket.cpp b/src/trinitycore/RASocket.cpp index 00f91f1a69a..f953dc3f592 100644 --- a/src/trinitycore/RASocket.cpp +++ b/src/trinitycore/RASocket.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -197,8 +197,8 @@ void RASocket::OnRead() loginDatabase.escape_string(pw); QueryResult *check = loginDatabase.PQuery( - "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))", - login.c_str(), pw.c_str()); + "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))", + login.c_str(), pw.c_str()); if(check) { @@ -244,13 +244,13 @@ void RASocket::zprint( const char * szText ) #ifdef RA_CRYPT - char *megabuffer=strdup(szText); + char *megabuffer=strdup(szText); unsigned int sz=strlen(megabuffer); Encrypt(megabuffer,sz); - send(r,megabuffer,sz,0); + send(r,megabuffer,sz,0); delete [] megabuffer; - - #else + + #else unsigned int sz=strlen(szText); send(r,szText,sz,0); diff --git a/src/trinitycore/WorldRunnable.cpp b/src/trinitycore/WorldRunnable.cpp index e681c9d4df4..1a30740ddd9 100644 --- a/src/trinitycore/WorldRunnable.cpp +++ b/src/trinitycore/WorldRunnable.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -77,7 +77,7 @@ void WorldRunnable::run() sWorld.KickAllQueued(); // kick all queued players (and prevent its login at kick in game players) sWorld.KickAll(); // save and kick all players sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call - + sWorldSocketMgr->StopNetwork(); MapManager::Instance().UnloadAll(); // unload all grids (including locked in memory) |