Changeset 181 for trunk/src/game/WorldSession.cpp
- Timestamp:
- 11/19/08 13:44:02 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/WorldSession.cpp
r174 r181 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 51 51 _logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0) 52 52 { 53 if (sock)54 {55 56 57 }53 if (sock) 54 { 55 m_Address = sock->GetRemoteAddress (); 56 sock->AddReference (); 57 } 58 58 } 59 59 … … 62 62 { 63 63 ///- unload player if not unloaded 64 if (_player)65 LogoutPlayer (true);64 if (_player) 65 LogoutPlayer (true); 66 66 67 67 /// - If have unclosed socket, close it 68 if (m_Socket)69 { 70 m_Socket->CloseSocket ();71 m_Socket->RemoveReference ();72 m_Socket = NULL;68 if (m_Socket) 69 { 70 m_Socket->CloseSocket (); 71 m_Socket->RemoveReference (); 72 m_Socket = NULL; 73 73 } 74 74 … … 76 76 while(!_recvQueue.empty()) 77 77 { 78 WorldPacket *packet = _recvQueue.next ();78 WorldPacket *packet = _recvQueue.next (); 79 79 delete packet; 80 80 } 81 82 81 } 83 82 … … 134 133 } 135 134 136 #endif // !TRINITY_DEBUG137 138 139 135 #endif // !MANGOS_DEBUG 136 137 if (m_Socket->SendPacket (*packet) == -1) 138 m_Socket->CloseSocket (); 140 139 } 141 140 … … 158 157 bool WorldSession::Update(uint32 /*diff*/) 159 158 { 160 if (m_Socket && m_Socket->IsClosed ())161 {159 if (m_Socket && m_Socket->IsClosed ()) 160 { 162 161 m_Socket->RemoveReference (); 163 162 m_Socket = NULL; 164 }165 163 } 164 166 165 WorldPacket *packet; 167 166 … … 248 247 if (uint64 lguid = GetPlayer()->GetLootGUID()) 249 248 DoLootRelease(lguid); 250 249 251 250 ///- If the player just died before logging out, make him appear as a ghost 252 251 //FIXME: logout must be delayed in case lost connection with client in time of combat … … 285 284 // give honor to all attackers from set like group case 286 285 for(std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr) 287 (*itr)->RewardHonor(_player, aset.size(), -1, true);286 (*itr)->RewardHonor(_player,aset.size()); 288 287 289 288 // give bg rewards and update counters like kill by first from attackers … … 403 402 //No SQL injection as AccountId is uint32 404 403 CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", 405 404 GetAccountId()); 406 405 sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" ); 407 406 } … … 415 414 void WorldSession::KickPlayer() 416 415 { 417 418 416 if (m_Socket) 417 m_Socket->CloseSocket (); 419 418 } 420 419 … … 522 521 } 523 522 } 524 525 526 527