From: kainazzzo Date: Thu, 20 May 2004 01:07:40 +0000 (+0000) Subject: Introduced the new mystring clas and attempted to use it in a list X-Git-Url: https://jfr.im/git/irc/gameservirc.git/commitdiff_plain/87137def8d91782b11cf72a10b4295b0b53372c3?hp=cf1a7ee3f6e31f99020df427ca414ac1f4317139 Introduced the new mystring clas and attempted to use it in a list git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@221 bc333340-6410-0410-a689-9d09f3c113fa --- diff --git a/gameserv/.depend b/gameserv/.depend index 8dcdd05..049e310 100644 --- a/gameserv/.depend +++ b/gameserv/.depend @@ -8,7 +8,6 @@ gameserv.o: gameserv.cpp aClient.h options.h player.h pouch.h config.h \ extern.h list.h listnode.h flags.h myString.h sockhelp.h log.o: log.cpp extern.h player.h aClient.h options.h pouch.h list.h \ listnode.h config.h -myString.o: myString.cpp myString.h player.o: player.cpp player.h aClient.h options.h pouch.h extern.h list.h \ listnode.h config.h flags.h sockhelp.o: sockhelp.cpp sockhelp.h extern.h player.h aClient.h options.h \ diff --git a/gameserv/TODO b/gameserv/TODO index 390db41..5d22699 100644 --- a/gameserv/TODO +++ b/gameserv/TODO @@ -1,10 +1,12 @@ -* = Not finished +* = Not Started - = Started X = Finsihed +- Daily news (murders, kidnappings, level gains, red dragon slayings) + * Add a function to check how long until gameserv refreshes -- Gangs of people that can get together and fight other gangs in large +* Gangs of people that can get together and fight other gangs in large group battles - gang names - gangs.dat file with numbers assigned to gangs @@ -21,8 +23,6 @@ X = Finsihed * Change your name for a price :) -* Daily news (murders, kidnappings, level gains, red dragon slayings) - * Add a drop command for all(their own nick)/admin(any nick) * Rejoin the bot if kicked/killed diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index 92fd917..d7a0f31 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -3,6 +3,7 @@ #include "extern.h" #include "flags.h" #include "list.h" +#include "myString.h" #include "sockhelp.h" #include @@ -224,6 +225,16 @@ void gameserv(char *source, char *buf) do_tavern(source); } else if (stricmp(cmd, "LIST") == 0) { do_list(source); + #ifdef DEBUGMODE + } else if (stricmp(cmd, "PRINT") == 0) { + List news; + myString *st; + st = new myString("This is a test"); + cout << news.insertAtBack_RLN(st)->getData() << endl; + cout << st << endl; + news.print(); + delete st; + #endif } else if (stricmp(cmd, "LOGOUT") == 0) { do_logout(source); } else if (stricmp(cmd, "REGISTER") == 0) { diff --git a/gameserv/list.h b/gameserv/list.h index 4053e4a..838f895 100644 --- a/gameserv/list.h +++ b/gameserv/list.h @@ -206,12 +206,15 @@ void List::print() const currentPtr = firstPtr; while (currentPtr) { + /* cout << "aClient: " << *currentPtr->getData() << flush; if (currentPtr->getData()->stats) cout << " Player Name: " << currentPtr->getData()->stats->name << " Password: " << currentPtr->getData()->stats->password << flush; cout << endl; + */ + cout << currentPtr->getData()->getString() << endl; currentPtr = currentPtr->next; } } diff --git a/gameserv/myString.cpp b/gameserv/myString.cpp index ca2e5bd..ff2b9c6 100644 --- a/gameserv/myString.cpp +++ b/gameserv/myString.cpp @@ -17,7 +17,10 @@ void myString::setString(char *s) { if (!s) { - ~myString(); + if (string) + delete [] string; + + string = NULL; } else { diff --git a/gameserv/myString.h b/gameserv/myString.h index fb4660d..dba9252 100644 --- a/gameserv/myString.h +++ b/gameserv/myString.h @@ -1,5 +1,6 @@ #ifndef MYSTRING_H #define MYSTRING_H +#include class myString { public: @@ -8,6 +9,7 @@ public: void setString(char *s); char *getString() { return string; }; unsigned int len() { return strlen(string); }; + bool isNULL() { return string == NULL; }; private: char *string; diff --git a/gameserv/tcpclient.cpp b/gameserv/tcpclient.cpp index 939e68f..dd56aaf 100644 --- a/gameserv/tcpclient.cpp +++ b/gameserv/tcpclient.cpp @@ -97,11 +97,13 @@ int main(int argc, char *argv[]) delete []conf; // Turn into a daemon + if (daemon(1,0) < 0) { perror("Could not turn into a daemon"); exit(3); } + init_masters(); load_gs_dbase();