示例#1
0
/*
 * EnterGame:  Ask to go into game.
 */
void EnterGame(void)
{
   int encodednum;

   // Go into admin mode if person is admin and mode selected
   if (user_type == USER_ADMIN && admin_mode)
     {
       RequestAdmin();
       return;
     }
  
   // Go into game
   DownloadCheckDirs(hMain);
   encodednum = (((MAJOR_REV * 100) + MINOR_REV) * P_CATCH) + P_CATCH;
   RequestGame(config.download_time,encodednum,inihost);
}
示例#2
0
/*
 * DownloadFiles:  Bring up download dialog.
 */
void DownloadFiles(DownloadInfo *params)
{
   int retval, dialog, i;

   info = params;
   info->current_file = 0;
   MainSetState(STATE_DOWNLOAD);

   debug(("machine = %s\n", info->machine));
   debug(("path = %s\n", info->path));
   for (i = 0; i < info->num_files; i++)
      debug(("file = %s, time = %d, flags = %d\n", 
	     info->files[i].filename, info->files[i].time, info->files[i].flags));

   // If downloading only advertisements, show a different dialog to avoid the appearance
   // of a "real" download.
   dialog = IDD_DOWNLOADAD;
   for (i = 0; i < info->num_files; i++)
      if (DownloadLocation(info->files[i].flags) != DF_ADVERTISEMENT)
      {
	 dialog = IDD_DOWNLOAD;
	 break;
      }

   advert = (IDD_DOWNLOADAD == dialog);
   if (!advert  && !config.avoidDownloadAskDialog)
   {
      retval = DialogBox(hInst, MAKEINTRESOURCE(IDD_ASKDOWNLOAD), NULL, AskDownloadDialogProc);
      switch (retval) {
      case 3: // do the demo button
	 WebLaunchBrowser(info->demoPath);
	 SendMessage(hMain,WM_SYSCOMMAND,SC_CLOSE,0);
	 return;
      case IDOK: // proceed with download
	 retval = DialogBox(hInst, MAKEINTRESOURCE(dialog), NULL, DownloadDialogProc);
	 advert = FALSE;
	 if (retval == IDOK)
	 {
	    MainSetState(STATE_LOGIN);
	    i = (((MAJOR_REV * 100) + MINOR_REV) * P_CATCH) + P_CATCH;
	    RequestGame(config.download_time,i,config.comm.hostname);
	    return;
	 }
	 break;
      case IDCANCEL: // cancel
      default:
	 break;
      }
   }
   abort_download = True;
   config.quickstart = FALSE;
   //MainSetState(STATE_OFFLINE);
   Logoff();
   ShowWindow(hMain, SW_SHOW);
   UpdateWindow(hMain);

#if 0
   // If we were hung up, just leave
   if (state != STATE_DOWNLOAD)
      return;
   
   MainSetState(STATE_LOGIN);

   switch (retval)
   {
   case IDOK:
      RequestGame(config.download_time);
      break;

   case IDCANCEL:
      Logoff();
      break;
   }
#endif
}