本文整理汇总了C++中rd_byte函数的典型用法代码示例。如果您正苦于以下问题:C++ rd_byte函数的具体用法?C++ rd_byte怎么用?C++ rd_byte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rd_byte函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rd_unknown_extension
/*
* Read and discard all fields of an unknown extension.
*/
static errr rd_unknown_extension(void)
{
byte tmp8u;
u16b tmp16u;
s16b tmp16s;
u32b tmp32u;
s32b tmp32s;
char string[1024];
while (TRUE)
{
/* Read field type */
rd_byte(&tmp8u);
/* End mark? */
if (tmp8u == EXTENSION_TYPE_END) break;
/* Discard field depending on type */
switch(tmp8u)
{
case EXTENSION_TYPE_U32B: rd_u32b(&tmp32u); break;
case EXTENSION_TYPE_S32B: rd_s32b(&tmp32s); break;
case EXTENSION_TYPE_U16B: rd_u16b(&tmp16u); break;
case EXTENSION_TYPE_S16B: rd_s16b(&tmp16s); break;
case EXTENSION_TYPE_STRING: rd_string(string, sizeof(string)); break;
case EXTENSION_TYPE_BYTE: rd_byte(&tmp8u); break;
/* Garbage? */
default: return (-1);
}
}
/* Success */
return (0);
}
开发者ID:NickMcConnell,项目名称:NPPAngband,代码行数:37,代码来源:load.c
示例2: rd_monster
/*
* Read a monster
*/
static void rd_monster(monster_type *m_ptr)
{
byte tmp8u;
/* Read the monster race */
rd_s16b(&m_ptr->r_idx);
/* Read the other information */
rd_byte(&m_ptr->fy);
rd_byte(&m_ptr->fx);
rd_s16b(&m_ptr->hp);
rd_s16b(&m_ptr->maxhp);
rd_s16b(&m_ptr->csleep);
rd_byte(&m_ptr->mspeed);
rd_s16b(&m_ptr->energy_need);
rd_byte(&m_ptr->hasted);
rd_byte(&m_ptr->slowed);
rd_byte(&m_ptr->stunned);
rd_byte(&m_ptr->confused);
rd_byte(&m_ptr->monfear);
rd_byte(&m_ptr->invulner);
rd_u32b(&m_ptr->smart);
rd_s16b(&m_ptr->target_y);
rd_s16b(&m_ptr->target_x);
rd_u32b(&m_ptr->flags);
rd_byte(&tmp8u);
}
开发者ID:iks3,项目名称:tinyangband,代码行数:33,代码来源:load.c
示例3: rd_quests
static int rd_quests(void)
{
int i;
u16b tmp16u;
/* Load the Quests */
rd_u16b(&tmp16u);
/* Incompatible save files */
if (tmp16u > MAX_Q_IDX)
{
note(format("Too many (%u) quests!", tmp16u));
return (-1);
}
/* Load the Quests */
for (i = 0; i < tmp16u; i++)
{
byte tmp8u;
rd_byte(&tmp8u);
q_list[i].level = tmp8u;
rd_byte(&tmp8u);
rd_byte(&tmp8u);
rd_byte(&tmp8u);
}
return 0;
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:29,代码来源:load-old.c
示例4: rd_player_spells
static int rd_player_spells(void)
{
int i;
u16b tmp16u;
int cnt;
/* Read the number of spells */
rd_u16b(&tmp16u);
if (tmp16u > PY_MAX_SPELLS)
{
note(format("Too many player spells (%d).", tmp16u));
return (-1);
}
/* Read the spell flags */
for (i = 0; i < tmp16u; i++)
rd_byte(&p_ptr->spell_flags[i]);
/* Read the spell order */
for (i = 0, cnt = 0; i < tmp16u; i++, cnt++)
rd_byte(&p_ptr->spell_order[cnt]);
/* Success */
return (0);
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:26,代码来源:load-old.c
示例5: rd_squelch
/*
* Read squelch and autoinscription submenu for all known objects
*/
static int rd_squelch(void)
{
size_t i;
byte tmp8u = 24;
/* Read how many squelch bytes we have */
rd_byte(&tmp8u);
/* Check against current number */
if (tmp8u != squelch_size)
{
strip_bytes(tmp8u);
}
else
{
for (i = 0; i < squelch_size; i++)
rd_byte(&squelch_level[i]);
}
/* Handle ego-item squelch */
if ((sf_major == 3) && (sf_minor == 0) && (sf_patch != 9))
{
u16b file_e_max;
/* Read the number of saved ego-item */
rd_u16b(&file_e_max);
for (i = 0; i < file_e_max; i++)
{
if (i < z_info->e_max)
{
byte flags;
/* Read and extract the flag */
rd_byte(&flags);
e_info[i].everseen |= (flags & 0x02);
}
}
}
else
{
}
/* Read the current number of auto-inscriptions */
rd_u16b(&inscriptions_count);
/* Write the autoinscriptions array*/
for (i = 0; i < inscriptions_count; i++)
{
char tmp[80];
rd_s16b(&inscriptions[i].kind_idx);
rd_string(tmp, sizeof(tmp));
inscriptions[i].inscription_idx = quark_add(tmp);
}
return 0;
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:62,代码来源:load-old.c
示例6: rd_byte
int SPI_TFT_ILI9341::Read_ID(void){
int r;
r = rd_byte(0x0A);
r = rd_byte(0x0A);
r = rd_byte(0x0A);
r = rd_byte(0x0A);
return(r);
}
开发者ID:olegv142,项目名称:STM32L4SpecMon,代码行数:8,代码来源:SPI_TFT_ILI9341.cpp
示例7: rd_store
/*
* Read a store
*/
static errr rd_store(int n)
{
store_type *st_ptr = &store[n];
int j;
byte own, num;
/* Read the basic info */
rd_s32b(&st_ptr->store_open);
rd_s16b(&st_ptr->insult_cur);
rd_byte(&own);
rd_byte(&num);
rd_s16b(&st_ptr->good_buy);
rd_s16b(&st_ptr->bad_buy);
/* Paranoia */
if (own >= z_info->b_max)
{
note("Illegal store owner!");
return (-1);
}
st_ptr->owner = own;
/* Read the items */
for (j = 0; j < num; j++)
{
object_type *i_ptr;
object_type object_type_body;
/* Get local object */
i_ptr = &object_type_body;
/* Wipe the object */
object_wipe(i_ptr);
/* Read the item */
if (rd_item(i_ptr))
{
note("Error reading item");
return (-1);
}
/* Accept any valid items */
if (st_ptr->stock_num < STORE_INVEN_MAX)
{
int k = st_ptr->stock_num++;
/* Accept the item */
object_copy(&st_ptr->stock[k], i_ptr);
}
}
/* Success */
return (0);
}
开发者ID:BackupTheBerlios,项目名称:unangband-svn,代码行数:61,代码来源:load.c
示例8: rd_effect
/*
* Read an object
*
* This function attempts to "repair" old savefiles, and to extract
* the most up to date values for various object fields.
*/
static errr rd_effect(void)
{
int x_idx;
byte type;
u16b f_idx;
byte y;
byte x;
byte countdown;
byte repeats;
u16b power;
s16b source;
u16b flags;
x_idx = x_pop();
/*something is wrong*/
if (!x_idx) return (-1);
/*Read the effect*/
rd_byte(&type);
rd_u16b(&f_idx);
rd_byte(&y);
rd_byte(&x);
rd_byte(&countdown);
rd_byte(&repeats);
rd_u16b(&power);
rd_s16b(&source);
rd_u16b(&flags);
/*Write it, unless it is an empty effect*/
if (type) effect_prep(x_idx, type, f_idx, y, x, countdown, repeats, power, source, flags);
/* Read a new field, a monster race for inscriptions */
if (!older_than(0,4,8))
{
s16b r_idx;
rd_s16b(&r_idx);
x_list[x_idx].x_r_idx = (type ? r_idx: 0);
}
/* Success */
return (0);
}
开发者ID:NickMcConnell,项目名称:NPPAngband,代码行数:59,代码来源:load.c
示例9: rd_store
/*
* Read a store
*/
static errr rd_store(int town_number, int store_number)
{
store_type *st_ptr = &town[town_number].store[store_number];
int j;
byte num;
s16b tmp16s;
/* Read the basic info */
rd_s32b(&st_ptr->store_open);
rd_s16b(&tmp16s);
rd_byte(&st_ptr->owner);
rd_byte(&num);
rd_s16b(&tmp16s);
rd_s16b(&tmp16s);
/* Read last visit */
rd_s32b(&st_ptr->last_visit);
/* Read the items */
for (j = 0; j < num; j++)
{
object_type forge;
object_type *q_ptr;
/* Get local object */
q_ptr = &forge;
/* Wipe the object */
object_wipe(q_ptr);
/* Read the item */
rd_item(q_ptr);
/* Acquire valid items */
if (st_ptr->stock_num < (store_number == STORE_HOME ? (STORE_INVEN_MAX) * 10 : STORE_INVEN_MAX))
{
int k = st_ptr->stock_num;
if (q_ptr->k_idx != 0)
{
/* Acquire the item */
object_copy(&st_ptr->stock[k], q_ptr);
st_ptr->stock_num++;
}
}
}
/* Success */
return (0);
}
开发者ID:iks3,项目名称:tinyangband,代码行数:55,代码来源:load.c
示例10: strip_bytes
/*
* Hack -- strip some bytes
*/
static void strip_bytes(int n)
{
byte tmp8u;
/* Strip the bytes */
while (n--) rd_byte(&tmp8u);
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:10,代码来源:load-old.c
示例11: rd_history
static int rd_history(void)
{
u32b tmp32u;
size_t i;
history_clear();
rd_u32b(&tmp32u);
for (i = 0; i < tmp32u; i++)
{
s32b turn;
s16b dlev, clev;
u16b type;
byte art_name;
char text[80];
rd_u16b(&type);
rd_s32b(&turn);
rd_s16b(&dlev);
rd_s16b(&clev);
rd_byte(&art_name);
rd_string(text, sizeof(text));
history_add_full(type, art_name, dlev, clev, turn, text);
}
return 0;
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:28,代码来源:load-old.c
示例12: rd_object_memory
static int rd_object_memory(void)
{
int i;
u16b tmp16u;
/* Object Memory */
rd_u16b(&tmp16u);
/* Incompatible save files */
if (tmp16u > z_info->k_max)
{
note(format("Too many (%u) object kinds!", tmp16u));
return (-1);
}
/* Read the object memory */
for (i = 0; i < tmp16u; i++)
{
byte tmp8u;
object_kind *k_ptr = &k_info[i];
rd_byte(&tmp8u);
k_ptr->aware = (tmp8u & 0x01) ? TRUE : FALSE;
k_ptr->tried = (tmp8u & 0x02) ? TRUE : FALSE;
k_ptr->everseen = (tmp8u & 0x08) ? TRUE : FALSE;
if (tmp8u & 0x04) kind_squelch_when_aware(k_ptr);
if (tmp8u & 0x10) kind_squelch_when_unaware(k_ptr);
}
return 0;
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:33,代码来源:load-old.c
示例13: rd_artifact_lore
/*
* Read artifact lore
*/
static errr rd_artifact_lore(int a_idx)
{
byte tmp8u;
/* Read flags */
rd_byte(&tmp8u);
/* The artifact was fully identified */
a_l_list[a_idx].was_fully_identified = ((tmp8u & 0x01) != 0);
/* For future use */
rd_byte(&tmp8u);
rd_byte(&tmp8u);
rd_byte(&tmp8u);
return (0);
}
开发者ID:NickMcConnell,项目名称:NPPAngband,代码行数:20,代码来源:load.c
示例14: load_quick_start
/*
* Save quick start data
*/
static void load_quick_start(void)
{
byte tmp8u;
int i;
rd_byte(&previous_char.psex);
rd_byte(&previous_char.prace);
rd_byte(&previous_char.pclass);
rd_byte(&previous_char.realm1);
rd_byte(&previous_char.realm2);
rd_s16b(&previous_char.age);
rd_s16b(&previous_char.ht);
rd_s16b(&previous_char.wt);
rd_s16b(&previous_char.sc);
rd_s32b(&previous_char.au);
for (i = 0; i < 6; i++) rd_s16b(&previous_char.stat_max[i]);
for (i = 0; i < PY_MAX_LEVEL; i++) rd_s16b(&previous_char.player_hp[i]);
rd_s16b(&previous_char.valar_patron);
for (i = 0; i < 4; i++) rd_string(previous_char.history[i], sizeof(previous_char.history[i]));
rd_byte(&previous_char.quests);
rd_byte(&tmp8u);
previous_char.quick_ok = (bool)tmp8u;
}
开发者ID:iks3,项目名称:tinyangband,代码行数:33,代码来源:load.c
示例15: rd_string
/*
* Hack -- read a string
*/
static void rd_string(char *str, int max)
{
int i;
/* Read the string */
for (i = 0; TRUE; i++)
{
byte tmp8u;
/* Read a byte */
rd_byte(&tmp8u);
/* Collect string while legal */
if (i < max) str[i] = tmp8u;
/* End of string */
if (!tmp8u) break;
}
/* Terminate */
str[max-1] = '\0';
#ifdef JP
/* Convert Kanji code */
switch (kanji_code)
{
#ifdef SJIS
case 2:
/* EUC to SJIS */
euc2sjis(str);
break;
#endif
#ifdef EUC
case 3:
/* SJIS to EUC */
sjis2euc(str);
break;
#endif
case 0:
{
/* 不明の漢字コードからシステムの漢字コードに変換 */
byte code = codeconv(str);
/* 漢字コードが判明したら、それを記録 */
if (code) kanji_code = code;
break;
}
default:
/* No conversion needed */
break;
}
#endif
}
开发者ID:iks3,项目名称:tinyangband,代码行数:60,代码来源:load.c
示例16: rd_trap
/**
* Read a trap record
*/
static void rd_trap(struct trap *trap)
{
int i;
char buf[80];
rd_string(buf, sizeof(buf));
if (buf[0]) {
trap->kind = lookup_trap(buf);
trap->t_idx = trap->kind->tidx;
}
rd_byte(&trap->fy);
rd_byte(&trap->fx);
rd_byte(&trap->power);
rd_byte(&trap->timeout);
for (i = 0; i < trf_size; i++)
rd_byte(&trap->flags[i]);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:21,代码来源:load.c
示例17: rd_misc
static int rd_misc(void)
{
byte tmp8u;
/* Read the randart version */
rd_u32b(&randart_version);
/* Read the randart seed */
rd_u32b(&seed_randart);
/* Skip the flags */
strip_bytes(12);
/* Hack -- the two "special seeds" */
rd_u32b(&seed_flavor);
rd_u32b(&seed_town);
/* Special stuff */
rd_u16b(&p_ptr->panic_save);
rd_u16b(&p_ptr->total_winner);
rd_u16b(&p_ptr->noscore);
/* Read "death" */
rd_byte(&tmp8u);
p_ptr->is_dead = tmp8u;
/* Read "feeling" */
rd_byte(&tmp8u);
feeling = tmp8u;
/* Turn of last "feeling" */
rd_s32b(&old_turn);
/* Current turn */
rd_s32b(&turn);
return 0;
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:41,代码来源:load-old.c
示例18: rd_string
void rd_string(char *str, int max)
{
byte tmp8u;
int i = 0;
do {
rd_byte(&tmp8u);
if (i < max) str[i] = tmp8u;
if (!tmp8u) break;
} while (++i);
str[max - 1] = '\0';
}
开发者ID:Daedelus01,项目名称:angband,代码行数:14,代码来源:savefile.c
示例19: rd_options
/**
* Read options.
*/
int rd_options(void)
{
byte b;
u16b tmp16u;
/*** Special info */
/* Read "delay_factor" */
rd_byte(&b);
player->opts.delay_factor = b;
/* Read "hitpoint_warn" */
rd_byte(&b);
player->opts.hitpoint_warn = b;
/* Read lazy movement delay */
rd_u16b(&tmp16u);
player->opts.lazymove_delay = (tmp16u < 1000) ? tmp16u : 0;
/* Read options */
while (1) {
byte value;
char name[40];
rd_string(name, sizeof name);
if (!name[0])
break;
rd_byte(&value);
option_set(name, !!value);
}
return 0;
}
开发者ID:datatypevoid,项目名称:angband,代码行数:39,代码来源:load.c
示例20: rd_monster_memory
/**
* Read monster memory.
*/
int rd_monster_memory(void)
{
u16b tmp16u;
char buf[128];
int i;
/* Monster temporary flags */
rd_byte(&mflag_size);
/* Incompatible save files */
if (mflag_size > MFLAG_SIZE) {
note(format("Too many (%u) monster temporary flags!", mflag_size));
return (-1);
}
/* Reset maximum numbers per level */
for (i = 1; z_info && i < z_info->r_max; i++) {
struct monster_race *race = &r_info[i];
race->max_num = 100;
if (rf_has(race->flags, RF_UNIQUE))
race->max_num = 1;
}
rd_string(buf, sizeof(buf));
while (!streq(buf, "No more monsters")) {
struct monster_race *race = lookup_monster(buf);
/* Get the kill count, skip if monster invalid */
rd_u16b(&tmp16u);
if (!race) continue;
/* Store the kill count, ensure dead uniques stay dead */
l_list[race->ridx].pkills = tmp16u;
if (rf_has(race->flags, RF_UNIQUE) && tmp16u)
race->max_num = 0;
/* Look for the next monster */
rd_string(buf, sizeof(buf));
}
return 0;
}
开发者ID:datatypevoid,项目名称:angband,代码行数:45,代码来源:load.c
注:本文中的rd_byte函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论