X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/821ea0a0d0af9a664faaa7ea119dd490d8c2e78e..279c8777c7d1c2fa93ef600fed18bb2de9d0b137:/gameserv/news.cpp diff --git a/gameserv/news.cpp b/gameserv/news.cpp index 3aff621..ab51e6d 100644 --- a/gameserv/news.cpp +++ b/gameserv/news.cpp @@ -1,18 +1,21 @@ #include "extern.h" #include +#include #include using std::ofstream; using std::ifstream; -List todaysnews; -void addNews(List &news, const char *fmt, ...); -void clearNews(List &news) {news.deleteNodes();}; -void showNews(char *nick, List &news); -void saveNews(char *filename, List &news); -void loadNews(char *filename, List &news); +using namespace std; -void addNews(List &news, const char *fmt, ...) +List todaysnews; +void addNews(List &news, const char *fmt, ...); +void clearNews(List &news) {news.deleteNodes();}; +void showNews(char *nick, List &news); +void saveNews(char *filename, List &news); +void loadNews(char *filename, List &news); + +void addNews(List &news, const char *fmt, ...) { if (fmt[0] == '\0') return; @@ -48,8 +51,9 @@ void addNews(List &news, const char *fmt, ...) log("New News Item: %s", input); #endif - myString *nstring; - nstring = new myString(input); + notice(s_GameServ, c_Forest, "News Flash: %s", input); + string *nstring; + nstring = new string(input); news.insertAtBack(nstring); delete [] input; @@ -58,24 +62,24 @@ void addNews(List &news, const char *fmt, ...) va_end(args); } -void showNews(char *nick, List &news) +void showNews(char *nick, List &news) { if (!news.isEmpty()) { - ListNode *it; + ListNode *it; it = news.First(); notice(s_GameServ, nick, "The Daily Happenings: "); while (it) { - notice(s_GameServ, nick, "%s", it->getData()->getString()); + notice(s_GameServ, nick, "%s", it->getData()->c_str()); it = it->Next(); } notice(s_GameServ, nick, "End of News"); } } -void saveNews(char *filename, List &news) +void saveNews(char *filename, List &news) { ofstream outfile; outfile.open(filename); @@ -86,20 +90,20 @@ void saveNews(char *filename, List &news) return; } - ListNode *it; + ListNode *it; it = news.First(); while (it) { - outfile << it->getData()->getString() << endl; + outfile << it->getData()->c_str() << endl; it = it->Next(); } outfile.close(); } -void loadNews(char *filename, List &news) +void loadNews(char *filename, List &news) { // First clear the old news out - ListNode *it, *temp; + ListNode *it, *temp; it = news.First(); while (it) @@ -119,7 +123,7 @@ void loadNews(char *filename, List &news) } char *buf; - myString *string; + string *str; buf = new char [1024]; while (infile.getline(buf, 1024, '\n')) @@ -129,9 +133,9 @@ void loadNews(char *filename, List &news) delete [] buf; return; } - string = new myString(buf); - news.insertAtBack(string); - delete string; + str = new string(buf); + news.insertAtBack(str); + delete str; } delete [] buf;