]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move ignore functions out of the header to avoid potential inclusion errors
authorMario <mario.mario@y7mail.com>
Thu, 3 Oct 2024 12:38:33 +0000 (12:38 +0000)
committerterencehill <piuntn@gmail.com>
Thu, 3 Oct 2024 12:38:33 +0000 (12:38 +0000)
qcsrc/server/command/cmd.qc
qcsrc/server/command/cmd.qh

index 25a8c1b67676dd0ee5bbb383bea2e36233208689..5bae26bbd9053b74949a5876d6a71e000b2749fd 100644 (file)
 #include <server/teamplay.qh>
 #include <server/world.qh>
 
-// =========================================================
-//  Server side networked commands code, reworked by Samual
-//  Last updated: December 28th, 2011
-// =========================================================
+string ignore_removefromlist(entity list, entity ignore)
+{
+       if(ignore.crypto_idfp && ignore.crypto_idfp != "" && list.crypto_idfp && list.crypto_idfp != "")
+       {
+               for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
+               {
+                       string pos = db_get(ServerProgsDB, strcat("/ignore/", list.crypto_idfp, "/", ftos(j)));
+                       if(pos == ignore.crypto_idfp)
+                       {
+                               db_remove(ServerProgsDB, strcat("/ignore/", list.crypto_idfp, "/", ftos(j)));
+                               return string_null;
+                       }
+               }
+               // should this fall back? we know advanced mode is being used
+       }
 
+       string newlist = "";
+       string theid = ftos(etof(ignore));
+
+       FOREACH_WORD(list.ignore_list, it != theid,
+       {
+               newlist = cons(newlist, it);
+       });
+
+       if(newlist == "")
+               return string_null;
+       else
+               return newlist;
+}
+
+bool ignore_playerinlist(entity sender, entity targ)
+{
+       // TODO: optimize this by saving it to .ignore_list?
+       if(targ.crypto_idfp && targ.crypto_idfp != "" && sender.crypto_idfp && sender.crypto_idfp != "")
+       {
+               string thelist = "";
+               for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
+               {
+                       string pos = db_get(ServerProgsDB, strcat("/ignore/", targ.crypto_idfp, "/", ftos(j)));
+                       thelist = cons(thelist, pos);
+               }
+
+               return ((thelist != "") ? PlayerInList(sender, thelist) : false);
+       }
+       else if(!targ.ignore_list || targ.ignore_list == "")
+               return false;
+
+       string theid = ftos(etof(sender));
+
+       FOREACH_WORD(targ.ignore_list, it == theid,
+       {
+               return true;
+       });
+
+       return false;
+}
+
+void ignore_clearall(entity this)
+{
+       for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
+       {
+               string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
+               if(pos != "")
+                       db_remove(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
+       }
+}
 
 // =======================
 //  Command Sub-Functions
index 25c69491851d54afe4d4d75a21dcaa80a259de62..89a3051ee04cf740b63016daa7d8a076106f08ff 100644 (file)
@@ -1,7 +1,5 @@
 #pragma once
 
-#include <server/world.qh>
-
 float autocvar_sv_clientcommand_antispam_time;
 int autocvar_sv_clientcommand_antispam_count;
 
@@ -16,69 +14,8 @@ string MapVote_Suggest(entity this, string m);
 void ClientCommand_macro_write_aliases(float fh);
 
 // functions for ignore command
-string ignore_removefromlist(entity list, entity ignore)
-{
-       if(ignore.crypto_idfp && ignore.crypto_idfp != "" && list.crypto_idfp && list.crypto_idfp != "")
-       {
-               for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
-               {
-                       string pos = db_get(ServerProgsDB, strcat("/ignore/", list.crypto_idfp, "/", ftos(j)));
-                       if(pos == ignore.crypto_idfp)
-                       {
-                               db_remove(ServerProgsDB, strcat("/ignore/", list.crypto_idfp, "/", ftos(j)));
-                               return string_null;
-                       }
-               }
-               // should this fall back? we know advanced mode is being used
-       }
-
-       string newlist = "";
-       string theid = ftos(etof(ignore));
-
-       FOREACH_WORD(list.ignore_list, it != theid,
-       {
-               newlist = cons(newlist, it);
-       });
-
-       if(newlist == "")
-               return string_null;
-       else
-               return newlist;
-}
-
-bool ignore_playerinlist(entity sender, entity targ)
-{
-       // TODO: optimize this by saving it to .ignore_list?
-       if(targ.crypto_idfp && targ.crypto_idfp != "" && sender.crypto_idfp && sender.crypto_idfp != "")
-       {
-               string thelist = "";
-               for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
-               {
-                       string pos = db_get(ServerProgsDB, strcat("/ignore/", targ.crypto_idfp, "/", ftos(j)));
-                       thelist = cons(thelist, pos);
-               }
-
-               return ((thelist != "") ? PlayerInList(sender, thelist) : false);
-       }
-       else if(!targ.ignore_list || targ.ignore_list == "")
-               return false;
-
-       string theid = ftos(etof(sender));
-
-       FOREACH_WORD(targ.ignore_list, it == theid,
-       {
-               return true;
-       });
+string ignore_removefromlist(entity list, entity ignore);
 
-       return false;
-}
+bool ignore_playerinlist(entity sender, entity targ);
 
-void ignore_clearall(entity this)
-{
-       for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
-       {
-               string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
-               if(pos != "")
-                       db_remove(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
-       }
-}
+void ignore_clearall(entity this);