Exemplo n.º 1
0
        public CPlayer(CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(TAG);
            Dictionary <string, string> A = bin.getAttributes();

            originalPosition_ = EncodeUtil.parseInt(A[ORIGINAL_POSITION]);
            position_         = EncodeUtil.parseInt(A[POSITION]);
            buypoints_        = EncodeUtil.parseInt(A[BUYPOINTS]);
            buypointsSpent_   = EncodeUtil.parseInt(A[BUYPOINTSSPENT]);
            score_            = EncodeUtil.parseInt(A[SCORE]);
            pcap_             = EncodeUtil.parseInt(A[PCAP]);
            ccap_             = EncodeUtil.parseInt(A[CCAP]);
            ncap_             = EncodeUtil.parseInt(A[NCAP]);
            living_           = EncodeUtil.fromBoolString(A[LIVING]);

            type_ = bin.getObjectText(TYPE_TAG);
            if (bin.thisTag() == PNAME_TAG)
            {
                pname_ = bin.getObjectText(PNAME_TAG);
            }
            else
            {
                pname_ = null;
            }
            if (bin.thisTag() == DEAD_REASON_TAG)
            {
                deadReason_ = bin.getObjectText(DEAD_REASON_TAG);
            }
            else
            {
                deadReason_ = null;
            }

            bin.endTag(TAG);
        }
Exemplo n.º 2
0
 // ReSharper disable UnusedParameter.Local
 protected CDLLHintInfo(string type, Dictionary <string, string> attr, CEncodedObjectInputBufferI bin)
 // ReSharper restore UnusedParameter.Local
 {
     type_ = type;
     key_  = bin.getObjectText(KTAG);
     name_ = bin.getObjectText(NTAG);
     desc_ = bin.getObjectText(DTAG);
 }
Exemplo n.º 3
0
 public CDLLInfo(CEncodedObjectInputBufferI bin)
 {
     bin.nextTag(TAG);
     key_     = bin.getObjectText(KTAG);
     name_    = bin.getObjectText(NTAG);
     desc_    = bin.getObjectText(DTAG);
     version_ = bin.getObjectText(VTAG);
     bin.endTag(TAG);
 }
Exemplo n.º 4
0
        public CProductionReportData(CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(TAG);
            Dictionary <string, string> A = bin.getAttributes();

            value_ = EncodeUtil.parseInt(A[VALUE]);
            pkey_  = EncodeUtil.parseUInt(A[PKEY]);
            ckey_  = EncodeUtil.parseUInt(A[CKEY]);

            rtype_ = bin.getObjectText(RTYPE);
            if (bin.thisTag() == REPORT)
            {
                report_ = bin.getObjectText(REPORT);
            }
            else
            {
                report_ = null;
            }

            if (bin.thisTag() == PTYPE)
            {
                ptype_ = bin.getObjectText(PTYPE);
            }
            else
            {
                ptype_ = null;
            }

            if (bin.thisTag() == CTYPE)
            {
                ctype_ = bin.getObjectText(CTYPE);
            }
            else
            {
                ctype_ = null;
            }

            if (bin.thisTag() == LOC)
            {
                loc_ = CLoc.fromKey(bin.getObjectText(LOC));
            }
            else
            {
                loc_ = null;
            }

            bin.endTag(TAG);
        }
Exemplo n.º 5
0
        public COrder(CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(TAG);

            Dictionary <string, string> A = bin.getAttributes();

            ordType_ = A[ORDTYPE];
            value_   = EncodeUtil.parseInt(A[VALUE]);
            if (A.ContainsKey(UTYPE))
            {
                utype_ = A[UTYPE];
            }
            flag_      = EncodeUtil.fromBoolString(A[FLAG]);
            ugid_      = EncodeUtil.parseUInt(A[UGID]);
            useEmbark_ = EncodeUtil.fromBoolString(A[UGID]);

            bin.firstChild();
            bin.nextTag(LOCS);
            if (bin.hasChildren())
            {
                bin.firstChild();
                locs_ = new List <CLoc>();
                while (!bin.reachedEndTag(LOCS))
                {
                    CLoc l = CLoc.fromKey(bin.getObjectText(LOC));
                    locs_.Add(l);
                }
            }
            bin.endTag(LOCS);


            bin.endTag(TAG);
        }
Exemplo n.º 6
0
        public CDLLNameValueHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin) : base(NAME_VALUE_SET, attr, bin)
        {
            defkey_ = attr[DEF_ATTR];
            value_  = attr[VALUE_ATTR];

            bin.nextTag(SETS_TAG);

            if (bin.hasChildren())
            {
                while (!bin.reachedEndTag(SETS_TAG))
                {
                    bin.nextTag(SET_TAG);
                    string k = bin.getObjectText(KEY_TAG);
                    string v = bin.getObjectText(VALUE_TAG);
                    set_.Add(k, v);
                    bin.endTag(SET_TAG);
                }
            }
            bin.endTag(SETS_TAG);
        }
Exemplo n.º 7
0
        public CProposal(CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(TAG);
            Dictionary <string, string> A = bin.getAttributes();

            type_   = A[TYPE];
            fromP_  = EncodeUtil.parseInt(A[FROM]);
            toP_    = EncodeUtil.parseInt(A[TO]);
            gid_    = EncodeUtil.parseUInt(A[GID]);
            id_     = EncodeUtil.parseUInt(A[ID]);
            status_ = A[STATUS];
            name_   = bin.getObjectText(NAME);
            bin.endTag(TAG);
        }
Exemplo n.º 8
0
        public CMTRandom(string tag, CEncodedObjectInputBufferI bin)
        {
            bin.nextTag(tag);
            Dictionary <string, string> attr = bin.getAttributes();
            //with seeded constructor, run use count up to appropriate total
            int useCount = EncodeUtil.parseInt(attr[USE_COUNT_ATTR]);

            seedUsed_ = ulong.Parse(bin.getObjectText(SEED_TAG));
            twister_  = new CMersenneTwister(seedUsed_);
            for (int i = 0; i < useCount; i++)
            {
                random(2);
            }
            bin.endTag(tag);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        protected CUnit(Dictionary <string, string> A, CEncodedObjectInputBufferI bin, AIQueryI query)
        {
            utype_      = A[UTYPE];
            loc_        = CLoc.fromKey(A[LOC]);
            gid_        = EncodeUtil.parseUInt(A[GID]);
            owner_      = EncodeUtil.parseInt(A[OWNER]);
            stackLayer_ = EncodeUtil.parseUInt(A[STACKLAYER]);
            level_      = A[LEVEL];
            landed_     = EncodeUtil.fromBoolString(A[LANDED]);
            inReentry_  = EncodeUtil.fromBoolString(A[INREENTRY]);
            host_       = EncodeUtil.parseUInt(A[HOST]);
            turn_       = EncodeUtil.parseInt(A[TURN]);
            rmvr_       = EncodeUtil.parseInt(A[RMVR]);
            rmvs_       = EncodeUtil.parseInt(A[RMVS]);
            fired_      = EncodeUtil.fromBoolString(A[FIRED]);
            armed_      = EncodeUtil.fromBoolString(A[ARMED]);
            dmg_        = EncodeUtil.parseInt(A[DMG]);
            shortFuel_  = EncodeUtil.fromBoolString(A[SHORTFUEL]);
            sawEnemy_   = EncodeUtil.fromBoolString(A[SAWENEMY]);
            dugIn_      = EncodeUtil.fromBoolString(A[DUGIN]);
            experience_ = EncodeUtil.parseUInt(A[EXPERIENCE]);
            readiness_  = A[READINESS];
            expType_    = A[EXPTYPE];

            name_ = bin.getObjectText(NAME);

            bin.nextTag(CUNITS);
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(CUNITS))
                {
                    bin.nextTag(CUNIT);
                    Dictionary <string, string> D = bin.getAttributes();
                    uint u = EncodeUtil.parseUInt(D[CUNITID]);
                    cunits_.Add(u);
                    bin.endTag(CUNIT);
                }
            }
            bin.endTag(CUNITS);

            ord_ = new COrder(bin);

            entry_ = query.unitQuery(utype_);
        }
Exemplo n.º 11
0
        public CDLLLockableHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin)
            : base(LOCKED_CONTAINER_TYPE, attr, bin)
        {
            //int nc = EncodeUtil.parseInt(attr[NUM_CHILDREN]);
            sig_    = EncodeUtil.parseUInt(attr[SIG_ATTR]);
            locked_ = EncodeUtil.fromBoolString(attr[LOCKED_ATTR]);
            infos_  = new List <CDLLHintInfo>();

            lockname_ = bin.getObjectText(LOCKNAME_TAG);

            bin.nextTag(CHILDREN_TAGS + Convert.ToString(sig_));
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(CHILDREN_TAGS + Convert.ToString(sig_)))
                {
                    CDLLHintInfo hi = decode(bin);
                    infos_.Add(hi);
                }
            }

            bin.endTag(CHILDREN_TAGS + Convert.ToString(sig_));
        }
Exemplo n.º 12
0
 public CDLLStringValueHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin)
     : base(STRING_VALUE_TYPE, attr, bin)
 {
     def_   = bin.getObjectText(DEF_ATTR);
     value_ = bin.getObjectText(VALUE_ATTR);
 }
        public CDLLRadioContainerHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin)
            : base(RADIO_CONTAINER_TYPE, attr, bin)
        {
            sig_           = EncodeUtil.parseUInt(attr[SIG_ATTR]);
            currentOption_ = EncodeUtil.parseInt(attr[CURRENT_ATTR]);

            minfos_ = new List <List <CDLLHintInfo> >();

            bin.nextTag(LIST_TAGS + Convert.ToString(sig_));
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(LIST_TAGS + Convert.ToString(sig_)))
                {
                    var infos = new List <CDLLHintInfo>();
                    minfos_.Add(infos);
                    bin.nextTag(LIST_TAG + Convert.ToString(sig_));
                    if (bin.hasChildren())
                    {
                        bin.firstChild();
                        while (!bin.reachedEndTag(LIST_TAG + Convert.ToString(sig_)))
                        {
                            CDLLHintInfo hi = decode(bin);
                            infos.Add(hi);
                        }
                    }
                    bin.endTag(LIST_TAG + Convert.ToString(sig_));
                }
            }
            bin.endTag(LIST_TAGS + Convert.ToString(sig_));
            catkeys_ = new List <string>();
            bin.nextTag(KEY_TAGS);
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(KEY_TAGS))
                {
                    catkeys_.Add(bin.getObjectText(KEY_TAG));
                }
            }

            bin.endTag(KEY_TAGS);

            catnames_ = new List <string>();
            bin.nextTag(CATNAME_TAGS);
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(CATNAME_TAGS))
                {
                    catnames_.Add(bin.getObjectText(CATNAME_TAG));
                }
            }
            bin.endTag(CATNAME_TAGS);

            rbnames_ = new List <string>();
            bin.nextTag(RBNAME_TAGS);
            if (bin.hasChildren())
            {
                bin.firstChild();
                while (!bin.reachedEndTag(RBNAME_TAGS))
                {
                    rbnames_.Add(bin.getObjectText(RBNAME_TAG));
                }
            }
            bin.endTag(RBNAME_TAGS);
        }