]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/news.cpp
Finally got level.h/cpp compiling into the project... beginning to store
[irc/gameservirc.git] / gameserv / news.cpp
index fa7fdb8ba8d4ac28e5d804e53624705a92c47c4c..57b7c561e1e3417edad4b206d089268f414c951b 100644 (file)
@@ -1,5 +1,6 @@
 #include "extern.h"
 #include <fstream>
+#include <stdio.h>
 
 using std::ofstream;
 using std::ifstream;
@@ -47,6 +48,7 @@ void addNews(List<myString> &news, const char *fmt, ...)
         log("New News Item: %s", input);
     #endif
 
+    notice(s_GameServ, c_Forest, "News Flash: %s", input);
     myString *nstring;
     nstring = new myString(input);
     news.insertAtBack(nstring);
@@ -78,14 +80,13 @@ void saveNews(char *filename, List<myString> &news)
 {
     ofstream outfile;
     outfile.open(filename);
+
     if (outfile.fail())
     {
        log("Error opening %s", filename);
        return;
     }
 
-    outfile << "";
-
     ListNode<myString> *it;
     it = news.First();
     while (it)
@@ -124,6 +125,11 @@ void loadNews(char *filename, List<myString> &news)
 
     while (infile.getline(buf, 1024, '\n'))
     {
+       if (buf[0] == '\0' || buf[0] == '\n')
+       {
+           delete [] buf;
+           return;
+       }
        string = new myString(buf);
        news.insertAtBack(string);
        delete string;