示例#1
0
//
// MetaKeyForIndex
//
// Given a key index, get the key.
//
static metakey_t &MetaKeyForIndex(size_t index)
{
   if(index >= metaKeys.getLength())
      I_Error("MetaKeyForIndex: illegal key index requested\n");

   return *metaKeys[index];
}
示例#2
0
//
// MetaKey
//
// If the given key string is already interned, the metakey_t structure that
// stores it will be returned. If not, it will be added to the collection of
// keys and hashed by name.
//
static metakey_t &MetaKey(const char *key)
{
   metakey_t *keyObj;

   // Do we already have this key?
   if(!(keyObj = metaKeyHash.objectForKey(key)))
   {
      keyObj = &metaKeys.addNew();
      keyObj->key     = estrdup(key);
      keyObj->index   = metaKeys.getLength() - 1;
      keyObj->unmodHC = ENCStringHashKey::HashCode(key);

      // hash it
      metaKeyHash.addObject(keyObj, keyObj->unmodHC);
   }

   return *keyObj;
}
示例#3
0
//
// MetaKey
//
// If the given key string is already interned, the metakey_t structure that
// stores it will be returned. If not, it will be added to the collection of
// keys and hashed by name.
//
static metakey_t &MetaKey(const char *key)
{
   metakey_t *keyObj;
   unsigned int unmodHC = ENCStringHashKey::HashCode(key);

   // Do we already have this key?
   if(!(keyObj = metaKeyHash.objectForKey(key, unmodHC)))
   {
      keyObj = estructalloc(metakey_t, 1);

      // add it to the list
      metaKeys.add(keyObj);

      keyObj->key     = estrdup(key);
      keyObj->index   = metaKeys.getLength() - 1;
      keyObj->unmodHC = unmodHC;

      // check for table overload, and hash it
      MetaHashRebuild<>(metaKeyHash);
      metaKeyHash.addObject(keyObj, keyObj->unmodHC);
   }

   return *keyObj;
}
示例#4
0
//
// I_GetNumGamePads
//
size_t I_GetNumGamePads()
{
   return masterGamePadList.getLength();
}