From 5ad50c7bcd1879d743b6624b6457c2a51b4c73a2 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 17 Dec 2004 17:56:33 +0000 Subject: [PATCH] fix DConfig warnings when PRC_SAVE_DESCRIPTIONS is not defined --- dtool/src/dconfig/dconfig.h | 13 +++++++------ dtool/src/prc/configFlags.h | 5 +++++ dtool/src/prc/configVariableCore.cxx | 26 +++++++++++++------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/dtool/src/dconfig/dconfig.h b/dtool/src/dconfig/dconfig.h index 42074b1f3d..27701222ee 100644 --- a/dtool/src/dconfig/dconfig.h +++ b/dtool/src/dconfig/dconfig.h @@ -30,6 +30,7 @@ #include "configVariableInt.h" #include "configVariableDouble.h" #include "configVariableList.h" +#include "configFlags.h" #include #include @@ -157,7 +158,7 @@ ConfigTable::Symbol& Config::GetAll(const ConfigString sym, ConfigTable::Symbol& s) { Init(); - ConfigVariableList var(sym, "DConfig"); + ConfigVariableList var(sym, "DConfig", ConfigFlags::F_dconfig); int num_values = var.get_num_values(); for (int i = 0; i < num_values; i++) { @@ -172,7 +173,7 @@ template bool Config::GetBool(const ConfigString sym, bool def) { Init(); - ConfigVariableBool var(sym, def, "DConfig"); + ConfigVariableBool var(sym, def, "DConfig", ConfigFlags::F_dconfig); return var.get_value(); } @@ -180,7 +181,7 @@ template int Config::GetInt(const ConfigString sym, int def) { Init(); - ConfigVariableInt var(sym, def, "DConfig"); + ConfigVariableInt var(sym, def, "DConfig", ConfigFlags::F_dconfig); return var.get_value(); } @@ -188,7 +189,7 @@ template float Config::GetFloat(const ConfigString sym, float def) { Init(); - ConfigVariableDouble var(sym, def, "DConfig"); + ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig); return var.get_value(); } @@ -196,7 +197,7 @@ template double Config::GetDouble(const ConfigString sym, double def) { Init(); - ConfigVariableDouble var(sym, def, "DConfig"); + ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig); return var.get_value(); } @@ -205,7 +206,7 @@ ConfigString Config::GetString(const ConfigString sym, const ConfigString def) { Init(); - ConfigVariableString var(sym, def, "DConfig"); + ConfigVariableString var(sym, def, "DConfig", ConfigFlags::F_dconfig); return var.get_value(); } diff --git a/dtool/src/prc/configFlags.h b/dtool/src/prc/configFlags.h index 742a99cebf..200b746f56 100644 --- a/dtool/src/prc/configFlags.h +++ b/dtool/src/prc/configFlags.h @@ -54,6 +54,11 @@ PUBLISHED: // (possibly from a very large pool) and should not be included in // the normal list of variable names. F_dynamic = 0x00004000, + + // F_dconfig means that the variable was constructed from the + // legacy DConfig system, rather than directly by the user. You + // shouldn't pass this in directly. + F_dconfig = 0x00008000, }; }; diff --git a/dtool/src/prc/configVariableCore.cxx b/dtool/src/prc/configVariableCore.cxx index 43cb14e532..136d69f296 100644 --- a/dtool/src/prc/configVariableCore.cxx +++ b/dtool/src/prc/configVariableCore.cxx @@ -95,11 +95,11 @@ ConfigVariableCore:: void ConfigVariableCore:: set_value_type(ConfigVariableCore::ValueType value_type) { if (_value_queried && _value_type != value_type) { - if (_description == "DConfig") { - // As a special exception, if the current description is - // "DConfig", we don't report a warning for changing the type, - // assuming the variable is being defined through the older - // DConfig interface. + if ((_flags & F_dconfig) != 0) { + // As a special exception, if the flags include F_dconfig, we + // don't report a warning for changing the type, assuming the + // variable is being defined through the older DConfig + // interface. } else { prc_cat->warning() @@ -147,9 +147,9 @@ set_flags(int flags) { void ConfigVariableCore:: set_description(const string &description) { if (_value_queried && _description != description) { - if (description == "DConfig") { - // As a special exception, if the new description is "DConfig", - // we don't change it, since this is presumably coming from the + if ((_flags & F_dconfig) != 0) { + // As a special exception, if the flags include F_dconfig, we + // don't change it, since this is presumably coming from the // older DConfig interface. return; } @@ -179,11 +179,11 @@ set_default_value(const string &default_value) { // Modifying an existing default value. if (_default_value->get_string_value() != default_value) { - if (_description == "DConfig") { - // As a special exception, if the current description is - // "DConfig", we don't report a warning for changing the - // default value, assuming the variable is being defined - // through the older DConfig interface. + if ((_flags & F_dconfig) != 0) { + // As a special exception, if the flags include F_dconfig, we + // don't report a warning for changing the default value, + // assuming the variable is being defined through the older + // DConfig interface. } else { prc_cat->warning()