Пример #1
0
        static Store[] flatten_stores(Store store_list)
        {
            Store s;
            Store[] stores = new Store[(int)STORE.MAX_STORES];

            for(s = store_list; s != null; s = s.next) {
                /* XXX bounds-check */
                stores[(int)s.sidx] = s;
            }

            return stores;
        }
Пример #2
0
        static Store add_builtin_stores(Store stores)
        {
            Store s0, s1, s2;

            s0 = new Store(STORE.GENERAL);
            s1 = new Store(STORE.B_MARKET);
            s2 = new Store(STORE.HOME);

            s0.next = stores;
            s1.next = s0;
            s2.next = s1;

            return s2;
        }
Пример #3
0
        static Parser.Error parse_s(Parser p)
        {
            Store h = p.priv as Store;
            Store s;
            uint idx = p.getuint("index") - 1;
            uint slots = p.getuint("slots");

            if(idx < (uint)STORE.ARMOR || idx > (uint)STORE.MAGIC)
                return Parser.Error.OUT_OF_BOUNDS;

            s = new Store((STORE)(p.getuint("index") - 1));
            s.table = new Object_Kind[slots];
            s.table_size = slots;
            s.next = h;
            p.priv = s;
            return Parser.Error.NONE;
        }
Пример #4
0
 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;
 }
Пример #5
0
 static void parse_owners(Store stores)
 {
     Parser p = store_owner_parser_new(stores);
     p.parse_file("shop_own");
     p.Destroy();
 }