Browse Source

use new config interface

David Rose 21 years ago
parent
commit
ef75b6751a

+ 17 - 10
direct/src/distributed/config_distributed.cxx

@@ -26,16 +26,23 @@ ConfigureFn(config_distributed) {
   init_libdistributed();
   init_libdistributed();
 }
 }
 
 
-// This represents the amount of time to block waiting for the TCP
-// connection to the game server.  It is only used when the connection
-// method is NSPR.
-const int game_server_timeout_ms = config_distributed.GetInt("game-server-timeout-ms", 20000);
-
-// These represent the time in seconds by which to artificially lag
-// inbound messages.  It is only used when the connection method is
-// NSPR.
-const double min_lag = config_distributed.GetDouble("min-lag", 0.0);
-const double max_lag = config_distributed.GetDouble("max-lag", 0.0);
+ConfigVariableInt game_server_timeout_ms
+("game-server-timeout-ms", 20000,
+ PRC_DESC("This represents the amount of time to block waiting for the TCP "
+          "connection to the game server.  It is only used when the connection "
+          "method is NSPR."));
+
+ConfigVariableDouble min_lag
+("min-lag", 0.0,
+ PRC_DESC("This represents the time in seconds by which to artificially lag "
+          "inbound messages.  It is only used when the connection method is "
+          "NSPR."));
+
+ConfigVariableDouble max_lag
+("max-lag", 0.0,
+ PRC_DESC("This represents the time in seconds by which to artificially lag "
+          "inbound messages.  It is only used when the connection method is "
+          "NSPR."));
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libdistributed
 //     Function: init_libdistributed

+ 5 - 3
direct/src/distributed/config_distributed.h

@@ -22,12 +22,14 @@
 #include "directbase.h"
 #include "directbase.h"
 #include "notifyCategoryProxy.h"
 #include "notifyCategoryProxy.h"
 #include "dconfig.h"
 #include "dconfig.h"
+#include "configVariableInt.h"
+#include "configVariableDouble.h"
 
 
 NotifyCategoryDecl(distributed, EXPCL_DIRECT, EXPTP_DIRECT);
 NotifyCategoryDecl(distributed, EXPCL_DIRECT, EXPTP_DIRECT);
 
 
-extern const int game_server_timeout_ms;
-extern const double min_lag;
-extern const double max_lag;
+extern ConfigVariableInt game_server_timeout_ms;
+extern ConfigVariableDouble min_lag;
+extern ConfigVariableDouble max_lag;
 
 
 extern EXPCL_DIRECT void init_libdistributed();
 extern EXPCL_DIRECT void init_libdistributed();
 
 

+ 9 - 6
direct/src/interval/config_interval.cxx

@@ -35,13 +35,16 @@ ConfigureFn(config_interval) {
   init_libinterval();
   init_libinterval();
 }
 }
 
 
-// Set this to the default value for set_precision() for each
-// CMetaInterval created.
-const double interval_precision = config_interval.GetDouble("interval-precision", 1000.0);
+ConfigVariableDouble interval_precision
+("interval-precision", 1000.0,
+ PRC_DESC("Set this to the default value for set_precision() for each "
+          "CMetaInterval created."));
+
+ConfigVariableBool verify_intervals
+("verify-intervals", false,
+ PRC_DESC("Set this true to generate an assertion failure if interval "
+          "functions are called out-of-order."));
 
 
-// Set this true to generate an assertion failure if interval
-// functions are called out-of-order.
-const bool verify_intervals = config_interval.GetBool("verify-intervals", false);
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libinterval
 //     Function: init_libinterval

+ 4 - 2
direct/src/interval/config_interval.h

@@ -22,11 +22,13 @@
 #include "directbase.h"
 #include "directbase.h"
 #include "notifyCategoryProxy.h"
 #include "notifyCategoryProxy.h"
 #include "dconfig.h"
 #include "dconfig.h"
+#include "configVariableDouble.h"
+#include "configVariableBool.h"
 
 
 NotifyCategoryDecl(interval, EXPCL_DIRECT, EXPTP_DIRECT);
 NotifyCategoryDecl(interval, EXPCL_DIRECT, EXPTP_DIRECT);
 
 
-extern const double interval_precision;
-extern const bool verify_intervals;
+extern ConfigVariableDouble interval_precision;
+extern ConfigVariableBool verify_intervals;
 
 
 extern EXPCL_DIRECT void init_libinterval();
 extern EXPCL_DIRECT void init_libinterval();