[nexuiz-commits] r6560 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Apr 22 11:31:58 EDT 2009
Author: div0
Date: 2009-04-22 11:31:58 -0400 (Wed, 22 Apr 2009)
New Revision: 6560
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/vote.qc
Log:
fix vote parsing: if chmap is allowed, gotomap should be too, and vice versa
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-04-22 11:05:43 UTC (rev 6559)
+++ trunk/data/defaultNexuiz.cfg 2009-04-22 15:31:58 UTC (rev 6560)
@@ -897,21 +897,23 @@
alias vhelp "cmd vote help"
alias vstatus "cmd vote status"
alias vcall "cmd vote call $*"
- alias vmap "vcall gotomap $1"
alias vstop "cmd vote stop"
alias vmaster "cmd vote master"
alias vlogin "cmd vote login $*"
alias vdo "cmd vote do $*"
- alias vdomap "vdo gotomap $1"
alias vyes "cmd vote yes"
alias vno "cmd vote no"
alias vdontcare "cmd vote dontcare"
alias vabstain "cmd vote abstain"
+alias vmap "vcall gotomap $1"
alias vkick "vcall kick $1"
alias vkickban "vcall kickban $1"
alias vend "vcall endmatch"
-alias vmap "vcall chmap $1"
+alias vdomap "vdo gotomap $1"
+alias vdokick "vdo kick $*"
+alias vdokickban "vdo kickban $*"
+alias vdoend "vdo endmatch"
alias lsmaps "cmd lsmaps" // lists all maps on server (for vmap, suggestmap)
bind F1 vyes
Modified: trunk/data/qcsrc/server/vote.qc
===================================================================
--- trunk/data/qcsrc/server/vote.qc 2009-04-22 11:05:43 UTC (rev 6559)
+++ trunk/data/qcsrc/server/vote.qc 2009-04-22 15:31:58 UTC (rev 6560)
@@ -99,9 +99,7 @@
vote_argc = tokenize_sane(vote);
if(!VoteAllowed(argv(0), cmd))
- {
return FALSE;
- }
// VoteAllowed tokenizes!
vote_argc = tokenize_sane(vote);
@@ -415,28 +413,38 @@
return substring(all, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
}
+float VoteCommandInList(string votecommand, string list)
+{
+ string l;
+ l = strcat(" ", list, " ");
+
+ if(strstrofs(l, strcat(" ", votecommand, " ")) >= 0)
+ return TRUE;
+
+ // if gotomap is allowed, chmap is too, and vice versa
+ if(votecommand == "gotomap")
+ if(strstrofs(l, " chmap ") >= 0)
+ return TRUE;
+ if(votecommand == "chmap")
+ if(strstrofs(l, " gotomap ") >= 0)
+ return TRUE;
+}
+
float VoteAllowed(string votecommand, string cmd) {
local float index;
- tokenize_sane(cvar_string("sv_vote_commands"));
- index = 0;
- while(argv(index) != "") {
- if(votecommand == argv(index)) {
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_commands")))
+ return TRUE;
+
+ if(cmd == "vdo")
+ {
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_master_commands")))
return TRUE;
- }
- ++index;
}
-
- if(cmd == "vdo")
- tokenize_sane(cvar_string("sv_vote_master_commands"));
else
- tokenize_sane(cvar_string("sv_vote_only_commands"));
- index = 0;
- while(argv(index) != "") {
- if(votecommand == argv(index)) {
+ {
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_only_commands")))
return TRUE;
- }
- ++index;
}
return FALSE;
More information about the nexuiz-commits
mailing list