Exemple #1
0
 public CUnit(
     string utype,
     uint gid,
     CLoc loc,
     UnitQueryI entry
     )
 {
     utype_ = utype;
     gid_   = gid;
     loc_   = loc;
     entry_ = entry;
 }
Exemple #2
0
        public int getUnitLoad(CUnit unit)
        {
            if (!unit.hasLoad())
            {
                return(0);
            }
            int L = 0;

            for (int i = 0; i < unit.cunits_.Count; i++)
            {
                CUnit      c = getUnit(unit.cunits_[i]);
                UnitQueryI q = query_.unitQuery(c.utype_);
                L += q.portage();
            }
            return(L);
        }
Exemple #3
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_);
        }
Exemple #4
0
 public CProducerUnit(string utype, uint gid, CLoc loc, UnitQueryI entry) : base(utype, gid, loc, entry)
 {
 }