]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an item dumping command
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 13 May 2015 00:54:31 +0000 (10:54 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 13 May 2015 00:54:31 +0000 (10:54 +1000)
qcsrc/common/command/generic.qc
qcsrc/common/items/all.qc
qcsrc/common/items/all.qh
qcsrc/common/items/item/buff.qh
qcsrc/common/items/item/pickup.qh

index f0b6d0de5aecf72f81231100431fbc908a0fb037..6aa93a024ed209475f9a4b5d673e4654b46312a5 100644 (file)
@@ -241,6 +241,25 @@ void GenericCommand_dumpcommands(float request)
        }
 }
 
+void GenericCommand_dumpitems(float request)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       Dump_Items();
+                       return;
+               }
+
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       printf("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+                       return;
+               }
+       }
+}
+
 void GenericCommand_dumpnotifs(float request)
 {
        switch(request)
@@ -651,6 +670,7 @@ void GenericCommand_(float request)
 #define GENERIC_COMMANDS(request,arguments,command) \
        GENERIC_COMMAND("addtolist", GenericCommand_addtolist(request, arguments), "Add a string to a cvar") \
        GENERIC_COMMAND("dumpcommands", GenericCommand_dumpcommands(request), "Dump all commands on the program to *_cmd_dump.txt") \
+       GENERIC_COMMAND("dumpitems", GenericCommand_dumpitems(request), "Dump all items to the console") \
        GENERIC_COMMAND("dumpnotifs", GenericCommand_dumpnotifs(request), "Dump all notifications into notifications_dump.txt") \
        GENERIC_COMMAND("dumpweapons", GenericCommand_dumpweapons(request), "Dump all weapons into weapons_dump.txt") \
        GENERIC_COMMAND("maplist", GenericCommand_maplist(request, arguments), "Automatic control of maplist") \
index 37cd93b3fc62df7b702dc6b497c754972c1112cc..fa198bb8328b709f090c035663e896fd62b4f0c1 100644 (file)
@@ -4,10 +4,9 @@
 
 #include "all.inc"
 
-void ItemTest()
+void Dump_Items()
 {
-    ITEMS_FOREACH(it != NULL, LAMBDA({
-        print(strcat(etos(it), "\n"));
+    ITEMS_FOREACH(true, LAMBDA({
         ITEM_HANDLE(Show, it);
     }));
 }
index 74ca110ef114b0371539d28331bf2d51fa16ebda..7290b95a90f1c26c3509198193b8bdb98b4d3060 100644 (file)
@@ -12,7 +12,7 @@ entity ITEMS[MAX_ITEMS];
 } while(0)
 
 void RegisterItems();
-void ItemTest();
+void Dump_Items();
 
 #ifdef CSQC
 void ReadItems()
index 458b35e3c2b97f7a403b0146ac2c40878caec7b1..4ad93cb5f9996ccd8e44d8498c0b3c33cba4dbe6 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef BUFF_H
 #define BUFF_H
-#include "../item.qh"
-CLASS(Buff, GameItem)
-    METHOD(Buff, show, void(entity this))
-    void Buff_show(entity this) { print("%s\n", "Buff"); }
+#include "pickup.qh"
+CLASS(Buff, Pickup)
+    ATTRIB(Buff, m_name, string, "Buff")
 ENDCLASS(Buff)
 #endif
index a391d6861d5f49a8d8f06c5d3f2661fdc2772519..47788f3aaef389f1a7fc0396e0bf7a99030a211c 100644 (file)
@@ -6,7 +6,7 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
     ATTRIB(Pickup, m_name, string, string_null)
     METHOD(Pickup, show, void(entity this))
-    void Pickup_show(entity this) { printf("%s\n", this.m_name); }
+    void Pickup_show(entity this) { printf("%s: %s\n", etos(this), this.m_name); }
 #ifdef SVQC
     ATTRIB(Pickup, m_botvalue, int, 0)
     ATTRIB(Pickup, m_itemflags, int, 0)