本文整理汇总了C++中parser_getstr函数的典型用法代码示例。如果您正苦于以下问题:C++ parser_getstr函数的具体用法?C++ parser_getstr怎么用?C++ parser_getstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parser_getstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parse_r_s
static enum parser_error parse_r_s(struct parser *p) {
struct monster_race *r = parser_priv(p);
char *flags;
char *s;
int pct;
int ret = PARSE_ERROR_NONE;
if (!r)
return PARSE_ERROR_MISSING_RECORD_HEADER;
flags = string_make(parser_getstr(p, "spells"));
s = strtok(flags, " |");
while (s) {
if (1 == sscanf(s, "1_IN_%d", &pct)) {
if (pct < 1 || pct > 100) {
ret = PARSE_ERROR_INVALID_SPELL_FREQ;
break;
}
r->freq_spell = 100 / pct;
r->freq_innate = r->freq_spell;
} else {
if (grab_flag(r->spell_flags, RSF_SIZE, r_info_spell_flags, s)) {
ret = PARSE_ERROR_INVALID_FLAG;
break;
}
}
s = strtok(NULL, " |");
}
/* Add the "base monster" flags to the monster */
if (r->base)
rsf_union(r->spell_flags, r->base->spell_flags);
mem_free(flags);
return ret;
}
开发者ID:jenschou,项目名称:angband,代码行数:35,代码来源:init.c
示例2: parse_r_d
static enum parser_error parse_r_d(struct parser *p) {
struct monster_race *r = parser_priv(p);
if (!r)
return PARSE_ERROR_MISSING_RECORD_HEADER;
r->text = string_append(r->text, parser_getstr(p, "desc"));
return PARSE_ERROR_NONE;
}
开发者ID:jenschou,项目名称:angband,代码行数:8,代码来源:init.c
示例3: parse_vault_type
static enum parser_error parse_vault_type(struct parser *p) {
struct vault *v = parser_priv(p);
if (!v)
return PARSE_ERROR_MISSING_RECORD_HEADER;
v->typ = string_make(parser_getstr(p, "type"));
return PARSE_ERROR_NONE;
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:8,代码来源:generate.c
示例4: parse_rb_n
static enum parser_error parse_rb_n(struct parser *p) {
struct monster_base *h = parser_priv(p);
struct monster_base *rb = mem_zalloc(sizeof *rb);
rb->next = h;
rb->name = string_make(parser_getstr(p, "name"));
parser_setpriv(p, rb);
return PARSE_ERROR_NONE;
}
开发者ID:jenschou,项目名称:angband,代码行数:8,代码来源:init.c
示例5: parse_v_d
static enum parser_error parse_v_d(struct parser *p) {
struct vault *v = parser_priv(p);
if (!v)
return PARSE_ERROR_MISSING_RECORD_HEADER;
v->text = string_append(v->text, parser_getstr(p, "text"));
return PARSE_ERROR_NONE;
}
开发者ID:myshkin,项目名称:angband,代码行数:8,代码来源:generate.c
示例6: parse_room_d
static enum parser_error parse_room_d(struct parser *p) {
struct room_template *t = parser_priv(p);
if (!t)
return PARSE_ERROR_MISSING_RECORD_HEADER;
t->text = string_append(t->text, parser_getstr(p, "text"));
return PARSE_ERROR_NONE;
}
开发者ID:myshkin,项目名称:angband,代码行数:8,代码来源:generate.c
示例7: helper_str0
static enum parser_error helper_str0(struct parser *p) {
const char *s = parser_getstr(p, "s0");
int *wasok = parser_priv(p);
if (!s || strcmp(s, "foo:bar:baz quxx..."))
return PARSE_ERROR_GENERIC;
*wasok = 1;
return PARSE_ERROR_NONE;
}
开发者ID:Axydlbaaxr,项目名称:angband,代码行数:8,代码来源:parse.c
示例8: parse_graf_p
static enum parser_error parse_graf_p(struct parser *p) {
graphics_mode *mode = parser_priv(p);
if (!mode) {
return PARSE_ERROR_INVALID_VALUE;
}
strncpy(mode->pref, parser_getstr(p, "prefname"), 32);
return PARSE_ERROR_NONE;
}
开发者ID:Abigail,项目名称:angband,代码行数:8,代码来源:grafmode.c
示例9: parse_summon_name
static enum parser_error parse_summon_name(struct parser *p) {
struct summon *h = parser_priv(p);
struct summon *s = mem_zalloc(sizeof *s);
s->next = h;
parser_setpriv(p, s);
s->name = string_make(parser_getstr(p, "name"));
return PARSE_ERROR_NONE;
}
开发者ID:magnate,项目名称:angband,代码行数:9,代码来源:mon-summon.c
示例10: parse_r_n
/* Parsing functions for monster.txt */
static enum parser_error parse_r_n(struct parser *p) {
struct monster_race *h = parser_priv(p);
struct monster_race *r = mem_zalloc(sizeof *r);
r->next = h;
r->ridx = parser_getuint(p, "index");
r->name = string_make(parser_getstr(p, "name"));
parser_setpriv(p, r);
return PARSE_ERROR_NONE;
}
开发者ID:jenschou,项目名称:angband,代码行数:10,代码来源:init.c
示例11: parse_vault_name
/**
* Parsing functions for vault.txt
*/
static enum parser_error parse_vault_name(struct parser *p) {
struct vault *h = parser_priv(p);
struct vault *v = mem_zalloc(sizeof *v);
v->name = string_make(parser_getstr(p, "name"));
v->next = h;
parser_setpriv(p, v);
return PARSE_ERROR_NONE;
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:12,代码来源:generate.c
示例12: parse_room_name
/**
* Parsing functions for room_template.txt
*/
static enum parser_error parse_room_name(struct parser *p) {
struct room_template *h = parser_priv(p);
struct room_template *t = mem_zalloc(sizeof *t);
t->name = string_make(parser_getstr(p, "name"));
t->next = h;
parser_setpriv(p, t);
return PARSE_ERROR_NONE;
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:12,代码来源:generate.c
示例13: parse_graf_i
static enum parser_error parse_graf_i(struct parser *p) {
graphics_mode *mode = parser_priv(p);
if (!mode) {
return PARSE_ERROR_INVALID_VALUE;
}
mode->cell_width = parser_getuint(p, "wid");
mode->cell_height = parser_getuint(p, "hgt");
strncpy(mode->file, parser_getstr(p, "filename"), 32);
return PARSE_ERROR_NONE;
}
开发者ID:Abigail,项目名称:angband,代码行数:10,代码来源:grafmode.c
示例14: parse_prefs_y
static enum parser_error parse_prefs_y(struct parser *p)
{
struct prefs_data *d = parser_priv(p);
assert(d != NULL);
if (d->bypass) return PARSE_ERROR_NONE;
option_set(parser_getstr(p, "option"), TRUE);
return PARSE_ERROR_NONE;
}
开发者ID:apwhite,项目名称:angband,代码行数:10,代码来源:prefs.c
示例15: parse_prefs_x
static enum parser_error parse_prefs_x(struct parser *p)
{
struct prefs_data *d = parser_priv(p);
assert(d != NULL);
if (d->bypass) return PARSE_ERROR_NONE;
/* XXX check for valid option */
option_set(parser_getstr(p, "option"), FALSE);
return PARSE_ERROR_NONE;
}
开发者ID:apwhite,项目名称:angband,代码行数:11,代码来源:prefs.c
示例16: parse_quest_name
/**
* Parsing functions for quest.txt
*/
static enum parser_error parse_quest_name(struct parser *p) {
const char *name = parser_getstr(p, "name");
struct quest *h = parser_priv(p);
struct quest *q = mem_zalloc(sizeof(*q));
q->next = h;
parser_setpriv(p, q);
q->name = string_make(name);
return PARSE_ERROR_NONE;
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:14,代码来源:player-quest.c
示例17: parse_quest_race
static enum parser_error parse_quest_race(struct parser *p) {
struct quest *q = parser_priv(p);
const char *name = parser_getstr(p, "race");
assert(q);
q->race = lookup_monster(name);
if (!q->race)
return PARSE_ERROR_INVALID_MONSTER;
return PARSE_ERROR_NONE;
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:11,代码来源:player-quest.c
示例18: helper_char1
static enum parser_error helper_char1(struct parser *p) {
char c0 = parser_getchar(p, "c0");
char c1 = parser_getchar(p, "c1");
int i0 = parser_getint(p, "i0");
const char *s = parser_getstr(p, "s");
int *wasok = parser_priv(p);
if (c0 != ':' || c1 != ':' || i0 != 34 || !streq(s, "lala"))
return PARSE_ERROR_GENERIC;
*wasok = 1;
return PARSE_ERROR_NONE;
}
开发者ID:Axydlbaaxr,项目名称:angband,代码行数:12,代码来源:parse.c
示例19: parse_prefs_load
/**
* Load another file.
*/
static enum parser_error parse_prefs_load(struct parser *p)
{
struct prefs_data *d = parser_priv(p);
const char *file;
assert(d != NULL);
if (d->bypass) return PARSE_ERROR_NONE;
file = parser_getstr(p, "file");
(void)process_pref_file(file, TRUE, d->user);
return PARSE_ERROR_NONE;
}
开发者ID:creidieki,项目名称:angband,代码行数:16,代码来源:prefs.c
示例20: parse_buy
static enum parser_error parse_buy(struct parser *p) {
struct store *s = parser_priv(p);
struct object_buy *buy;
if (!s)
return PARSE_ERROR_MISSING_RECORD_HEADER;
buy = mem_zalloc(sizeof(*buy));
buy->tval = tval_find_idx(parser_getstr(p, "base"));
buy->next = s->buy;
s->buy = buy;
return PARSE_ERROR_NONE;
}
开发者ID:batogz,项目名称:angband,代码行数:13,代码来源:store.c
注:本文中的parser_getstr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论