]> jfr.im git - irc/gameservirc.git/commitdiff
Added a few more files, updated the makefile
authorkainazzzo <redacted>
Wed, 24 Jan 2007 01:06:52 +0000 (01:06 +0000)
committerkainazzzo <redacted>
Wed, 24 Jan 2007 01:06:52 +0000 (01:06 +0000)
made new dependencies

git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@478 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/.depend
gameserv/Makefile.in
gameserv/do_load.cpp [new file with mode: 0755]
gameserv/do_raw.cpp [new file with mode: 0755]
gameserv/do_save.cpp [new file with mode: 0755]
gameserv/do_shutdown.cpp [new file with mode: 0755]
gameserv/extern.h
gameserv/gameserv.cpp
gameserv/messages.cpp

index 766f3cf951f27c8df696f1e614dfd1a9d6fb7e9c..1d2816899b801e6de1d0fd9292eeb0090fbf2ddb 100644 (file)
@@ -27,10 +27,14 @@ do_inventory.o: do_inventory.cpp extern.h config.h options.h aClient.h \
   player.h script.h flags.h
 do_list.o: do_list.cpp extern.h config.h options.h player.h script.h \
   aClient.h flags.h toplist.h
+do_load.o: do_load.cpp extern.h config.h options.h aClient.h player.h \
+  script.h flags.h
 do_logout.o: do_logout.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
 do_master.o: do_master.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h level.h
+do_raw.o: do_raw.cpp extern.h config.h options.h aClient.h player.h \
+  script.h flags.h
 do_refresh.o: do_refresh.cpp extern.h config.h options.h aClient.h \
   player.h script.h flags.h
 do_register.o: do_register.cpp extern.h config.h options.h aClient.h \
@@ -39,8 +43,12 @@ do_reset.o: do_reset.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
 do_run.o: do_run.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
+do_save.o: do_save.cpp extern.h config.h options.h aClient.h player.h \
+  script.h flags.h
 do_set.o: do_set.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
+do_shutdown.o: do_shutdown.cpp extern.h config.h options.h aClient.h \
+  player.h script.h flags.h
 do_stats.o: do_stats.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
 do_store.o: do_store.cpp extern.h config.h options.h aClient.h player.h \
index 605b14185ec1aab604493b4152c33cc817a8e689..95201789528909d7ce26d1bda38fa124f1e4324b 100644 (file)
@@ -37,13 +37,17 @@ TSRCS =     aClient.cpp \
        do_identify.cpp \
        do_inventory.cpp \
        do_list.cpp \
+       do_load.cpp \
        do_logout.cpp \
        do_master.cpp \
+       do_raw.cpp \
        do_refresh.cpp \
        do_register.cpp \
        do_reset.cpp \
        do_run.cpp \
+       do_save.cpp \
        do_set.cpp \
+       do_shutdown.cpp \
        do_stats.cpp \
        do_store.cpp \
        do_tavern.cpp \
diff --git a/gameserv/do_load.cpp b/gameserv/do_load.cpp
new file mode 100755 (executable)
index 0000000..d422b52
--- /dev/null
@@ -0,0 +1,46 @@
+#include "extern.h"
+#include "aClient.h"
+#include "flags.h"
+#include "options.h"
+
+void do_load(char *u)
+{
+    aClient *user;
+
+    if (!(user = find(u)))
+    {
+      notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+      log("Error: aClient not found: %s", u);
+    }
+    else if (!isAdmin(user))
+    {
+      notice(s_GameServ, u, "You must be a <S admin to use this command!");
+    }
+    else
+    {
+        char *cmd2 = strtok(NULL, " ");
+        if (!cmd2)
+        {
+            notice(s_GameServ, u, "Loading player data from %s", playerdata);
+            load_gs_dbase();
+        }
+        else if (stricmp(cmd2, "MONSTERS") == 0)
+        {
+            notice(s_GameServ, u, "Loading monster data");
+            load_monsters();
+        }
+        else if (stricmp(cmd2, "SCRIPTS") == 0)
+        {
+            // Testing scripts for now
+            script scr;
+            notice(s_GameServ, u, "Loading scripts");
+
+            if (scr.loadScript("test.txt"))
+                scr.executeScript(user->stats);
+        }
+        else
+        {
+            display_help(u, "load");
+        }
+    }
+}
diff --git a/gameserv/do_raw.cpp b/gameserv/do_raw.cpp
new file mode 100755 (executable)
index 0000000..8df3abd
--- /dev/null
@@ -0,0 +1,24 @@
+#include "extern.h"
+#include "aClient.h"
+#include "flags.h"
+#include "options.h"
+
+void do_raw(char *u)
+{
+    aClient *user;
+
+    if (!(user = find(u)))
+    {
+        notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+        log("Error: aClient not found: %s", u);
+    }
+    else if (!isAdmin(user))
+    {
+        notice(s_GameServ, u, "You must be a <S admin to use this command!");
+    }
+    else
+    {
+        char *rest = strtok(NULL, "");
+        raw("%s", rest);
+    }
+}
diff --git a/gameserv/do_save.cpp b/gameserv/do_save.cpp
new file mode 100755 (executable)
index 0000000..c17989f
--- /dev/null
@@ -0,0 +1,23 @@
+#include "extern.h"
+#include "aClient.h"
+#include "flags.h"
+#include "options.h"
+
+void do_save(char *u)
+{
+    aClient *user;
+
+    if (!(user = find(u)))
+    {
+        notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+        log("Error: aClient not found: %s", u);
+    }
+    else if (!isAdmin(user))
+    {
+        notice(s_GameServ, u, "You must be a <S admin to use this command!");
+    }
+    else
+    {
+        save_gs_dbase();
+    }
+}
diff --git a/gameserv/do_shutdown.cpp b/gameserv/do_shutdown.cpp
new file mode 100755 (executable)
index 0000000..90fb1d3
--- /dev/null
@@ -0,0 +1,30 @@
+#include "extern.h"
+#include "aClient.h"
+#include "flags.h"
+#include "options.h"
+
+void do_shutdown(char *u)
+{
+    aClient *user;
+
+    if (!(user = find(u)))
+    {
+        notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+        log("Error: aClient not found: %s", u);
+    }
+    else if (!isAdmin(user))
+    {
+        notice(s_GameServ, u, "You must be a <S admin to use this command!");
+    }
+    else
+    {
+        save_gs_dbase();
+        #ifdef P10
+            raw("[] SQ %s 0 :leaving: %s used the Shutdown command.", 
+                servername, user->getRealNick());
+        #else
+            raw("SQUIT %s :leaving: %s used the Shutdown command.", servername, u);
+        #endif
+        shuttingdown = true;
+    }
+}
index 0e433de58842ec0f7d6d8374293ee0a9e4722402..db2607ee255b38b04c98d3960bfb5194c8153b86 100644 (file)
@@ -168,7 +168,7 @@ E void raw(const char *fmt, ...);
 
 /** news.cpp **/
 E void addNews(list<string> &news, const char *fmt, ...);
-E void do_news(char *u);
+
 E void clearNews(list<string> &news);
 E void loadNews(char *filename, list<string> &news);
 E void saveNews(char *filename, list<string> &news);
@@ -188,14 +188,19 @@ E void do_inventory(char *u);
 E void do_refresh(char *u);
 E void do_register(char *u);
 E void do_list(char *u);
+E void do_load(char *u);
 E void do_logout(char *u);
 E void do_master(char *u);
+E void do_news(char *u);
 E void do_dragon(char *u);
 E void do_play(char *u);
 E void do_quitg(char *u);
+E void do_raw(char *u);
 E void do_reset(char *u);
 E void do_run(char *u);
+E void do_save(char *u);
 E void do_set(char *u);
+E void do_shutdown(char *u);
 E void do_stats(char *u);
 E void do_store(char *u);
 E void do_tavern(char *u);
index d71c7b3d5d6613706dd426b79f3532080563fa61..7a08220c92cd8f9d17a648a7fe598f90e4a7267e 100644 (file)
@@ -182,114 +182,21 @@ void gameserv(char *source, char *buf)
     }
   else if (stricmp(cmd, "SHUTDOWN") == 0)
        {
-         aClient *user;
-         
-         if (!(user = find(source)))
-               {
-                 notice(s_GameServ, source, "Error: aClient not found. Contact a <S admin");
-                 log("Error: aClient not found: %s", source);
-               }
-         else if (!isAdmin(user))
-               {
-                 notice(s_GameServ, source, "You must be a <S admin to use this command!");
-               }
-         else
-               {
-                 save_gs_dbase();
-#ifdef P10
-                 raw("[] SQ %s 0 :leaving: %s used the Shutdown command.", servername, user->getRealNick());
-#else
-                 raw("SQUIT %s :leaving: %s used the Shutdown command.", servername, source);
-#endif
-                 shuttingdown = true;
-               }
+          do_shutdown(source);
     }
   else if (stricmp(cmd, "SAVE") == 0)
        {
-         aClient *user;
-         
-         if (!(user = find(source)))
-               {
-                 notice(s_GameServ, source, "Error: aClient not found. Contact a <S admin");
-                 log("Error: aClient not found: %s", source);
-               }
-         else if (!isAdmin(user))
-               {
-                 notice(s_GameServ, source, "You must be a <S admin to use this command!");
-               }
-         else
-        {
-                 save_gs_dbase();
-        }
+          do_save(source);
     }
   else if (stricmp(cmd, "LOAD") == 0)
        {
-         aClient *user;
-         
-         if (!(user = find(source)))
-               {
-                 notice(s_GameServ, source, "Error: aClient not found. Contact a <S admin");
-                 log("Error: aClient not found: %s", source);
-               }
-         else if (!isAdmin(user))
-               {
-                 notice(s_GameServ, source, "You must be a <S admin to use this command!");
-               }
-         else
-        {
-                 char *cmd2 = strtok(NULL, " ");
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, source, "Loading player data from %s", playerdata);
-                         load_gs_dbase();
-                       }
-                 else if (stricmp(cmd2, "MONSTERS") == 0)
-                       {
-                         notice(s_GameServ, source, "Loading monster data");
-                         load_monsters();
-                       }
-                 else if (stricmp(cmd2, "SCRIPTS") == 0)
-                       {
-                         // Testing scripts for now
-                         script scr;
-                         notice(s_GameServ, source, "Loading scripts");
-
-                         if (scr.loadScript("test.txt"))
-                               scr.executeScript(user->stats);
-                       }
-                 else
-                       {
-                         display_help(source, cmd);
-                       }
-               }
+          do_load(source);
        }
 #ifdef DEBUGMODE
   else if (stricmp(cmd, "RAW") == 0)
        {
-         aClient *user;
-         
-         if (!(user = find(source)))
-               {
-                 notice(s_GameServ, source, "Error: aClient not found. Contact a <S admin");
-                 log("Error: aClient not found: %s", source);
-               }
-         else if (!isAdmin(user))
-               {
-                 notice(s_GameServ, source, "You must be a <S admin to use this command!");
-               }
-         else
-        {
-                 char *rest = strtok(NULL, "");
-                 raw("%s", rest);
-               }
+          do_raw(source);
     }
-  else if (stricmp(cmd, "RANDOM") == 0)
-       {
-         char *rstr = strtok(NULL, "");
-         range trange;
-         trange.setRange(rstr);
-         notice(s_GameServ, source, "Random number in that range: %d", trange.random());
-       }
 #endif
   else
        {
@@ -310,7 +217,7 @@ void gameserv(char *source, char *buf)
     }
 
 #ifndef P10
-  source--;  // Bring the ':' back so we don't leak memory
+  source--;  // Bring the ':' back 
 #endif
   if (z == ':')
        cmd--;     // Same thing :)
index e996471929d48f923339460f7f72757549be0276..1148e12c4d81cc862b0a90253a987ecef9921688 100644 (file)
@@ -341,7 +341,8 @@ void display_help(char *u, char *file)
                  notice(s_GameServ, u, buf);
                }
          
-         // Minor recursion
+         // Minor recursion - as long as admin_commands exists, it won't loop
+          // continuously
          aClient *user = find(u);
          if (user && isAdmin(user))
            display_help(u, "admin_commands");