]> jfr.im git - irc/gameservirc.git/commitdiff
bug fixes and addition of PTLink to config file
authorkainazzzo <redacted>
Sun, 19 Mar 2006 07:35:30 +0000 (07:35 +0000)
committerkainazzzo <redacted>
Sun, 19 Mar 2006 07:35:30 +0000 (07:35 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@424 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/Config
gameserv/gameserv.cpp
gameserv/tcpclient.cpp

index 15f7b3b2085bfc5693e679363e5d458dd7ced8ba..397705a71c59c395367334a6c5aa7aad3a52915c 100755 (executable)
@@ -24,31 +24,43 @@ case $select in
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
-           echo "#undef ULTIMATE2" >> options.h;;
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h;;
        2)
            echo "#undef UNREAL" > options.h
            echo "#define BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
-           echo "#undef ULTIMATE2" >> options.h;;
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h;;
        3)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#define P10" >> options.h
            echo "#undef HYBRID" >> options.h
-           echo "#undef ULTIMATE2" >> options.h;;
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h;;
        4)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#define HYBRID" >> options.h
-           echo "#undef ULTIMATE2" >> options.h;;
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h;;
        5)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
-           echo "#define ULTIMATE2" >> options.h;;
+           echo "#define ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h;;
+        6)
+           echo "#undef UNREAL" > options.h
+           echo "#undef BAHAMUT" >> options.h
+           echo "#undef P10" >> options.h
+           echo "#undef HYBRID" >> options.h
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#define PTLINK" >> options.h;;
        *)
            echo
            echo "Improper selection"
index 66a7924621cf66eb31eb204a473ad12f88c34a1a..3f5f53322020e9687f9bee5588b91e7655cecde3 100644 (file)
@@ -1095,9 +1095,13 @@ void logout(aClient *user)
          user->stats->delMonster();
          user->stats->delMaster();
          clearDragonFight(user->stats);
+         clearYourTurn(user->stats);     
          
          if (player_fight(user))
-           user->stats->getBattle()->stats->delBattle();
+               {
+                 clearYourTurn(user->stats->getBattle()->stats);
+                 user->stats->getBattle()->stats->delBattle();
+               }
 
          user->stats->delBattle();
 
@@ -1109,7 +1113,8 @@ void logout(aClient *user)
          
          delete user->stats;
          user->stats = NULL;
-         temp->stats->setClient(temp);
+         temp->stats->setClient(NULL);
+
 #ifdef P10
          temp->setRealNick("Not Playing");
 #endif
index d5deaf6f23d33aeb3a83ad596746837e5f0c21ab..51c6909eee3c41aad326228332d38bb82e689df6 100644 (file)
@@ -215,6 +215,11 @@ int main(int argc, char *argv[])
          if (isBOper())
            raw(":%S mode %S +o");
          raw(":%S JOIN %s", c_Forest);
+#elif defined(PTLINK)
+         raw("PASS %s :TS", remotepass);
+         raw("SERVER %s 1 :%s", servername, servername);
+         raw("NICK %S 1 %d %s%s %s %s %s :GameServ", time(NULL), (isBOper() ? "+iow " : ""), gsident, gshost, gshost, servername);
+         raw(":%s SJOIN %d %s +nt :@%S", servername, time(NULL), c_Forest);
 #elif defined(P10)
          // Server numeric is: []  <-- must be unique
          raw("PASS :%s", remotepass);
@@ -361,24 +366,24 @@ int main(int argc, char *argv[])
            raw(":%s 351 %s %s_%s. %s", servername, source+1, PACKAGE, VERSION, servername);
       #if !defined(P10)
        } else if (strncmp(cmd, "NICK", 4) == 0) {
-           if (buffer[0] == ':')
+         if (buffer[0] == ':')
            {
-               aClient *tempPtr;
-               if ((tempPtr = find((source + 1))))
-               {
-                   char *nick;
-                   unsigned long oldhv, newhv;
-                   nick = strtok(NULL, " ");
-                   oldhv = iHASH((unsigned char *) tempPtr->getNick());
-                   newhv = iHASH((unsigned char *) nick);
-                   tempPtr->setNick(nick);
-                   clients[oldhv].remove(tempPtr);
-                   clients[newhv].insertAtBack(tempPtr);
-               }
+                 aClient *tempPtr;
+                 if ((tempPtr = find((source + 1))))
+                       {
+                         char *nick;
+                         unsigned long oldhv, newhv;
+                         nick = strtok(NULL, " ");
+                         oldhv = iHASH((unsigned char *) tempPtr->getNick());
+                         newhv = iHASH((unsigned char *) nick);
+                         tempPtr->setNick(nick);
+                         clients[oldhv].remove(tempPtr);
+                         clients[newhv].insertAtBack(tempPtr);
+                       }
            }
-           else
+         else
            {
-               char *nick;
+                 char *nick;
       #else
        } else if (stricmp(cmd, "N") == 0 && strlen(source) == 2) {
            {   
@@ -435,7 +440,7 @@ int main(int argc, char *argv[])
 
                temp = clients[hv].insertAtBack(newuser);
 
-               #if defined(HYBRID) || defined(BAHAMUT) || defined(ULTIMATE2)
+               #if defined(HYBRID) || defined(BAHAMUT) || defined(ULTIMATE2) || defined(PTLINK)
                    char *nickserver;
                    strtok(NULL, " ");
                    strtok(NULL, " ");
@@ -474,27 +479,28 @@ int main(int argc, char *argv[])
        } else if (stricmp(cmd, "Q") == 0) {
 //         unsigned long hv = sHASH((unsigned char *) source);
       #else
-       } else if (stricmp(cmd, "QUIT") == 0) {
+       } else if (stricmp(cmd, "QUIT") == 0)
+         {
 //         unsigned long hv = iHASH((unsigned char *) source);
-      #endif
-           aClient *quitter;
-           char z = source[0];
+#endif
+               aClient *quitter;
+               char z = source[0];
 
            if (z == ':')
-               source++;
-
+                 source++;
+               
            if (!(quitter = find(source)))
-           {
-               log("Fatal Error: could not find %s in the "\
-                       "clients list", source);
-               goto end;
-           }
+                 {
+                       log("Fatal Error: could not find %s in the "\
+                               "clients list", source);
+                       goto end;
+                 }
 
            logout(quitter);
                delete quitter;
                
            if (z == ':')
-               source--;
+                 source--;
 
            /* Attempting to use the logout() function
            if ((quitter = find(source)))
@@ -679,56 +685,62 @@ aClient *findbyrealnick(char *realnick)
 
 aClient *findbynick(char *nick)
 {
-    ListNode <aClient> *newPtr;
-    #ifdef P10
-       unsigned long hv = sHASH((unsigned char *) nick);
-    #else
-       unsigned long hv = iHASH((unsigned char *) nick);
-    #endif
-
-    newPtr = clients[hv].First();
-
-    aClient *client = NULL;
-
-    while (newPtr)
+  ListNode <aClient> *newPtr;
+#ifdef P10
+  unsigned long hv = sHASH((unsigned char *) nick);
+#else
+  unsigned long hv = iHASH((unsigned char *) nick);
+#endif
+  
+  newPtr = clients[hv].First();
+  
+  aClient *client = NULL;
+  
+  while (newPtr)
     {
-       client = newPtr->getData();
-       #ifdef P10
-           if (strcmp(client->getNick(), nick) == 0)
-       #else
-           if (stricmp(client->getNick(), nick) == 0)
-       #endif
-           return client;
-       client = NULL;
-       newPtr = newPtr->Next();
+         client = newPtr->getData();
+#ifdef P10
+         if (strcmp(client->getNick(), nick) == 0)
+               {
+#else
+         if (stricmp(client->getNick(), nick) == 0)
+               {
+#endif
+                 return client;
+               }
+         client = NULL;
+         newPtr = newPtr->Next();
     }
-    return client;    
+  return client;    
 }
 
 aClient *findIRCplayer(const char *nick)
 {
-    ListNode <aClient> *newPtr;
-    aClient *p = NULL;
-
-    p = find(nick);
-
-    if (!is_playing(p))
+  ListNode <aClient> *newPtr;
+  aClient *p = NULL;
+  
+  p = find(nick);
+  
+  if (!is_playing(p))
        return NULL;
-
-    unsigned long hv = iHASH((unsigned char *) p->stats->getName().c_str());
-
-    for (newPtr = players[hv].First(); newPtr; newPtr = newPtr->Next())
+  
+  unsigned long hv = iHASH((unsigned char *) p->stats->getName().c_str());
+  
+  for (newPtr = players[hv].First(); newPtr; newPtr = newPtr->Next())
     {
-       p = newPtr->getData();
-       #ifdef P10
-           if (strcmp(p->getNick(), nick) == 0)
-       #else
-           if (stricmp(p->getNick(), nick) == 0)
-       #endif
-           return p;
-       p = NULL;
-    }
-    return NULL;
+         p = newPtr->getData();
+#ifdef P10
+         if (strcmp(p->getNick(), nick) == 0)
+               {
+#else
+      if (stricmp(p->getNick(), nick) == 0)
+               {       
+#endif
+                 return p;
+               }
+         p = NULL;
+       }
+  return NULL;
 }
 
 aClient *findplayer(const char *name)