]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/tcpclient.cpp
Fixed some bugs
[irc/gameservirc.git] / gameserv / tcpclient.cpp
index 70007f2d790900c6efad7680ce0e2b7d3c14e4c8..69d5dd768fa523e884102b4bac66595a7c772843 100644 (file)
@@ -36,7 +36,7 @@ using std::cerr;
 using std::endl;
 
 char *PACKAGE = "GameServ";
-char *VERSION = "1.1.9";
+char *VERSION = "1.2.0 +devel";
 
 int sock;
 int day;
@@ -308,7 +308,23 @@ int main(int argc, char *argv[])
                clients.remove(quitter);
            if ((quitter = findIRCplayer(source)))
            {
+               if (player_fight(quitter))
+               {
+                   // Stop the fight on the other client
+                   aClient *otherplayer = quitter->stats->battle;
+                   otherplayer->stats->battle = NULL;
+                   notice(s_GameServ, otherplayer->getNick(), "%s "\
+                          "has quit IRC. The fight stops here.",
+                          quitter->stats->name);
+               }
+               quitter->stats->battle = NULL;
+               quitter->stats->fight = NULL;
+               quitter->stats->master = NULL;
+
                quitter->setNick("!NULL!");
+               #ifdef P10
+                   quitter->setRealNick("!NULL!");
+               #endif
                quitter->stats->user = NULL; // Unidentify them
            }
 
@@ -345,11 +361,39 @@ int main(int argc, char *argv[])
            else if (stricmp(dest, c_Forest) == 0)
                forest(source, rest);
       #endif
+      #if defined(P10)
+       } else if (stricmp(cmd, "J") == 0) {
+      #else
        } else if (stricmp(cmd, "JOIN") == 0) {
+      #endif
            char *channel;
+           aClient *joiner;
            channel = strtok(NULL, " ");
-           if (stricmp(channel, c_Forest) == 0 && is_playing(source + 1))
-               raw(":%S MODE %s +v %s", c_Forest, (source + 1));
+
+            char z = source[0];
+
+            if (z == ':')
+                source++;
+
+           joiner = find(source);
+
+           if (stricmp(channel, c_Forest) == 0 && is_playing(joiner))
+           {
+               #ifdef DEBUGMODE
+                   log("Player %s (IRC: %s) joined %s", 
+                       joiner->stats->name, 
+                       #ifdef P10
+                           joiner->getRealNick(),
+                       #else
+                           joiner->getNick(),
+                       #endif
+                       c_Forest);
+               #endif
+               raw(":%S MODE %s +v %s", c_Forest, (source));
+           }
+
+           if (z == ':')
+               source--;
 
        #if defined(BAHAMUT)
        } else if (stricmp(cmd, "SJOIN") == 0) {