예제 #1
0
        public AIMap(CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(TAG);
            Dictionary <string, string> A = bin.getAttributes();

            int  width  = EncodeUtil.parseInt(A[GAME_MAP_WIDTH_ATTR]);
            int  height = EncodeUtil.parseInt(A[GAME_MAP_HEIGHT_ATTR]);
            bool vwrap  = EncodeUtil.fromBoolString(A[GAME_MAP_VWRAP_ATTR]);
            bool hwrap  = EncodeUtil.fromBoolString(A[GAME_MAP_HWRAP_ATTR]);

            mapUtil_ = new CMapUtil(width, hwrap, height, vwrap);

            stackCount_ = EncodeUtil.parseUInt(A[STACKCOUNT]);

            string mb = bin.getObjectText(TMAP_TAG);

            mapBytes_ = mb.ToCharArray();

            var tmp = new List <string>();

            EncodeUtil.decodeStringList(WASTELAND, tmp, bin);
            foreach (string s in tmp)
            {
                wasteland_.Add(s, true);
            }
            tmp.Clear();

            EncodeUtil.decodeStringList(MINES, tmp, bin);
            foreach (string s in tmp)
            {
                mines_.Add(s, true);
            }
            tmp.Clear();

            EncodeUtil.decodeStringList(ROAD, tmp, bin);
            foreach (string s in tmp)
            {
                roads_.Add(s, true);
            }
            tmp.Clear();

            EncodeUtil.decodeDSI(RESOURCES, resources_, bin);


            bin.endTag(TAG);
        }