Overhaul to console structure, a bit

This commit is contained in:
iikorni
2026-08-30 00:50:23 -05:00
parent de75b014b3
commit 216dd1aecd
70 changed files with 2081 additions and 2260 deletions
+13 -13
View File
@@ -61,7 +61,7 @@ void Cvar_List_f() {
if (partial && std::strncmp(partial, name.c_str(), len) != 0) {
continue;
}
Con_SafePrintf("%s%s %s \"%s\"\n",
console::safe_print("%s%s %s \"%s\"\n",
var->flags.archive ? "*" : " ",
var->flags.notify ? "s" : " ",
name.c_str(),
@@ -69,11 +69,11 @@ void Cvar_List_f() {
count++;
}
Con_SafePrintf("%i cvars", count);
console::safe_print("%i cvars", count);
if (partial) {
Con_SafePrintf(" beginning with \"%s\"", partial);
console::safe_print(" beginning with \"%s\"", partial);
}
Con_SafePrintf("\n");
console::safe_print("\n");
}
/*
@@ -85,7 +85,7 @@ void Cvar_Inc_f(void) {
switch (command::argc()) {
default:
case 1:
Con_Printf("inc <cvar> [amount] : increment cvar\n");
console::info("inc <cvar> [amount] : increment cvar\n");
break;
case 2:
convar::set_value(*command::argv(1), convar::variable_value(*command::argv(1)).value_or(0.0) + 1);
@@ -105,7 +105,7 @@ void Cvar_Toggle_f() {
switch (command::argc()) {
default:
case 1:
Con_Printf("toggle <cvar> : toggle cvar\n");
console::info("toggle <cvar> : toggle cvar\n");
break;
case 2:
if (convar::variable_value(*command::argv(1)).value_or(0.0) != 0.0)
@@ -125,7 +125,7 @@ void Cvar_Cycle_f() {
int i;
if (command::argc() < 3) {
Con_Printf("cycle <cvar> <value list>: cycle cvar through a list of values\n");
console::info("cycle <cvar> <value list>: cycle cvar through a list of values\n");
return;
}
@@ -162,7 +162,7 @@ void Cvar_Reset_f() {
switch (command::argc()) {
default:
case 1:
Con_Printf("reset <cvar> : reset cvar to default\n");
console::info("reset <cvar> : reset cvar to default\n");
break;
case 2:
convar::reset(*command::argv(1));
@@ -320,7 +320,7 @@ std::optional<std::string_view> convar::complete_variable(const std::string_view
*/
void convar::reset(const std::string &name) {
if (const auto var = find_var(name); !var.has_value())
Con_Printf("variable \"%s\" not found\n", name.c_str());
console::info("variable \"%s\" not found\n", name.c_str());
else
var.value()->set(var.value()->default_string);
}
@@ -390,7 +390,7 @@ void convar::set(const std::string &name, const std::string &value) {
const auto var = find_var(name);
if (!var.has_value()) {
// there is an error in C code if this happens
Con_Printf("Cvar_Set: variable %s not found\n", name.c_str());
console::info("Cvar_Set: variable %s not found\n", name.c_str());
return;
}
@@ -460,13 +460,13 @@ void convar::inscribe() {
// first check to see if it has already been defined
if (find_var(this->name)) {
Con_Printf("Can't register variable %s, already defined\n", this->name.c_str());
console::info("Can't register variable %s, already defined\n", this->name.c_str());
return;
}
// check for overlap with a command
if (command::exists(this->name)) {
Con_Printf("Cvar_RegisterVariable: %s is a command\n", this->name.c_str());
console::info("Cvar_RegisterVariable: %s is a command\n", this->name.c_str());
return;
}
@@ -515,7 +515,7 @@ bool Cvar_Command() {
// perform a variable print or set
if (command::argc() == 1) {
Con_Printf("\"%s\" is \"%s\"\n", var.value()->name.c_str(), var.value()->string);
console::info("\"%s\" is \"%s\"\n", var.value()->name.c_str(), var.value()->string);
return true;
}