From: kainazzzo Date: Sun, 19 Mar 2006 07:35:30 +0000 (+0000) Subject: bug fixes and addition of PTLink to config file X-Git-Url: https://jfr.im/git/irc/gameservirc.git/commitdiff_plain/629d0d865c3ab52c62ec64007301fd1937014e85?ds=sidebyside;hp=2f110fa2b1391060f005476d02133cc836fbdd88 bug fixes and addition of PTLink to config file git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@424 bc333340-6410-0410-a689-9d09f3c113fa --- diff --git a/gameserv/Config b/gameserv/Config index 15f7b3b..397705a 100755 --- a/gameserv/Config +++ b/gameserv/Config @@ -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" diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index 66a7924..3f5f533 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -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 diff --git a/gameserv/tcpclient.cpp b/gameserv/tcpclient.cpp index d5deaf6..51c6909 100644 --- a/gameserv/tcpclient.cpp +++ b/gameserv/tcpclient.cpp @@ -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 *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 *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 *newPtr; - aClient *p = NULL; - - p = find(nick); - - if (!is_playing(p)) + ListNode *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)