Patches #1132

Merge in xonotic/xonotic-data.pk3dir.git: terencehill/directmenu_options

Added by git-manager about 2 years ago. Updated over 1 year ago.

Status:ResolvedStart date:03/17/2012
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

Purpose of the branch:

See commit description

Repository: xonotic/xonotic-data.pk3dir.git
Commit: e7e342a0ee00dc5d00d22baf0a1f3f8f0c34564a
Branch: terencehill/directmenu_options

Merge commands:

cd data/xonotic-data.pk3dir
git checkout master
git reset --hard origin/master
git pull && git diff 'e7e342a0ee00dc5d00d22baf0a1f3f8f0c34564a'..'origin/terencehill/directmenu_options'

# please check that the diff you just saw did not contain anything complex that
# needs a new merge request, and review these changes

git merge --no-ff 'origin/terencehill/directmenu_options'

# please make sure this merge worked, and if not, fix merge conflicts and git
# commit BEFORE the next command
#
# also, THIS is the point to do final pre-merge testing
#
# use git reset --hard origin/master to bail out

git push && git push --delete origin 'terencehill/directmenu_options'

Diffstat:

 qcsrc/menu/command/menu_cmd.qc |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

Revision log:

commit e7e342a0ee00dc5d00d22baf0a1f3f8f0c34564a
Author: terencehill <piuntn@gmail.com>
Commit: terencehill <piuntn@gmail.com>

    Show the list of available options for menu_cmd directmenu and menu_cmd directpanelhudmenu (menu_showhudoptions alias) if ran without further arguments

User agreed to the GPLv2+.

Diff:

diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc
index 3be6edc..aa68f2c 100644
--- a/qcsrc/menu/command/menu_cmd.qc
+++ b/qcsrc/menu/command/menu_cmd.qc
@@ -77,18 +77,37 @@ void GameCommand(string theCommand)
         return;
     }

-    if(argv(0) == "directmenu") if(argc == 2)
+    if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
     {
-        // switch to a menu item
-        if(!isdemo()) // don't allow this command in demos
-            m_goto(argv(1));
-        return;
-    }
-
+        string filter;
     if(argv(0) == "directpanelhudmenu")
+            filter = strzone("HUD");
+
+        if(argc == 1)
+        {
+            print(_("Available options:\n"));
+            float i;
+            entity e;
+            string s;
+
+            for(i = 0, e = world; (e = nextent(e)); )
+                if(e.classname != "vtbl" && e.name != "")
+                {
+                    s = e.name;
+                    if(filter)
     {
-        // switch to a menu item
-        m_goto(strcat("HUD", argv(1)));
+                        if(substring(s, 0, strlen(filter)) != filter)
+                            continue;
+                        s = substring(s, strlen(filter), strlen(s) - strlen(filter));
+                    }
+                    print(strcat(" ", s ,"\n"));
+                    ++i;
+                }
+        }
+        else if(argc == 2 && !isdemo()) // don't allow this command in demos
+            m_goto(strcat(filter, argv(1))); // switch to a menu item
+        if(filter)
+            strunzone(filter);
         return;
     }

History

#1 Updated by Samual over 1 year ago

  • Status changed from New to Resolved

Also available in: Atom PDF