Browse Source

*** empty log message ***

David Rose 24 years ago
parent
commit
28d9163810

+ 8 - 12
panda/src/framework/framework.cxx

@@ -411,10 +411,10 @@ void event_esc(CPT_Event) {
   rib_pipe = NULL;
   rib_win = NULL;
 
-#if defined(HAVE_NET) && defined(DO_PSTATS)
-  if (PStatClient::get_global_pstats()->is_connected()) {
+#ifdef DO_PSTATS
+  if (PStatClient::is_connected()) {
     framework_cat.info() << "Disconnecting from stats host" << endl;
-    PStatClient::get_global_pstats()->disconnect();
+    PStatClient::disconnect();
   }
 #endif
 
@@ -439,23 +439,19 @@ void event_f(CPT_Event) {
 }
 
 void event_S(CPT_Event) {
-#ifndef DO_PSTATS
-  framework_cat.error() << "demo not compiled with PStats support." << endl;
-#elif defined(HAVE_NET)
+#ifdef DO_PSTATS
   framework_cat.info() << "Connecting to stats host" << endl;
-  PStatClient::get_global_pstats()->connect();
+  PStatClient::connect();
 #else
   framework_cat.error() << "Stats host not supported." << endl;
 #endif
 }
 
 void event_A(CPT_Event) {
-#ifndef DO_PSTATS
-  framework_cat.error() << "demo not compiled with PStats support." << endl;
-#elif defined(HAVE_NET)
-  if (PStatClient::get_global_pstats()->is_connected()) {
+#ifdef DO_PSTATS
+  if (PStatClient::is_connected()) {
     framework_cat.info() << "Disconnecting from stats host" << endl;
-    PStatClient::get_global_pstats()->disconnect();
+    PStatClient::disconnect();
   } else {
     framework_cat.error() << "Stats host is already disconnected." << endl;
   }

+ 33 - 0
panda/src/pstatclient/pStatClient.I

@@ -57,3 +57,36 @@ INLINE double PStatClient::
 get_max_rate() const {
   return _max_rate;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatClient::connect
+//       Access: Published
+//  Description: Attempts to establish a connection to the indicated
+//               PStatServer.  Returns true if successful, false on
+//               failure.
+////////////////////////////////////////////////////////////////////
+INLINE bool PStatClient::
+connect(string hostname, int port) {
+  return get_global_pstats()->connect(hostname, port);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatClient::disconnect
+//       Access: Published
+//  Description: Closes the connection previously established.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatClient::
+disconnect() {
+  get_global_pstats()->disconnect();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatClient::is_connected
+//       Access: Published
+//  Description: Returns true if the client believes it is connected
+//               to a working PStatServer, false otherwise.
+////////////////////////////////////////////////////////////////////
+INLINE bool PStatClient::
+is_connected() {
+  return get_global_pstats()->is_connected();
+}

+ 12 - 15
panda/src/pstatclient/pStatClient.cxx

@@ -368,15 +368,13 @@ get_global_pstats() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: PStatClient::connect
-//       Access: Public
-//  Description: Attempts to establish a connection to the indicated
-//               PStatServer.  Returns true if successful, false on
-//               failure.
+//     Function: PStatClient::ns_connect
+//       Access: Private
+//  Description: The nonstatic implementation of connect().
 ////////////////////////////////////////////////////////////////////
 bool PStatClient::
-connect(string hostname, int port) {
-  disconnect();
+ns_connect(string hostname, int port) {
+  ns_disconnect();
 
   if (hostname.empty()) {
     hostname = pstats_host;
@@ -411,12 +409,12 @@ connect(string hostname, int port) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: PStatClient::disconnect
-//       Access: Public
-//  Description: Closes the connection previously established.
+//     Function: PStatClient::ns_disconnect
+//       Access: Private
+//  Description: The nonstatic implementation of disconnect().
 ////////////////////////////////////////////////////////////////////
 void PStatClient::
-disconnect() {
+ns_disconnect() {
   if (_is_connected) {
     _reader.remove_connection(_tcp_connection);
     close_connection(_tcp_connection);
@@ -452,13 +450,12 @@ disconnect() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: PStatClient::is_connected
+//     Function: PStatClient::ns_is_connected
 //       Access: Public
-//  Description: Returns true if the client believes it is connected
-//               to a working PStatServer, false otherwise.
+//  Description: The nonstatic implementation of is_connected().
 ////////////////////////////////////////////////////////////////////
 bool PStatClient::
-is_connected() const {
+ns_is_connected() const {
   return _is_connected;
 }
 

+ 8 - 5
panda/src/pstatclient/pStatClient.h

@@ -60,15 +60,18 @@ public:
   PStatThread get_main_thread() const;
 
   static void main_tick();
-
-PUBLISHED:
   static PStatClient *get_global_pstats();
 
-  bool connect(string hostname = string(), int port = -1);
-  void disconnect();
-  bool is_connected() const;
+PUBLISHED:
+  INLINE static bool connect(string hostname = string(), int port = -1);
+  INLINE static void disconnect();
+  INLINE static bool is_connected();
 
 private:
+  bool ns_connect(string hostname, int port);
+  void ns_disconnect();
+  bool ns_is_connected() const;
+
   PStatCollector make_collector(int parent_index, string fullname);
   PStatCollector make_collector(int parent_index, const string &fullname,
 				const RGBColorf &suggested_color, int sort);

+ 2 - 2
pandatool/src/egg-palettize/eggFile.cxx

@@ -328,8 +328,8 @@ choose_placements() {
       // which also happen to include the texture.  It better not be
       // empty.
       if (groups.empty()) {
-	nout << "Warning!  Egg file " << get_name() << ", referencing texture "
-	     << *reference << ", does not have any groups in common.\n"
+	nout << "Warning!  Egg file " << get_name() << " and texture "
+	     << *reference << " do not have any groups in common.\n"
 	     << "Egg groups:\n";
 	get_complete_groups().write(nout, 2);
 	nout << "Texture groups:\n";

+ 1 - 1
pandatool/src/egg-palettize/textureReference.cxx

@@ -329,7 +329,7 @@ update_egg() {
 ////////////////////////////////////////////////////////////////////
 void TextureReference::
 output(ostream &out) const {
-  out << *_source_texture << "\n";
+  out << *_source_texture;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 10 - 3
pandatool/src/pstatserver/pStatThreadData.cxx

@@ -213,13 +213,20 @@ get_latest_frame() const {
 ////////////////////////////////////////////////////////////////////
 double PStatThreadData::
 get_frame_rate(double time) const {
-  nassertr(!_frames.empty(), 0.0);
+  if (_frames.empty()) {
+    // No frames in the data at all; nothing to base the frame rate
+    // on.
+    return 0.0;
+  }
 
   int now_i = _frames.size() - 1;
   while (now_i > 0 && _frames[now_i] == (PStatFrameData *)NULL) {
     now_i--;
   }
-  nassertr(now_i >= 0, 0.0);
+  if (now_i < 0) {
+    // No frames have any real data.
+    return 0.0;
+  }
   nassertr(_frames[now_i] != (PStatFrameData *)NULL, 0.0);
 
   double now = _frames[now_i]->get_end();
@@ -229,7 +236,7 @@ get_frame_rate(double time) const {
   int last_good_i = now_i;
 
   while (then_i > 0 && _frames[then_i]->get_start() > then) {
-    last_good_i = now_i;
+    last_good_i = then_i;
     then_i--;
     while (then_i > 0 && _frames[then_i] == (PStatFrameData *)NULL) {
       then_i--;