Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Kart-Public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
X.organic
Kart-Public
Commits
3db12448
Commit
3db12448
authored
5 years ago
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Add a command to increment cvars
parent
db184928
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/command.c
+23
-0
23 additions, 0 deletions
src/command.c
with
23 additions
and
0 deletions
src/command.c
+
23
−
0
View file @
3db12448
...
...
@@ -50,6 +50,7 @@ static void COM_Exec_f(void);
static
void
COM_Wait_f
(
void
);
static
void
COM_Help_f
(
void
);
static
void
COM_Toggle_f
(
void
);
static
void
COM_Add_f
(
void
);
static
void
CV_EnforceExecVersion
(
void
);
static
boolean
CV_FilterVarByVersion
(
consvar_t
*
v
,
const
char
*
valstr
);
...
...
@@ -291,6 +292,7 @@ void COM_Init(void)
COM_AddCommand
(
"wait"
,
COM_Wait_f
);
COM_AddCommand
(
"help"
,
COM_Help_f
);
COM_AddCommand
(
"toggle"
,
COM_Toggle_f
);
COM_AddCommand
(
"add"
,
COM_Add_f
);
RegisterNetXCmd
(
XD_NETVAR
,
Got_NetVar
);
}
...
...
@@ -855,6 +857,27 @@ static void COM_Toggle_f(void)
CV_AddValue
(
cvar
,
+
1
);
}
/** Command variant of CV_AddValue
*/
static
void
COM_Add_f
(
void
)
{
consvar_t
*
cvar
;
if
(
COM_Argc
()
!=
3
)
{
CONS_Printf
(
M_GetText
(
"Add <cvar_name> <value>: Add to the value of a cvar. Negative values work too!
\n
"
));
return
;
}
cvar
=
CV_FindVar
(
COM_Argv
(
1
));
if
(
!
cvar
)
{
CONS_Alert
(
CONS_NOTICE
,
M_GetText
(
"%s is not a cvar
\n
"
),
COM_Argv
(
1
));
return
;
}
CV_AddValue
(
cvar
,
atoi
(
COM_Argv
(
2
)));
}
// =========================================================================
// VARIABLE SIZE BUFFERS
// =========================================================================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment