Exemple #1
0
void LookForCustomCampaigns(void)
{
	int i;

	printf("\nCampaigns:\n");

	campaignList = GetFilesFromDirectory(GetDataFilePath("missions/"));
	GetCampaignTitles(&campaignList);
	i = 0;
	while (SetupBuiltinCampaign(i)) {
		AddFileEntry(&campaignList, "", gCampaign.setting->title, i);
		i++;
	}

	printf("\nDogfights:\n");

	dogfightList = GetFilesFromDirectory(GetDataFilePath("dogfights/"));
	GetCampaignTitles(&dogfightList);
	i = 0;
	while (SetupBuiltinDogfight(i)) {
		AddFileEntry(&dogfightList, "", gCampaign.setting->title, i);
		i++;
	}

	printf("\n");
}
Exemple #2
0
static int near sendrip(char *pszFile, int fDisplay, int force)
{
  int sendit;
  long filesize;
  char temp[PATHLEN];

  if (!hasRIP())
    return SENDRIP_ERROR;

  logit("@sendrip(%s,%s,%d)", pszFile, fDisplay ? "true" : "false", force);

  /* Get qualified filename for file to send */

  strcpy(temp, rippath);
  Add_Trailing(temp, PATH_DELIM);
  strcat(temp, pszFile);

  /* See if it exists in the current RIP path */

  if ((filesize=fsize(temp))==-1L)
  {

    /* Ok, then try the default RIP path */

    strcpy(temp, PRM(rippath));
    Add_Trailing(temp, PATH_DELIM);
    strcat(temp, pszFile);

    if ((filesize=fexist(temp))==-1)
    {

      /* Report it as an error and quit */

      cant_open(temp);
      return SENDRIP_FILENOTEXIST;
    }
  }

  sendit=!ripfilesent(temp);

  /* Query remote if send is forced or file hasn't
   * yet been sent in this session
   */

  if (force || sendit)
  {
    int hasit=RIP_HasFile(pszFile,&filesize);

    if (hasit==-1)
      return SENDRIP_ERROR;    /* RIP query aborted without success */

    if (!hasit)
      sendit=TRUE;
    else
    {

      /* If we know that the remote has the file, add it to our list
       * of "sent" files. Path must also be added to ensure that the
       * same icon will be sent in case rippath changes during session
       */

      addripfile(temp);
      sendit=FALSE;
    }

  }

  /* If remote already has the file and display is true
   * Then simply tell the remote system to display it
   */

  if (!sendit)
  {
    if (fDisplay)
    {

      /* Send any files "batched" for sending prior this now
       * to ensure that the display order remains the same
       */

      if (!FileEntries() || (sendit=ripsendbatch(fDisplay)))
      {
        /* "play RIP scene" - note: icons are NOT supported here */
        /* You must send icons in batch without playback, then   */
        /* use them within RIP scenes                            */

        Printf("\r!|1R00000000%s\n", pszFile);
        sendit=TRUE;
      }
    }
  }

  /* We need to send them the file
   * Just queue it for now
   */

  else
  {

    /* Send all batched so far if we've run out of space */

    if (CanAddFileEntry() || (sendit=ripsendbatch(fDisplay)))
    {
      AddFileEntry(temp, FFLAG_NOBYTES, filesize);
      sendit=TRUE;
    }
  }

  return sendit ? SENDRIP_FILESENT : SENDRIP_ALREADYHAS;
}