]> jfr.im git - irc/gameservirc.git/commitdiff
fixed some stuff
authorkainazzzo <redacted>
Thu, 30 Mar 2006 03:18:37 +0000 (03:18 +0000)
committerkainazzzo <redacted>
Thu, 30 Mar 2006 03:18:37 +0000 (03:18 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@436 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/Changes
gameserv/gameserv.cpp

index b1cc96bcbd90e756be1ff03a0aadd1d2384058a2..133d62913ed6155e5b914a570e78208bb88aac0c 100644 (file)
@@ -1,3 +1,5 @@
+Version 1.3.4
+* Fixed a bug that would leave a player logged in after they quit - Kain (thanks Mauritz)
 Version 1.3.3
 * Fixed a bug causing players' HP to be set to 10 on gameserv load - Kain (thanks Mauritz)
 * Removed the timestamp update from the following commands if the player is fighting:
index 55da3f5acf0addfaf924d8d847001a84796fc01a..3a8d5aaa047116755d3f48aaa64f88d2f7a564df 100644 (file)
@@ -1137,52 +1137,59 @@ void do_logout(char *u)
 
 void logout(aClient *user)
 {
-  if (is_playing(user))
+  if (user != NULL)
     {
-         list<Player*>::iterator iter;
-         unsigned long hv = iHASH((unsigned char *) user->stats->getName().c_str());
-         iter = find(players[hv].begin(), players[hv].end(), user->stats);
-         
-         if (iter == players[hv].end())
-        {
-                 notice(s_GameServ, user->getNick(), "Fatal error. Contact "\
-                                "%S Admin. Cannot find you in the players list. This should NEVER happen");
-                 log("Error on logout(). Can't find %s in the players list",
+         if (user->stats != NULL)
+               {
+               
+                 list<Player*>::iterator iter;
+                 unsigned long hv = iHASH((unsigned char *) user->stats->getName().c_str());
+                 iter = find(players[hv].begin(), players[hv].end(), user->stats);
+                 
+                 if (iter == players[hv].end())
+                       {
+                         notice(s_GameServ, user->getNick(), "Fatal error. Contact "\
+                                        "%S Admin. Cannot find you in the players list. This should NEVER happen");
+                         log("Error on logout(). Can't find %s in the players list",
 #ifdef P10 
-                         user->getRealNick()
+                                 user->getRealNick()
 #else 
-                         user->getNick()
+                                 user->getNick()
 #endif
-                         );
-                 return;
-        }
-         user->stats->delMonster();
-         user->stats->delMaster();
-         user->stats->delBattle();
-         clearDragonFight(user->stats);
-         clearYourTurn(user->stats);
-         clearPlaying(user);
-
-         user->stats->setClient(NULL);
-         user->stats = NULL;
-         
-         if (player_fight(user))
-               {
-                 clearYourTurn(user->stats->getBattle()->stats);
-                 user->stats->getBattle()->stats->delBattle();
-               }
-
+                                 );
+                         user->stats = NULL;
+                         
+                         return;
+                       }
+                 user->stats->delMonster();
+                 user->stats->delMaster();
+                 user->stats->delBattle();
+                 clearDragonFight(user->stats);
+                 clearYourTurn(user->stats);
+                 clearPlaying(user);
+                 
+                 user->stats->setClient(NULL);
+                 
+                 
+                 if (player_fight(user))
+                       {
+                         clearYourTurn(user->stats->getBattle()->stats);
+                         user->stats->getBattle()->stats->delBattle();
+                       }
+                 
 #ifdef DEBUGMODE
-         log("Logged out player %s",
+                 log("Logged out player %s",
 #ifdef P10 
-                 user->getRealNick()
+                         user->getRealNick()
 #else 
-                 user->getNick()
+                         user->getNick()
 #endif 
-                 );
+                         );
 #endif
-    }
-
+               }
+       }
+  if (user)
+       user->stats = NULL;
 }
 
 void do_register(char *u)