Exemple #1
0
int GetDataNum(int tag_val,const char *data_str)
{
   resource_node *r;
   class_node *c;
   int retval;

   switch (tag_val)
   {
   case TAG_RESOURCE :
      r = GetResourceByName(data_str);
      if (r != NULL)
      {
         retval = r->resource_id;
         break;
      }

      if (sscanf(data_str,"%i",&retval) != 1)
         retval = INVALID_DATA;

      break;

   case TAG_CLASS :
      c = GetClassByName(data_str);
      if (c != NULL)
      {
         retval = c->class_id;
         break;
      }

      if (sscanf(data_str,"%i",&retval) != 1)
         retval = INVALID_DATA;

      break;

   case TAG_MESSAGE :
      retval = GetIDByName(data_str);
      if (retval == INVALID_ID)
         retval = INVALID_DATA;
      break;

   case TAG_TEMP_STRING :
      eprintf( "Recognized TAG_TEMP_STRING type, attempting to load..." );
      retval = INVALID_DATA;
      break;

   default :
      if (sscanf(data_str,"%i",&retval) != 1)
         retval = INVALID_DATA;
   }

   return retval;
}
Exemple #2
0
void UpdateSecurityRedbook()
{
   // Okay, timing is important here:
   // The _redbookstring must be updated to any new value
   // before we call GameEchoPing() on any sessions, but the
   // current strings held by any of the sessions now must
   // remain valid so the GameEchoPing() output doesn't access
   // a freed old string.
   //
   // We remember the old string for comparisons and for freeing last.
   // We get the new resource.
   // We update _redbookstring and _redbookid.
   // We see if users need an update at all.
   // We free the string which sessions were using AFTER the GameEchoPing.
   //
   char* pRscName;
   char* old;
   resource_node* r = NULL;

   old = _redbookstring;
   _redbookstring = NULL;
   _redbookid = 0;

   pRscName = LockConfigStr(SECURITY_REDBOOK_RSC);
   if (pRscName)
      r = GetResourceByName(pRscName);
   UnlockConfigStr();

   if (r)
   {
      if (!old || (r->resource_val && 0 != strcmp(old,r->resource_val)))
	 _redbookstring = strdup(r->resource_val);
      else
	 _redbookstring = old;
      _redbookid = r->resource_id;
   }

   if (old != _redbookstring)
   {
      ForEachSession(GameEchoPing);
      if (old)
	 free(old);
   }
}
Exemple #3
0
	BaseMaterial* MaterialManager::GetByName(const String& resName)
	{
		return static_cast<BaseMaterial*>(GetResourceByName(resName));
	}
Exemple #4
0
	Font* FontManager::GetByName(const String& resName)
	{
		return static_cast<Font*>(GetResourceByName(resName));
	}
ProtoModel* ResourceModelMap::GetResourceByName(int type, const std::string& name) {
  return GetResourceByName(type, QString::fromStdString(name));
}