]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/tcpclient.cpp
added items to the tavern.dat, added the filename option to the config file
[irc/gameservirc.git] / gameserv / tcpclient.cpp
index f5d9bb2de081021f03185c73559e04261e757ceb..d0ae5f0a1f29416976330d57724772987cc054cd 100644 (file)
 #include <stdlib.h>
 #include <fcntl.h>
 #include <signal.h>
+
 //#include <sys/types.h>
 //#include <sys/wait.h>
 //#include <errno.h>
 
-using std::ofstream;
-using std::ifstream;
-using std::cerr;
-using std::endl;
+using namespace std;
 
 char *PACKAGE = "GameServ";
-char *VERSION = "1.2.4 +devel";
+char *VERSION = "1.2.6 +devel";
 
 int sock;
 long lastrefresh;
@@ -102,22 +100,39 @@ int main(int argc, char *argv[])
         perror("Could not turn into a daemon");
         exit(3);
     }
+  if (load_items() == 0)
+    {
+      log("Error loading items");
+      goto end;
+    }
 
-  init_masters();
   load_gs_dbase();
   loadNews(newsdata, todaysnews);
 
-  if (load_monsters() == false)
-  {
-       log("Error loading monsters");
-       goto end;
-  }
 
+  if (load_masters() == false)
+    {
+      log("Error loading masters");
+      goto end;
+    }
+  
+  if (load_monsters() == false)
+    {
+      log("Error loading monsters");
+      goto end;
+    }
+  
+  if (!load_dragon())
+    {
+      log("Error loading dragon");
+      goto end;
+    }
+  
   if (load_levels() == false)
-  {
-       log("Error loading levels");
-       goto end;
-  }
+    {
+      log("Error loading levels");
+      goto end;
+    }
 
     shuttingdown = false;
 
@@ -131,18 +146,6 @@ int main(int argc, char *argv[])
        currentserver = strtok(NULL, " ");
     }
 
-  boss.name = "Red Dragon";
-  boss.weapon = "Breath of Unholy Fire";
-  boss.strength = 2500;
-  boss.gold = 2000000000;
-  boss.exp = 2000000000;
-  boss.maxhp = 6667;
-  boss.hp = 6667;
-  boss.death = "You finally snuff out the deadly murderous "\
-    "dragon's dark flames. You have freed the land of its terror "\
-    "filled reign from above!";
-
-
  // This loop will retry the connection 3 times
  for (int retry = 0; retry < 3 && !shuttingdown; retry++)
  {
@@ -222,6 +225,12 @@ int main(int argc, char *argv[])
        raw(":%S TOPIC %s :%s", c_Forest, c_ForestTopic);
 #endif
 
+    #ifndef P10
+    if (isUseNickServ())
+    {
+       raw(":%S PRIVMSG %s :IDENTIFY %s", nsname, nspass);
+    }
+    #endif
   sock_gets(sock,buffer,sizeof(buffer)-1); /* -1 added thanks to
     David Duchene <dave@ltd.com> for pointing out the possible
     buffer overflow resulting from the linefeed added below. */
@@ -295,10 +304,11 @@ int main(int argc, char *argv[])
 
            save_gs_dbase();
            saveNews(newsdata, todaysnews);
-
-           // Send notice to the channel of the update
            if (isSavedNotice())
+           {
+               // Send notice to the channel of the update
                notice(s_GameServ, c_Forest, "%S player data saved");
+           }
        }
 
 
@@ -534,7 +544,7 @@ int main(int argc, char *argv[])
            {
                #ifdef DEBUGMODE
                    log("Player %s (IRC: %s) joined %s", 
-                       joiner->stats->name.getString(), 
+                       joiner->stats->name.c_str(), 
                        #ifdef P10
                            joiner->getRealNick(),
                        #else
@@ -585,10 +595,10 @@ int main(int argc, char *argv[])
   end:
 
   save_gs_dbase();
+  save_dragon();
   saveNews(newsdata, todaysnews);
 
   delete_monsters();
-  delete_masters();
 
   #ifdef DEBUGMODE
       log("<CLOSED>");
@@ -677,7 +687,7 @@ aClient *findIRCplayer(const char *nick)
     if (!is_playing(p))
        return NULL;
 
-    unsigned long hv = iHASH((unsigned char *) p->stats->name.getString());
+    unsigned long hv = iHASH((unsigned char *) p->stats->name.c_str());
 
     for (newPtr = players[hv].First(); newPtr; newPtr = newPtr->Next())
     {
@@ -701,7 +711,7 @@ aClient *findplayer(const char *name)
     for (newPtr = players[hv].First(); newPtr; newPtr = newPtr->Next())
     {
        p = newPtr->getData()->stats;
-       if (stricmp(p->name.getString(), name) == 0)
+       if (stricmp(p->name.c_str(), name) == 0)
            return newPtr->getData();
        p = NULL;
     }
@@ -839,14 +849,15 @@ void closeall(int fd)
 
 void prettyIntro()
 {
-cout << endl;
-cout << "  GGGG     AAA   MM    MM EEEEEEE  SSSSS  EEEEEEE RRRRRR  VV     VV " << endl;
-cout << " GG  GG   AAAAA  MMM  MMM EE      SS      EE      RR   RR VV     VV " << endl;
-cout << "GG       AA   AA MM MM MM EEEEE    SSSSS  EEEEE   RRRRRR   VV   VV  " << endl;
-cout << "GG   GGG AAAAAAA MM    MM EE           SS EE      RR  RR    VV VV   " << endl;
-cout << "G     G  AA   AA MM    MM EEEEEEE  SSSSS  EEEEEEE RR   RR    VVV" << endl;
-cout << " GGGGG                                                        V\n\n" << endl;
-cout << "Version: " << VERSION << endl;
+  cout << endl;
+  cout << "  GGGG     AAA   MM    MM EEEEEEE  SSSSS  EEEEEEE RRRRRR  VV     VV " << endl;
+  cout << " GG  GG   AAAAA  MMM  MMM EE      SS      EE      RR   RR VV     VV " << endl;
+  cout << "GG       AA   AA MM MM MM EEEEE    SSSSS  EEEEE   RRRRRR   VV   VV  " << endl;
+  cout << "GG   GGG AAAAAAA MM    MM EE           SS EE      RR  RR    VV VV   " << endl;
+  cout << "G     G  AA   AA MM    MM EEEEEEE  SSSSS  EEEEEEE RR   RR    VVV" << endl;
+  cout << " GGGGG                                                        V\n\n" << endl;
+  cout << "Version: " << VERSION << endl;
+  cout << "http://www.gameserv.us - http://www.sourceforge.net/projects/gameservirc" << endl;
 }
 
 void load_lastrefresh()