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); }
public CGameRules(CEncodedObjectInputBufferI bin) { bin.nextTag(TAG); Dictionary <string, string> A = bin.getAttributes(); stackCount_ = EncodeUtil.parseUInt(A[STACK_COUNT]); useExploration_ = EncodeUtil.fromBoolString(A[EXPLORE]); useCityEff_ = EncodeUtil.fromBoolString(A[CITYEFF]); useContinue_ = EncodeUtil.fromBoolString(A[CONTINUE]); useSpec_ = EncodeUtil.fromBoolString(A[SPEC]); useDrain_ = EncodeUtil.fromBoolString(A[DRAIN]); useRoads_ = EncodeUtil.fromBoolString(A[ROADS]); useSupply_ = EncodeUtil.fromBoolString(A[SUPPLY]); useMines_ = EncodeUtil.fromBoolString(A[MINES]); useResources_ = EncodeUtil.fromBoolString(A[RESOURCES]); useNukes_ = EncodeUtil.fromBoolString(A[NUKES]); useDigin_ = EncodeUtil.fromBoolString(A[DIGIN]); useExperience_ = EncodeUtil.fromBoolString(A[EXPERIENCE]); useUnitNames_ = EncodeUtil.fromBoolString(A[UNITNAMES]); useDefFire_ = EncodeUtil.fromBoolString(A[DEFFIRE]); useRangeFire_ = EncodeUtil.fromBoolString(A[RANGEFIRE]); useCrippled_ = EncodeUtil.fromBoolString(A[CRIPPLED]); useUnitScrap_ = EncodeUtil.fromBoolString(A[SCRAP]); useDefTer_ = EncodeUtil.fromBoolString(A[DEFTER]); useHarshSupply_ = EncodeUtil.fromBoolString(A[HARSHSUPPLY]); useLimitedResources_ = EncodeUtil.fromBoolString(A[LIMITEDREOURCES]); bin.endTag(TAG); }
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); }
public CDLLNumericValueHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin) : base(NUMERIC_VALUE_TYPE, attr, bin) { def_ = EncodeUtil.parseInt(attr[DEF_ATTR]); value_ = EncodeUtil.parseInt(attr[VALUE_ATTR]); if (attr.ContainsKey(POS_ATTR)) { positiveOnly_ = EncodeUtil.fromBoolString(attr[POS_ATTR]); } else { positiveOnly_ = false; } }
public CVictoryConditions(CEncodedObjectInputBufferI bin) { bin.nextTag(TAG); Dictionary <string, string> A = bin.getAttributes(); annihilationVictory_ = EncodeUtil.fromBoolString(A[ANNIHILATION]); percentageCitiesV_ = EncodeUtil.parseInt(A[PERCITIESVALUE]); percentageCitiesVDuration_ = EncodeUtil.parseInt(A[PERCITIESDUR]); numImportantV_ = EncodeUtil.parseInt(A[NUMIMPVALUE]); numImportantVDuration_ = EncodeUtil.parseInt(A[NUMIMPDUR]); capitalKill_ = EncodeUtil.fromBoolString(A[CAPKILL]); regicideV_ = EncodeUtil.parseInt(A[REGICIDE]); bin.endTag(TAG); }
private CProducerUnit(Dictionary <string, string> A, CEncodedObjectInputBufferI bin, AIQueryI query) : base(A, bin, query) { producing_ = A[PRODUCING]; specialty_ = A[SPECIALTY]; turnsToCompletion_ = EncodeUtil.parseInt(A[TURNSTOCOMPLETE]); efficiency_ = EncodeUtil.parseInt(A[EFFICIENCY]); supplyStore_ = EncodeUtil.parseUInt(A[SUPPLYSTORE]); minStore_ = EncodeUtil.parseUInt(A[MINSTORE]); scrapVal_ = EncodeUtil.parseUInt(A[SCRAPVAL]); consumeSupplyForDrain_ = EncodeUtil.fromBoolString(A[CONSUMESUPPFORDRAIN]); consumePriority_ = EncodeUtil.parseInt(A[CONSUMEPRIORITY]); autoDrainSupply_ = EncodeUtil.fromBoolString(A[AUTODRAIN]); isCapital_ = EncodeUtil.fromBoolString(A[CAPITAL]); isImportant_ = EncodeUtil.fromBoolString(A[IMPORTANT]); }
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); }
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_); }
public CGameMapParameters(CEncodedObjectInputBufferI bin) { bin.nextTag(TAG); Dictionary <string, string> attr = bin.getAttributes(); numPositions_ = EncodeUtil.parseInt(attr[NUM_POSITION_ATTR]); needCapitals_ = EncodeUtil.fromBoolString(attr[NEEDCAP_ATTR]); needImportant_ = EncodeUtil.fromBoolString(attr[NEEDIMPORT_ATTR]); numImportant_ = EncodeUtil.parseInt(attr[NUMIMPORT_ATTR]); numStartingCities_ = null; var plist = new List <KeyValuePair <int, int> >(); bin.nextTag(NUMSTARTCI_TAGS); if (bin.hasChildren()) { bin.firstChild(); while (!bin.reachedEndTag(NUMSTARTCI_TAGS)) { Dictionary <string, string> attrc = bin.getAttributes(); int index = EncodeUtil.parseInt(attrc[POS_ATTR]); int v = EncodeUtil.parseInt(attrc[VALUE_ATTR]); plist.Add(new KeyValuePair <int, int>(index, v)); bin.endTag(NUMSTARTCI_TAG); } } if (plist.Count > 0) { numStartingCities_ = new int[plist.Count]; foreach (KeyValuePair <int, int> kp in plist) { numStartingCities_[kp.Key] = kp.Value; } } bin.endTag(NUMSTARTCI_TAGS); bin.endTag(TAG); }
public CDLLContainerHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin) : base(CONTAINER_TYPE, attr, bin) { //int nc = EncodeUtil.parseInt(attr[NUM_CHILDREN]); sig_ = EncodeUtil.parseUInt(attr[SIG_ATTR]); goStraightToChildren_ = EncodeUtil.fromBoolString(attr[GO_ATTR]); infos_ = new List <CDLLHintInfo>(); 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_)); }
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_)); }
public CDLLBoolHintInfo(Dictionary <string, string> attr, CEncodedObjectInputBufferI bin) : base(BOOL_TYPE, attr, bin) { def_ = EncodeUtil.fromBoolString(attr[DEF_ATTR]); value_ = EncodeUtil.fromBoolString(attr[VALUE_ATTR]); }
public override bool update(string attr, string value, CSubLog logger) { if (base.update(attr, value, logger)) { return(true); } switch (attr) { case CUnitConstants.PRODUCING: producing_ = value; return(true); case CUnitConstants.SPECIALTY: { specialty_ = value; return(true); } case CUnitConstants.EFFICIENCY: { efficiency_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.TTC: { turnsToCompletion_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.SUPPLY_STORE: { supplyStore_ = EncodeUtil.parseUInt(value); return(true); } case CUnitConstants.MIN_STORE: { minStore_ = EncodeUtil.parseUInt(value); return(true); } case CUnitConstants.SCRAPVAL: { scrapVal_ = EncodeUtil.parseUInt(value); return(true); } case CUnitConstants.AUTOSUPPLYDRAIN: { autoDrainSupply_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.CONS_FOR_DRAIN: { consumeSupplyForDrain_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.CONS_PRIORITY: { consumePriority_ = EncodeUtil.parseInt(value); return(true); } } return(false); }
public virtual bool update(string attr, string value, CSubLog logger) { switch (attr) { case CUnitConstants.NAME: { name_ = value; return(true); } case CUnitConstants.TURN: { turn_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.HOST: { host_ = EncodeUtil.parseUInt(value); logger.info(this + " now has host value [" + Convert.ToString(host_) + "]"); return(true); } case CUnitConstants.RMVR: { rmvr_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.RMVS: { rmvs_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.FIRED: { fired_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.ARMED: { armed_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.DUGIN: { dugIn_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.DMG: { dmg_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.SHORT_FUEL: { shortFuel_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.READINESS: { readiness_ = value; return(true); } case CUnitConstants.EXPERIENCE: { experience_ = EncodeUtil.parseUInt(value); return(true); } case CUnitConstants.EXP_LEVEL: { expType_ = value; return(true); } case CUnitConstants.CHILD_ADD: { uint cgid = EncodeUtil.parseUInt(value); cunits_.Add(cgid); logger.info("Unit " + Convert.ToString(gid_) + " adds child " + Convert.ToString(cgid)); return(true); } case CUnitConstants.CHILD_REM: { uint cgid = EncodeUtil.parseUInt(value); for (int j = 0; j < cunits_.Count; j++) { if (cunits_[j] == cgid) { cunits_.RemoveAt(j); break; } } logger.info("Unit " + Convert.ToString(gid_) + " removes child " + Convert.ToString(cgid)); return(true); } case CUnitConstants.LX: setLoc(new CLoc(EncodeUtil.parseInt(value), loc_.y)); return(true); case CUnitConstants.LY: setLoc(new CLoc(loc_.x, EncodeUtil.parseInt(value))); return(true); case CUnitConstants.OWNER: //will need to do more here if interested in gifts or giveaways { owner_ = EncodeUtil.parseInt(value); return(true); } case CUnitConstants.LANDED: { landed_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.REENTRY: { inReentry_ = EncodeUtil.fromBoolString(value); return(true); } case CUnitConstants.LEVEL: { level_ = value; return(true); } case CUnitConstants.SLAYER: { stackLayer_ = EncodeUtil.parseUInt(value); return(true); } } return(false); }