本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}