Ejemplo n.º 1
0
//
// E_MetaTableFromCfg
//
// haleyjd 06/30/13: Convert a cfg_t to fields in a MetaTable, with optional
// inheritance from a prototype table.
//
void E_MetaTableFromCfg(cfg_t *cfg, MetaTable *table, MetaTable *prototype)
{
   table->clearTable();

   if(prototype)
   {
      table->copyTableFrom(prototype);
      table->setString("super", prototype->getKey());
   }

   for(auto opt = cfg->opts; opt->type != CFGT_NONE; opt++)
   {
      if(cfg_size(cfg, opt->name) == 0)
         continue;

      switch(opt->type)
      {
      case CFGT_INT:
         E_MetaIntFromCfgInt(table, cfg, opt->name);
         break;
      case CFGT_STR:
         E_MetaStringFromCfgString(table, cfg, opt->name);
         break;
      case CFGT_BOOL:
         E_MetaIntFromCfgBool(table, cfg, opt->name);
         break;
      case CFGT_FLAG:
         E_MetaIntFromCfgFlag(table, cfg, opt->name);
         break;
      default:
         break;
      }
   }
}
Ejemplo n.º 2
0
//
// Health
//
// Health inventory items are collected immediately and will add to the 
// collector's health, up to the maxamount value.
//
static void E_processHealthProperties(inventory_t *inv, cfg_t *invsec, 
                                      bool def, bool inherits)
{
   // "Hard-coded" initial properties for Health class:
   if(def && !inherits)
      inv->flags |= INVF_AUTOACTIVATE;

   // lowmessage (may be a BEX string if prefixed with $)
   if(IS_SET(ITEM_INVENTORY_HEALTHLOW))
      E_MetaStringFromCfgString(inv->meta, invsec, ITEM_INVENTORY_HEALTHLOW);
}