本文整理汇总了C#中CSAngband.Parser.hasval方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.hasval方法的具体用法?C# Parser.hasval怎么用?C# Parser.hasval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSAngband.Parser
的用法示例。
在下文中一共展示了Parser.hasval方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse_a_l
public static Parser.Error parse_a_l(Parser p)
{
Artifact a = p.priv as Artifact;
string s;
Misc.assert(a != null);
a.pval[a.num_pvals] = (short)p.getint("pval");
if (!p.hasval("flags"))
return Parser.Error.MISSING_FIELD;
s = p.getstr("flags");
return grab_flag_helper3(s, a);
//t = strtok(s, " |");
//while (t) {
// if (grab_flag(a.flags, OF_SIZE, k_info_flags, t) ||
// grab_flag(a.pval_flags[a.num_pvals], OF_SIZE, k_info_flags, t))
// break;
// t = strtok(null, " |");
//}
//a.num_pvals++;
//if (a.num_pvals > MAX_PVALS)
// return Parser.Error.TOO_MANY_ENTRIES;
//mem_free(s);
//return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例2: parse_c_f
public static Parser.Error parse_c_f(Parser p)
{
Player_Class c = p.priv as Player_Class;
string flags;
if (c == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
flags = p.getstr("flags");
return grab_flag_helper5(flags, c.pflags);
/*s = strtok(flags, " |");
while (s) {
if (grab_flag(c.pflags, PF_SIZE, player_info_flags, s))
break;
s = strtok(null, " |");
}
mem_free(flags);
return s ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}
示例3: parse_r_mf
public static Parser.Error parse_r_mf(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
string flags;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
flags = p.getstr("flags");
return grab_flag_helper_mf(flags, r.flags);
/*
s = strtok(flags, " |");
while (s) {
if (remove_flag(r.flags, RF_SIZE, r_info_flags, s)) {
mem_free(flags);
return Parser.Error.INVALID_FLAG;
}
s = strtok(null, " |");
}
mem_free(flags);
return Parser.Error.NONE;*/
}
示例4: parse_a_f
public static Parser.Error parse_a_f(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
if (!p.hasval("flags"))
return Parser.Error.NONE;
string s = p.getstr("flags");
return grab_flag_helper(s, a.flags);
/*t = strtok(s, " |");
while (t) {
if (grab_flag(a.flags, OF_SIZE, k_info_flags, t))
break;
t = strtok(null, " |");
}
mem_free(s);
return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}
示例5: parse_rb_s
public static Parser.Error parse_rb_s(Parser p)
{
Monster_Base rb = p.priv as Monster_Base;
if (rb == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("spells"))
return Parser.Error.NONE;
string flags = p.getstr("spells");
return grab_flag_helper_msf(flags, rb.spell_flags);
//s = strtok(flags, " |");
//while (s) {
// if (grab_flag(rb.spell_flags, RSF_SIZE, r_info_spell_flags, s)) {
// mem_free(flags);
// return Parser.Error.INVALID_FLAG;
// }
// s = strtok(null, " |");
//}
//mem_free(flags);
//return Parser.Error.NONE;
}
示例6: parse_r_b
public static Parser.Error parse_r_b(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
int i;
random_value dam;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
for (i = 0; i < Monster_Blow.MONSTER_BLOW_MAX; i++)
//used to check .method
if (r.blow[i] == null)
break;
if (i == Monster_Blow.MONSTER_BLOW_MAX)
return Parser.Error.TOO_MANY_ENTRIES;
r.blow[i] = new Monster_Blow();
r.blow[i].method = find_blow_method(p.getsym("method"));
if (r.blow[i].method == null)
return Parser.Error.UNRECOGNISED_BLOW;
if (p.hasval("effect")) {
r.blow[i].effect = find_blow_effect(p.getsym("effect"));
if (r.blow[i].effect == null)
return Parser.Error.INVALID_EFFECT;
}
if (p.hasval("damage")) {
dam = p.getrand("damage");
r.blow[i].d_dice = (byte)dam.dice;
r.blow[i].d_side = (byte)dam.sides;
}
return Parser.Error.NONE;
}
示例7: parse_p_c
public static Parser.Error parse_p_c(Parser p)
{
Player_Race r = p.priv as Player_Race;
string classes;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("classes"))
return Parser.Error.NONE;
classes = p.getstr("classes");
string[] tokens = classes.Split(new string[]{" ", "|"}, StringSplitOptions.RemoveEmptyEntries);
foreach(string token in tokens) {
r.choice |= (byte)(1 << int.Parse(token));
}
return Parser.Error.NONE;
}
示例8: parse_p_y
public static Parser.Error parse_p_y(Parser p)
{
Player_Race r = p.priv as Player_Race;
string flags;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
flags = p.getstr("flags");
return grab_flag_helper5(flags, r.pflags);
//s = strtok(flags, " |");
//while (s) {
// if (grab_flag(r.pflags, PF_SIZE, player_info_flags, s))
// break;
// s = strtok(null, " |");
//}
//mem_free(flags);
//return s ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例9: parse_k_l
public static Parser.Error parse_k_l(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.pval[k.num_pvals] = p.getrand("pval");
if (!p.hasval("flags")) {
k.num_pvals++;
return Parser.Error.NONE;
}
string s = p.getstr("flags");
//return grab_flag_helper(s, k.pval_flags[k.num_pvals]);
string[] t = s.Split(new string[] { " ", "|" }, StringSplitOptions.RemoveEmptyEntries);
string temp;
foreach(string token in t) {
temp = token;
if(grab_flag(k.flags, Object_Flag.list, token) != Parser.Error.NONE ||
grab_flag(k.pval_flags[k.num_pvals], Object_Flag.list, token) != Parser.Error.NONE) {
return Parser.Error.INVALID_FLAG;
}
}
k.num_pvals++;
if (k.num_pvals > Misc.MAX_PVALS)
return Parser.Error.TOO_MANY_ENTRIES;
return Parser.Error.NONE;
//t = strtok(s, " |");
//while (t) {
// if (grab_flag(k.flags, OF_SIZE, k_info_flags, t) ||
// grab_flag(k.pval_flags[k.num_pvals], OF_SIZE, k_info_flags, t))
// break;
// t = strtok(null, " |");
//}
//k.num_pvals++;
//if (k.num_pvals > MAX_PVALS)
// return Parser.Error.TOO_MANY_ENTRIES;
//mem_free(s);
//return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例10: parse_pit_s2
public static Parser.Error parse_pit_s2(Parser p)
{
Pit_Profile pit = p.priv as Pit_Profile;
string flags;
if (pit == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("spells"))
return Parser.Error.NONE;
flags = p.getstr("spells");
return grab_flag_helper_msf(flags, pit.forbidden_spell_flags);
/*
s = strtok(flags, " |");
while (s) {
if (grab_flag(pit.forbidden_spell_flags, RSF_SIZE, r_info_spell_flags, s)) {
mem_free(flags);
return Parser.Error.INVALID_FLAG;
}
s = strtok(null, " |");
}
mem_free(flags);
return Parser.Error.NONE;*/
}
示例11: parse_k_e
public static Parser.Error parse_k_e(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.effect = grab_one_effect(p.getsym("name"));
if (p.hasval("time"))
k.time = p.getrand("time");
if (k.effect == null)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例12: parse_f_f
public static Parser.Error parse_f_f(Parser p)
{
Feature f = p.priv as Feature;
if (f == null) return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
string flags = p.getstr("flags");
//Nick's implementation, need to test this!
string[] tokens = flags.Split(new string[] { " ", "|" }, StringSplitOptions.RemoveEmptyEntries);
foreach(string s in tokens) {
if(grab_one_flag(out f.flags, f.flags, Misc.f_info_flags, s) != Parser.Error.NONE) {
return Parser.Error.INVALID_FLAG;
}
}
//old C way of doing it
/*s = strtok(flags, " |");
while (s) {
if (grab_one_flag(&f.flags, Misc.f_info_flags, s)) {
mem_free(s);
return Parser.Error.INVALID_FLAG;
}
s = strtok(null, " |");
}*/
return Parser.Error.NONE;
}
示例13: parse_flavor_n
/* Parsing functions for flavor.txt */
public static Parser.Error parse_flavor_n(Parser p)
{
Flavor h = p.priv as Flavor;
Flavor f = new Flavor();
f.next = h;
f.fidx = p.getuint("index");
f.tval = (byte)TVal.find_idx(p.getsym("tval"));
/* Misc.assert(f.tval); */
if (p.hasval("sval"))
f.sval = (byte)SVal.lookup_sval(f.tval, p.getsym("sval"));
else
f.sval = SVal.SV_UNKNOWN;
p.priv = f;
return Parser.Error.NONE;
}
示例14: parse_e_l
public static Parser.Error parse_e_l(Parser p)
{
Ego_Item e = p.priv as Ego_Item;
if (e == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.MISSING_FIELD;
e.pval[e.num_pvals] = p.getrand("pval");
e.min_pval[e.num_pvals] = (byte)p.getint("min");
string s = p.getstr("flags");
return grab_flag_helper2(s, e);
/*t = strtok(s, " |");
while (t) {
if (grab_flag(e.flags, OF_SIZE, k_info_flags, t) ||
grab_flag(e.pval_flags[e.num_pvals], OF_SIZE, k_info_flags, t))
break;
t = strtok(null, " |");
}
e.num_pvals++;
if (e.num_pvals > MAX_PVALS)
return Parser.Error.TOO_MANY_ENTRIES;
mem_free(s);
return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}
示例15: parse_e_f
public static Parser.Error parse_e_f(Parser p)
{
Ego_Item e = p.priv as Ego_Item;
if (e == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
string s = p.getstr("flags");
return grab_flag_helper(s, e.flags);
/*
t = strtok(s, " |");
while (t) {
if (grab_flag(e.flags, OF_SIZE, k_info_flags,t))
break;
t = strtok(null, " |");
}
mem_free(s);
return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}