Browse Source

fix redundant onDownloadBegin() message

David Rose 16 years ago
parent
commit
58f83fce39

+ 12 - 6
direct/src/plugin/p3dInstance.cxx

@@ -296,6 +296,8 @@ P3DInstance::
 ////////////////////////////////////////////////////////////////////
 void P3DInstance::
 cleanup() {
+  _failed = true;
+
   if (_auth_session != NULL) {
     _auth_session->shutdown(false);
     p3d_unref_delete(_auth_session);
@@ -375,8 +377,6 @@ cleanup() {
     P3DDownload *download = (*di).second;
     download->cancel();
   }
-
-  _failed = true;
 }
 
 
@@ -1339,7 +1339,7 @@ auth_button_clicked() {
 //       Access: Public
 //  Description: Called to start the game by the user clicking the
 //               green "play" button, or by JavaScript calling
-//               start().
+//               play().
 ////////////////////////////////////////////////////////////////////
 void P3DInstance::
 play_button_clicked() {
@@ -1349,7 +1349,9 @@ play_button_clicked() {
       // Now we initiate the download.
       _auto_install = true;
       _auto_start = true;
-      ready_to_install();
+      if (get_packages_info_ready()) {
+        ready_to_install();
+      }
 
     } else {
       set_background_image(IT_launch);
@@ -1831,7 +1833,11 @@ void P3DInstance::
 mark_p3d_trusted() {
   nout << "p3d trusted\n";
   // Only call this once.
-  assert(!_p3d_trusted);
+  if (_p3d_trusted) {
+    nout << "mark_p3d_trusted() called twice on " << _fparams.get_p3d_filename()
+         << "\n";
+    return;
+  }
 
   // Extract the application desc file from the p3d file.
   stringstream sstream;
@@ -2759,7 +2765,7 @@ ready_to_install() {
     _total_downloaded = 0;
 
     // Record the time we started the package download, so we can
-    // report downlaodElapsedTime and predict downloadRemainingTime.
+    // report downloadElapsedTime and predict downloadRemainingTime.
 #ifdef _WIN32
     _start_dl_tick = GetTickCount();
 #else

+ 1 - 0
direct/src/plugin/p3dMainObject.cxx

@@ -339,6 +339,7 @@ call_play(P3D_object *params[], int num_params) {
 
   // I guess there's no harm in allowing JavaScript to call play(),
   // with or without explicit scripting authorization.
+  nout << "play() called from JavaScript\n";
 
   if (!_inst->is_trusted()) {
     // Requires authorization.  We allow this only once; beyond that,

+ 4 - 2
direct/src/plugin/p3dMultifileReader.cxx

@@ -184,8 +184,10 @@ extract_one(ostream &out, const string &filename) {
 ////////////////////////////////////////////////////////////////////
 int P3DMultifileReader::
 get_num_signatures() const {
-  assert(_is_open);
-  ((P3DMultifileReader *)this)->check_signatures();
+  if (_is_open) {
+    ((P3DMultifileReader *)this)->check_signatures();
+  }
+
   return _signatures.size();
 }
 

+ 1 - 0
direct/src/plugin/p3dSplashWindow.cxx

@@ -571,6 +571,7 @@ set_mouse_data(int mouse_x, int mouse_y, bool mouse_down) {
 void P3DSplashWindow::
 button_click_detected() {
   assert(_inst != NULL);
+  nout << "Play button clicked by user\n";
   _inst->splash_button_clicked_sub_thread();
 }