コード例 #1
0
void FGameplayEffectContext::AddHitResult(const FHitResult InHitResult, bool bReset)
{
	if (bReset && HitResult.IsValid())
	{
		HitResult.Reset();
		bHasWorldOrigin = false;
	}

	check(!HitResult.IsValid());
	HitResult = TSharedPtr<FHitResult>(new FHitResult(InHitResult));
	if (bHasWorldOrigin == false)
	{
		AddOrigin(InHitResult.TraceStart);
	}
}
コード例 #2
0
static int ReadTmCfg(char *pchFileName,
                     char *pchNameBuffer, char *pchOutbound,
                     char *pchNetmail, USERDATAOPT *pUserData, PDESCLIST *ppDescList)
{
   FILE *pfTmCfg;
   char zeile[200];

   pfTmCfg=fopen(pchFileName, "r");

   if (pfTmCfg)
   {
      while (!feof(pfTmCfg))
      {
         if (fgets(zeile, sizeof(zeile), pfTmCfg))
         {
            /* Whitespace u. Kommentare entfernen */
            StripWhitespace(zeile);

            if (zeile[0]) /* Zeile m. Inhalt */
            {
               char *pchKeyword;
               char *pchParam, *pchParam2;
               char *pchDup = strdup(zeile);

               pchKeyword = strtok(zeile, " \t");

               if (pchKeyword)
               {
                  pchParam = strtok(NULL, " \t");

                  switch(QueryKeyword(pchKeyword))
                  {
                     case KEY_NETMAIL:
                        if (!pchNetmail[0] && pchParam)
                        {
                           strcpy(pchNetmail, pchParam);
                           RemoveBackslash(pchOutbound);
                        }
                        break;

                     case KEY_OUTBOUND:
                        if (!pchOutbound[0] && pchParam)
                        {
                           strcpy(pchOutbound, pchParam);
                           RemoveBackslash(pchOutbound);
                        }
                        break;

                     case KEY_AREAFILE:
                        if (!pchNameBuffer[0] && pchParam)
                           strcpy(pchNameBuffer, pchParam);
                        break;

                     case KEY_ORIGIN:
                        if (pchParam)
                           AddOrigin(pUserData, pchDup);
                        break;

                     case KEY_NAME:
                        if (pchParam)
                           AddName(pUserData, pchDup);
                        break;

                     case KEY_ADDRESS:
                        if (pchParam)
                           AddAddress(pUserData, pchParam);
                        break;

                     case KEY_ADESC:
                        if (ppDescList)
                        {
                           pchParam2 = strtok(NULL, " \t");
                           if (pchParam2)
                           {
                              PDESCLIST pNewDesc;
                              pNewDesc = calloc(1, sizeof(DESCLIST));
                              if (pNewDesc)
                              {
                                 char *pchTemp;

                                 /* vorne einhaengen */
                                 pNewDesc->next = *ppDescList;
                                 *ppDescList = pNewDesc;

                                 /* Daten */
                                 strncpy(pNewDesc->pchAreaTag, pchParam, LEN_AREATAG);
                                 strncpy(pNewDesc->pchDesc, pchParam2, LEN_AREADESC);

                                 /* _ umwandeln */
                                 pchTemp = pNewDesc->pchDesc;
                                 while (*pchTemp)
                                 {
                                    if (*pchTemp == '_')
                                       *pchTemp = ' ';
                                    pchTemp++;
                                 }
                              }
                           }
                        }
                        break;

                     default:
                        /* unbekannt/unbehandelt */
                        break;
                  }
               }
               free(pchDup);
            }
         }
         else
            if (ferror(pfTmCfg))
            {
               /* Fehler beim Lesen der Datei */
               fclose(pfTmCfg);

               return CFGFILE_READ;
            }
      }
      fclose(pfTmCfg);

      return CFGFILE_OK;
   }
   else
      return CFGFILE_OPEN;
}