当前位置: 首页>>代码示例>>C++>>正文


C++ GET_CLASS函数代码示例

本文整理汇总了C++中GET_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_CLASS函数的具体用法?C++ GET_CLASS怎么用?C++ GET_CLASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GET_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write_mobile_espec

int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{
  if (GET_ATTACK(mob) != 0)
    fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob));
  if (GET_STR(mob) != 0)
    fprintf(fd, "Str: %d\n", GET_STR(mob));
  if (GET_ADD(mob) != 0)
    fprintf(fd, "StrAdd: %d\n", GET_ADD(mob));
  if (GET_DEX(mob) != 0)
    fprintf(fd, "Dex: %d\n", GET_DEX(mob));
  if (GET_INT(mob) != 0)
    fprintf(fd, "Int: %d\n", GET_INT(mob));
  if (GET_WIS(mob) != 0)
    fprintf(fd, "Wis: %d\n", GET_WIS(mob));
  if (GET_CON(mob) != 0)
    fprintf(fd, "Con: %d\n", GET_CON(mob));
  if (GET_CHA(mob) != 0)
    fprintf(fd, "Cha: %d\n", GET_CHA(mob));
  if(GET_CLASS(mob) != CLASS_NPC_OTHER)
    fprintf(fd, "Class: %d\n", GET_CLASS(mob));
  if(GET_RACE(mob) != RACE_NPC_OTHER)
    fprintf(fd, "Race: %d\n", GET_RACE(mob));
  if(GET_MOB_WEIGHT(mob))
    fprintf(fd, "Weight: %d\n", GET_MOB_WEIGHT(mob));

  fprintf(fd, "Size: %d\n", GET_MOB_SIZE(mob));

  fputs("E\n", fd);
  return TRUE;
}
开发者ID:vedicveko,项目名称:Aarait,代码行数:30,代码来源:genmob.c

示例2: get_class_idx_by_size

/* LIFO policy, first hit policy */
static void *find_fit(size_t asize) {
    
    char *bp = NULL;
    char *bclassp = NULL;
    int index = get_class_idx_by_size(asize);
    dbg_printf("=== FIND_FIT adjusted size: %ld class index = %d\n", asize, index);
    
    for (index = index; index < CLASS_NUM; index ++) {
        if (index < 1) {
            bclassp = GET_CLASS(index);
            bp = GET_CLASS_ROOT_BLK(bclassp);
            
            if (bp) return bp;
            
        }
        else {
            bclassp = GET_CLASS(index);
            bp = GET_CLASS_ROOT_BLK(bclassp);
            
            if (bp) {
                do {
                    check_bp_pred_succ(bp);
                    if ((GET_SIZE(GET_HEADER(bp)) >= asize))
                        return bp;
                    
                } while ((bp = (char *)GET_SUCC_BLK(bp)) != NULL);
            }
        }
    }
    return NULL;
}
开发者ID:analysiser,项目名称:malloclab-score85-seglist,代码行数:32,代码来源:mm_seglist_89.c

示例3: find_feat_slot

/*
	Ищем свободный слот под способность.
	Возвращает число от 0 до MAX_ACC_FEAT-1 - номер слота,
	0, если способность врожденная и -1 если слотов не найдено.
	НЕ проверяет доступность врожденной способности на данном уровне.
*/
bool find_feat_slot(CHAR_DATA *ch, int feat)
{
	int i, lowfeat, hifeat;
	//если способность врожденная - ее всегда можно получить
	if (feat_info[feat].natural_classfeat[(int) GET_CLASS(ch)][(int) GET_KIN(ch)] || PlayerRace::FeatureCheck(GET_KIN(ch),GET_RACE(ch),feat))
		return TRUE;
    //сколько у нас вообще способностей, у которых слот меньше требуемого, и сколько - тех, у которых больше или равно?
    lowfeat = 0;
    hifeat = 0;
	for (i = 1; i < MAX_FEATS; i++)
	{
        if (feat_info[i].natural_classfeat[(int) GET_CLASS(ch)][(int) GET_KIN(ch)] || PlayerRace::FeatureCheck(GET_KIN(ch),GET_RACE(ch),i))
            continue;
	    if (HAVE_FEAT(ch,i) && (FEAT_SLOT(ch,i) < FEAT_SLOT(ch,feat)))
            lowfeat++;
        if (HAVE_FEAT(ch,i) && (FEAT_SLOT(ch,i) >= FEAT_SLOT(ch,feat)))
            hifeat++;
	}

//из имеющегося количества слотов нужно вычесть:
//число высоких слотов, занятых низкоуровневыми способностями,
//с учтом, что низкоуровневые могут и не занимать слотов выше им положенных,
//а также собственно число слотов, занятых высокоуровневыми способностями
	if (NUM_LEV_FEAT(ch)-FEAT_SLOT(ch, feat)-hifeat-MAX(0, lowfeat-FEAT_SLOT(ch, feat)) > 0)
        return TRUE;

//oops.. слотов нет
	return FALSE;
}
开发者ID:prool,项目名称:zerkalomud,代码行数:35,代码来源:features.cpp

示例4: gain_skill_prof

void
gain_skill_prof(struct creature *ch, int skl)
{
    int learned;
    if (skl == SKILL_READ_SCROLLS || skl == SKILL_USE_WANDS)
        learned = 10;
    else
        learned = LEARNED(ch);

    // NPCs don't learn
    if (IS_NPC(ch))
        return;

    // You can't gain in a skill that you don't really know
    if (GET_LEVEL(ch) < SPELL_LEVEL(skl, GET_CLASS(ch))) {
        if (!IS_REMORT(ch))
            return;
        if (GET_LEVEL(ch) < SPELL_LEVEL(skl, GET_REMORT_CLASS(ch)))
            return;
    }
    // Check for remort classes too
    if (SPELL_GEN(skl, GET_CLASS(ch)) > 0 &&
        GET_REMORT_GEN(ch) < SPELL_GEN(skl, GET_CLASS(ch)))
        return;

    if (GET_SKILL(ch, skl) >= (learned - 10))
        if ((GET_SKILL(ch, skl) - GET_LEVEL(ch)) <= 66)
            SET_SKILL(ch, skl, GET_SKILL(ch, skl) + 1);
}
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:29,代码来源:char_class.c

示例5: say_spell

static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch,
	            struct obj_data *tobj)
{
  char lbuf[256], buf[256], buf1[256], buf2[256];	/* FIXME */
  const char *format;

  struct char_data *i;
  int j, ofs = 0;

  *buf = '\0';
  strlcpy(lbuf, skill_name(spellnum), sizeof(lbuf));

  while (lbuf[ofs]) {
    for (j = 0; *(syls[j].org); j++) {
      if (!strncmp(syls[j].org, lbuf + ofs, strlen(syls[j].org))) {
	strcat(buf, syls[j].news);	/* strcat: BAD */
	ofs += strlen(syls[j].org);
        break;
      }
    }
    /* i.e., we didn't find a match in syls[] */
    if (!*syls[j].org) {
      log("No entry in syllable table for substring of '%s'", lbuf);
      ofs++;
    }
  }

  if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
    if (tch == ch)
      format = "$n closes $s eyes and utters the words, '%s'.";
    else
      format = "$n stares at $N and utters the words, '%s'.";
  } else if (tobj != NULL &&
	     ((IN_ROOM(tobj) == IN_ROOM(ch)) || (tobj->carried_by == ch)))
    format = "$n stares at $p and utters the words, '%s'.";
  else
    format = "$n utters the words, '%s'.";

  snprintf(buf1, sizeof(buf1), format, skill_name(spellnum));
  snprintf(buf2, sizeof(buf2), format, buf);

  for (i = world[IN_ROOM(ch)].people; i; i = i->next_in_room) {
    if (i == ch || i == tch || !i->desc || !AWAKE(i))
      continue;
    if (GET_CLASS(ch) == GET_CLASS(i))
      perform_act(buf1, ch, tobj, tch, i);
    else
      perform_act(buf2, ch, tobj, tch, i);
  }

  if (tch != NULL && tch != ch && IN_ROOM(tch) == IN_ROOM(ch)) {
    snprintf(buf1, sizeof(buf1), "$n stares at you and utters the words, '%s'.",
	    GET_CLASS(ch) == GET_CLASS(tch) ? skill_name(spellnum) : buf);
    act(buf1, FALSE, ch, NULL, tch, TO_VICT);
  }
}
开发者ID:Lundessa,项目名称:raven3,代码行数:56,代码来源:spell_parser.c

示例6: say_spell

/* say_spell erodes buf, buf1, buf2 */
void say_spell(struct char_data *ch, struct spell_info_type *sptr, struct char_data *tch,
               struct obj_data *tobj)
{
    char lbuf[256];
    const char *format;

    struct char_data *i;
    int j, ofs = 0;

    *buf = '\0';
    sprintf(lbuf, "%s", LOWERALL(sptr->name));

    while (lbuf[ofs]) {
        for (j = 0; *(syls[j].org); j++) {
            if (!strncmp(syls[j].org, lbuf + ofs, strlen(syls[j].org))) {
                strcat(buf, syls[j].news);
                ofs += strlen(syls[j].org);
                break;
            }
        }
        /* i.e., we didn't find a match in syls[] */
        if (!*syls[j].org) {
            extended_mudlog(NRM, SYSL_BUGS, TRUE, "No entry in syllable table for substring of '%s'", lbuf);
            ofs++;
        }
    }

    if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
        if (tch == ch)
            format = "$n closes $s eyes and utters the words, '&W%s&n'.";
        else
            format = "$n stares at $N and utters the words, '&W%s&n'.";
    } else if (tobj != NULL &&
               ((IN_ROOM(tobj) == IN_ROOM(ch)) || (tobj->carried_by == ch)))
        format = "$n stares at $p and utters the words, '&W%s&n'.";
    else
        format = "$n utters the words, '&W%s&n'.";

    sprintf(buf1, format, sptr->name);
    sprintf(buf2, format, buf);

    for (i = world[IN_ROOM(ch)].people; i; i = i->next_in_room) {
        if (i == ch || i == tch || !i->desc || !AWAKE(i) || IN_OLC(i->desc) || PLR_FLAGGED(i, PLR_WRITING))
            continue;
        if (GET_CLASS(ch) == GET_CLASS(i))
            perform_act(buf1, ch, tobj, tch, i, 0);
        else
            perform_act(buf2, ch, tobj, tch, i, 0);
    }

    if (tch != NULL && tch != ch && IN_ROOM(tch) == IN_ROOM(ch)) {
        sprintf(buf1, "$n stares at you and utters the words, '&W%s&n'.",
                GET_CLASS(ch) == GET_CLASS(tch) ? sptr->name : buf);
        act(buf1, FALSE, ch, NULL, tch, TO_VICT);
    }
}
开发者ID:tbjers,项目名称:arcanerealms,代码行数:57,代码来源:spell_parser.c

示例7: do_start

/* Some initializations for characters, including initial skills */
void do_start(struct char_data *ch)
{
  GET_LEVEL(ch) = 1;
  GET_TOT_LEVEL(ch) = 1;
  GET_EXP(ch) = 1;
  GET_CLASS_1(ch) = GET_CLASS(ch);
  GET_MULTIS(ch) = 1;

  set_title(ch, NULL);
  roll_real_abils(ch);

  GET_MAX_HIT(ch)  = 10;
  GET_MAX_MANA(ch) = 100;
  GET_MAX_MOVE(ch) = 100;

  switch (GET_CLASS(ch)) {

  case CLASS_ADEPT:
    break;

  case CLASS_MEDIC:
    break;

  case CLASS_BANDIT:
    SET_SKILL(ch, SKILL_SNEAK, 10);
    SET_SKILL(ch, SKILL_HIDE, 5);
    SET_SKILL(ch, SKILL_STEAL, 15);
    SET_SKILL(ch, SKILL_BACKSTAB, 10);
    SET_SKILL(ch, SKILL_PICK_LOCK, 10);
    SET_SKILL(ch, SKILL_TRACK, 10);
    break;

  case CLASS_SOLDIER:
    break;
  }

  advance_level(ch);

  GET_HIT(ch) = GET_MAX_HIT(ch);
  GET_MANA(ch) = GET_MAX_MANA(ch);
  GET_MOVE(ch) = GET_MAX_MOVE(ch);

  GET_COND(ch, THIRST) = 24;
  GET_COND(ch, HUNGER) = 24;
  GET_COND(ch, DRUNK) = 0;

  if (CONFIG_SITEOK_ALL)
    SET_BIT_AR(PLR_FLAGS(ch), PLR_SITEOK);
}
开发者ID:DarkStar4758,项目名称:darkmud,代码行数:50,代码来源:class.c

示例8: calcMoveBase

int calcMoveBase(CharData *ch) {
    int base = 0;

    base += graf(age(ch).year, 40, 39, 34, 30, 26, 24, 23);

    /* Class/Level calculations */
    if (GET_CLASS(ch) == CLASS_RANGER)
        base += GET_LEVEL(ch);
    else if (GET_CLASS(ch) == CLASS_ASSASSIN || GET_CLASS(ch) == CLASS_THIEF)
        base += GET_LEVEL(ch)*2/3;
    else
        base += GET_LEVEL(ch)/3;
        
    return base;
}
开发者ID:Lundessa,项目名称:NewRavenVM,代码行数:15,代码来源:mudlimits.c

示例9: InitJni

/*
 * Init JNI fields that will be used to fetch the key and crypt/encrypt
 */
static int
InitJni(vlc_keystore *p_keystore, JNIEnv *p_env)
{
    jclass clazz = NULL;

    GET_CLASS("java/lang/Object");
    GET_ID(GetMethodID, Object.toString, "toString", "()Ljava/lang/String;");

    GET_CLASS("java/security/KeyStore");
    GET_GLOBAL_CLASS(KeyStore);
    GET_ID(GetStaticMethodID, KeyStore.getInstance, "getInstance",
           "(Ljava/lang/String;)Ljava/security/KeyStore;");
    GET_ID(GetMethodID, KeyStore.load, "load",
           "(Ljava/security/KeyStore$LoadStoreParameter;)V");
    GET_ID(GetMethodID, KeyStore.getEntry, "getEntry",
           "(Ljava/lang/String;Ljava/security/KeyStore$ProtectionParameter;)"
           "Ljava/security/KeyStore$Entry;");

    GET_CLASS("java/security/KeyStore$SecretKeyEntry");
    GET_ID(GetMethodID, KeyStore.SecretKeyEntry.getSecretKey, "getSecretKey",
           "()Ljavax/crypto/SecretKey;");


    GET_CLASS("javax/crypto/spec/IvParameterSpec");
    GET_GLOBAL_CLASS(IvParameterSpec);
    GET_ID(GetMethodID, IvParameterSpec.ctor, "<init>", "([B)V");

    GET_CLASS("javax/crypto/Cipher");
    GET_GLOBAL_CLASS(Cipher);
    GET_ID(GetStaticMethodID, Cipher.getInstance, "getInstance",
           "(Ljava/lang/String;)Ljavax/crypto/Cipher;");
    GET_ID(GetMethodID, Cipher.init, "init",
           "(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;)V");
    GET_ID(GetMethodID, Cipher.doFinal, "doFinal", "([B)[B");
    GET_ID(GetMethodID, Cipher.getIV, "getIV", "()[B");
    GET_CONST_INT(Cipher.ENCRYPT_MODE, "ENCRYPT_MODE");
    GET_CONST_INT(Cipher.DECRYPT_MODE, "DECRYPT_MODE");

    DEL_LREF(clazz);

    jstring VLC_CIPHER = NEW_STR("AES/CBC/PKCS7Padding");
    if (CHECK_EXCEPTION())
        return VLC_EGENERIC;
    fields.VLC_CIPHER = NEW_GREF(VLC_CIPHER);
    DEL_LREF(VLC_CIPHER);

    return VLC_SUCCESS;
}
开发者ID:0xheart0,项目名称:vlc,代码行数:51,代码来源:file_crypt_android.c

示例10: ApplicationFrontendFlowStep

call_graph_computation::call_graph_computation(const ParameterConstRef _parameters, const application_managerRef _AppM, const DesignFlowManagerConstRef _design_flow_manager) :
   ApplicationFrontendFlowStep(_AppM, FUNCTION_ANALYSIS, _design_flow_manager, _parameters),
   CGM(_AppM->GetCallGraphManager()),
   current(0)
{
   debug_level = parameters->get_class_debug_level(GET_CLASS(*this), DEBUG_LEVEL_NONE);
}
开发者ID:hoangt,项目名称:PandA-bambu,代码行数:7,代码来源:call_graph_computation.cpp

示例11: gain_exp_regardless

void gain_exp_regardless(struct char_data * ch, int gain)
{
  int is_altered = FALSE;
  int num_levels = 0;

  GET_EXP(ch) += gain;
  if (GET_EXP(ch) < 0)
    GET_EXP(ch) = 0;

  if (!IS_NPC(ch)) {
    while (GET_LEVEL(ch) < LVL_IMPL &&
	GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) {
      GET_LEVEL(ch) += 1;
      num_levels++;
      advance_level(ch);
      is_altered = TRUE;
    }

    if (is_altered) {
      sprintf(buf, "%s advanced %d level%s to level %d.",
		GET_NAME(ch), num_levels, num_levels == 1 ? "" : "s",
		GET_LEVEL(ch));
      mudlog(buf, BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
      if (num_levels == 1)
        send_to_char("You rise a level!\r\n", ch);
      else {
	sprintf(buf, "You rise %d levels!\r\n", num_levels);
	send_to_char(buf, ch);
      }
      set_title(ch, NULL);
      check_autowiz(ch);
    }
  }
}
开发者ID:matthewbode,项目名称:mg2,代码行数:34,代码来源:limits.c

示例12: mag_savingthrow

int mag_savingthrow(struct char_data * ch, int type)
{
  int save;

  /* negative apply_saving_throw values make saving throws better! */
  if (!ch) {
    return 0;
  }

  if (IS_NPC(ch)) {
    save = class_saving_throws[(int) CLASS_WARRIOR][type] - (GET_LEVEL(ch) / 3);
    save += mob_race_saving_throws[(int) GET_RACE(ch)][type];
  } else {
    save = class_saving_throws[(int) GET_CLASS(ch)][type] - (GET_LEVEL(ch) / 4);
    save += race_saving_throws[(int) GET_RACE(ch)][type];
  }

  save += GET_SAVE(ch, type);

  /* throwing a 0 is always a failure */
  if (MAX(1, save) < number(0, 20))
    return TRUE;
  else
    return FALSE;
}
开发者ID:nawglan,项目名称:ShadowWind,代码行数:25,代码来源:magic.c

示例13: target_device

FPGA_device::FPGA_device(const ParameterConstRef _Param, const technology_managerRef _TM) :
   target_device(_Param, _TM, TargetDevice_Type::FPGA)
{
   ///creating the datastructure representing the target technology
   target = target_technology::create_technology(target_technology::FPGA, Param);
   debug_level = Param->get_class_debug_level(GET_CLASS(*this));
}
开发者ID:hoangt,项目名称:PandA-bambu,代码行数:7,代码来源:FPGA_device.cpp

示例14: list_skills

void list_skills(struct char_data *ch)
{
  const char *overflow = "\r\n**OVERFLOW**\r\n";
  int i, sortpos;
  size_t len = 0, nlen;
  char buf2[MAX_STRING_LENGTH];

  len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
	"You know of the following %ss:\r\n", GET_PRACTICES(ch),
	GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));

  int cnt = 0;
  for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
      cnt += 1;
      nlen = snprintf(buf2 + len, sizeof(buf2) - len, (cnt%2) ? "%-20s %s | " : "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));
      if (len + nlen >= sizeof(buf2) || nlen < 0)
        break;
      len += nlen;
    }
  }
  if (len >= sizeof(buf2))
    strcpy(buf2 + sizeof(buf2) - strlen(overflow) - 1, overflow); /* strcpy: OK */

  parse_at(buf2);
  page_string(ch->desc, buf2, TRUE);
}
开发者ID:Lundessa,项目名称:raven3,代码行数:28,代码来源:spec_procs.c

示例15: php_is_r_primitive

static int php_is_r_primitive(SEXP val, SEXPTYPE *type) /* {{{ */
{
	int is = 0;

	if (GET_LENGTH(GET_DIM(val))) {
		return 0;
	}

	if (GET_LENGTH(GET_CLASS(val))) {
		return 0;
	}

	*type = TYPEOF(val);
	switch (*type) {
		case REALSXP:
		case LGLSXP:
		case STRSXP:
		case INTSXP:
			is = 1;
		default:
			break;
	}

	return is;
}
开发者ID:tony2001,项目名称:arrr,代码行数:25,代码来源:arrr.c


注:本文中的GET_CLASS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。