• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSAngband.Parser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Parser类属于CSAngband命名空间,在下文中一共展示了Parser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: print_error

 /* More angband-specific bits of the parser
  * These require hooks into other parts of the code, and are a candidate for
  * moving elsewhere.
  */
 static void print_error(Parser p)
 {
     throw new NotImplementedException();
     //struct parser_state s;
     //parser_getstate(p, &s);
     //msg("Parse error in %s line %d column %d: %s: %s", fp.name,
     //           s.line, s.col, s.msg, parser_error_str[s.error]);
     //message_flush();
     //quit_fmt("Parse error in %s line %d column %d.", fp.name, s.line, s.col);
 }
开发者ID:jobjingjo,项目名称:csangband,代码行数:14,代码来源:File_Parser.cs


示例2: init_parse_rb

        public static Parser init_parse_rb()
        {
            Parser p = new Parser();
            p.priv = null;

            p.Register("V sym version", Parser.Ignored);
            p.Register("N str name", parse_rb_n);
            p.Register("G char glyph", parse_rb_g);
            p.Register("M uint pain", parse_rb_m);
            p.Register("F ?str flags", parse_rb_f);
            p.Register("S ?str spells", parse_rb_s);
            p.Register("D str desc", parse_rb_d);
            return p;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:14,代码来源:Init2.cs


示例3: store_owner_parser_new

 static Parser store_owner_parser_new(Store stores)
 {
     Parser p = new Parser();
     owner_parser_state s = new owner_parser_state();
     s.stores = stores;
     s.cur = null;
     p.priv = s;
     p.Register("V sym version", Parser.Ignored);
     p.Register("N uint index", parse_own_n);
     p.Register("S uint maxcost str name", parse_own_s);
     return p;
 }
开发者ID:jobjingjo,项目名称:csangband,代码行数:12,代码来源:Store.cs


示例4: parse_own_s

        static Parser.Error parse_own_s(Parser p)
        {
            owner_parser_state s = p.priv as owner_parser_state;
            uint maxcost = p.getuint("maxcost");
            string name = p.getstr("name");
            Owner o;

            if (s.cur == null)
                return Parser.Error.MISSING_RECORD_HEADER;

            o = new Owner();
            o.oidx = (s.cur.owners != null ? s.cur.owners.oidx + 1 : 0);
            o.next = s.cur.owners;
            o.name = name;
            o.max_cost = (int)maxcost;
            s.cur.owners = o;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:18,代码来源:Store.cs


示例5: parse_i

        static Parser.Error parse_i(Parser p)
        {
            Store s = p.priv as Store;
            uint slots = p.getuint("slots");
            int tval = TVal.find_idx(p.getsym("tval"));
            int sval = SVal.lookup_sval(tval, p.getsym("sval"));
            Object_Kind kind = Object_Kind.lookup_kind(tval, sval);

            if(kind == null)
                return Parser.Error.UNRECOGNISED_SVAL;

            if(s.table_num + slots > s.table_size)
                return Parser.Error.TOO_MANY_ENTRIES;
            while(slots-- != 0) {
                s.table[s.table_num++] = kind;
            }
            /* XXX: get rid of this table_size/table_num/indexing thing. It's
             * stupid. Dynamically allocate. */
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:20,代码来源:Store.cs


示例6: parse_c_n

 /* Parsing functions for pclass.txt */
 public static Parser.Error parse_c_n(Parser p)
 {
     Player_Class h = p.priv as Player_Class;
     Player_Class c = new Player_Class();
     c.cidx = p.getuint("index");
     c.Name = p.getstr("name");
     c.next = h;
     p.priv = c;
     return Parser.Error.NONE;
 }
开发者ID:jobjingjo,项目名称:csangband,代码行数:11,代码来源:Init2.cs


示例7: parse_c_i

        public static Parser.Error parse_c_i(Parser p)
        {
            Player_Class c = p.priv as Player_Class;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            c.c_mhp = (short)p.getint("mhp");
            c.c_exp = (short)p.getint("exp");
            c.sense_base = (uint)p.getint("sense-base");
            c.sense_div = (ushort)p.getint("sense-div");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:12,代码来源:Init2.cs


示例8: parse_c_e

        public static Parser.Error parse_c_e(Parser p)
        {
            Player_Class c = p.priv as Player_Class;
            Start_Item si;
            int tval, sval;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;

            tval = TVal.find_idx(p.getsym("tval"));
            if (tval < 0)
                return Parser.Error.UNRECOGNISED_TVAL;

            sval = SVal.lookup_sval(tval, p.getsym("sval"));
            if (sval < 0)
                return Parser.Error.UNRECOGNISED_SVAL;

            si = new Start_Item();
            si.kind = Object_Kind.objkind_get(tval, sval);
            si.min = (byte)p.getuint("min");
            si.max = (byte)p.getuint("max");

            if (si.min > 99 || si.max > 99) {
                //mem_free(si.kind);
                return Parser.Error.INVALID_ITEM_NUMBER;
            }

            si.next = c.start_items;
            c.start_items = si;

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:32,代码来源:Init2.cs


示例9: 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;*/
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:20,代码来源:Init2.cs


示例10: parse_a_e

        public static Parser.Error parse_a_e(Parser p)
        {
            Artifact a = p.priv as Artifact;
            Misc.assert(a != null);

            a.effect = grab_one_effect(p.getsym("name"));
            a.time = p.getrand("time");
            if (a.effect == null)
                return Parser.Error.GENERIC;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:11,代码来源:Init2.cs


示例11: parse_a_d

        public static Parser.Error parse_a_d(Parser p)
        {
            Artifact a = p.priv as Artifact;
            Misc.assert(a != null);

            a.Text = a.Text + p.getstr("text");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:8,代码来源:Init2.cs


示例12: parse_a_a

        public static Parser.Error parse_a_a(Parser p)
        {
            Artifact a = p.priv as Artifact;
            string tmp = p.getstr("minmax");
            int amin, amax;
            Misc.assert(a != null);

            a.alloc_prob = (byte)p.getint("common");

            string[] tokens = tmp.Split(new string[] { " to " }, StringSplitOptions.RemoveEmptyEntries);
            if(tokens.Length != 2)
                return Parser.Error.GENERIC;
            if(!int.TryParse(tokens[0], out amin) || !int.TryParse(tokens[1], out amax))
                return Parser.Error.GENERIC;

            if (amin > 255 || amax > 255 || amin < 0 || amax < 0)
                return Parser.Error.OUT_OF_BOUNDS;

            a.alloc_min = (byte)amin;
            a.alloc_max = (byte)amax;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:22,代码来源:Init2.cs


示例13: init_parse_z

        public static Parser init_parse_z()
        {
            Maxima z = new Maxima();
            Parser p = new Parser();

            p.priv = z;
            p.Register("V sym version", Parser.Ignored);
            p.Register("M sym label int value", parse_z);
            return p;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:10,代码来源:Init2.cs


示例14: init_parse_v

 public static Parser init_parse_v()
 {
     Parser p = new Parser();
     p.priv = null;
     p.Register("V sym version", Parser.Ignored);
     p.Register("N uint index str name", parse_v_n);
     p.Register("X uint type int rating uint height uint width", parse_v_x);
     p.Register("D str text", parse_v_d);
     return p;
 }
开发者ID:jobjingjo,项目名称:csangband,代码行数:10,代码来源:Init2.cs


示例15: init_parse_s

 public static Parser init_parse_s()
 {
     Parser p = new Parser();
     p.priv = null;
     p.Register("V sym version", Parser.Ignored);
     p.Register("N uint index str name", parse_s_n);
     p.Register("I uint tval uint sval uint snum", parse_s_i);
     p.Register("D str desc", parse_s_d);
     return p;
 }
开发者ID:jobjingjo,项目名称:csangband,代码行数:10,代码来源:Init2.cs


示例16: parse_c_b

        public static Parser.Error parse_c_b(Parser p)
        {
            Player_Class c = p.priv as Player_Class;
            uint spell;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            spell = p.getuint("spell");
            if (spell >= Misc.PY_MAX_SPELLS)
                return Parser.Error.OUT_OF_BOUNDS;
            c.spells.info[spell] = new Magic_Type();
            c.spells.info[spell].slevel = (byte)p.getint("level");
            c.spells.info[spell].smana = (byte)p.getint("mana");
            c.spells.info[spell].sfail = (byte)p.getint("fail");
            c.spells.info[spell].sexp = (byte)p.getint("exp");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:17,代码来源:Init2.cs


示例17: parse_c_c

        public static Parser.Error parse_c_c(Parser p)
        {
            Player_Class c = p.priv as Player_Class;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            c.c_skills[(int)Skill.DISARM] = (short)p.getint("dis");
            c.c_skills[(int)Skill.DEVICE] = (short)p.getint("dev");
            c.c_skills[(int)Skill.SAVE] = (short)p.getint("sav");
            c.c_skills[(int)Skill.STEALTH] = (short)p.getint("stl");
            c.c_skills[(int)Skill.SEARCH] = (short)p.getint("srh");
            c.c_skills[(int)Skill.SEARCH_FREQUENCY] = (short)p.getint("fos");
            c.c_skills[(int)Skill.TO_HIT_MELEE] = (short)p.getint("thm");
            c.c_skills[(int)Skill.TO_HIT_BOW] = (short)p.getint("thb");
            c.c_skills[(int)Skill.TO_HIT_THROW] = (short)p.getint("throw");
            c.c_skills[(int)Skill.DIGGING] = (short)p.getint("dig");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:18,代码来源:Init2.cs


示例18: parse_a_i

        public static Parser.Error parse_a_i(Parser p)
        {
            Artifact a = p.priv as Artifact;
            Misc.assert(a != null);

            int tval = TVal.find_idx(p.getsym("tval"));
            if (tval < 0)
                return Parser.Error.UNRECOGNISED_TVAL;
            a.tval = (byte)tval;

            int sval = SVal.lookup_sval(a.tval, p.getsym("sval"));
            if (sval < 0)
                return Parser.Error.UNRECOGNISED_SVAL;
            a.sval = (byte)sval;

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:17,代码来源:Init2.cs


示例19: 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;*/
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:23,代码来源:Init2.cs


示例20: 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;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:30,代码来源:Init2.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NPP.NppiPoint类代码示例发布时间:2022-05-24
下一篇:
C# Common.Message类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap