//////////////////////////////////////////// //Reload Call //This call gives the data needed to reload an AI player instance public override AIPlayer reloadAIPlayer(int position, CEncodedObjectInputBufferI bin, string logpath, string logname, AIEventInterfaceI aiEvent, AICommandInterfaceI command, AIQueryI query, AICheatI cheat, int logLevel) { Dictionary <string, string> caMap = bin.getAttributes(); return(new ExamplePlayer(position, caMap, bin, logpath, logname, aiEvent, command, query, cheat, logLevel)); }
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 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 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 static CProducerUnit decodeCProducerUnit(CEncodedObjectInputBufferI bin, AIQueryI query) { bin.nextTag(TAG); Dictionary <string, string> A = bin.getAttributes(); var ret = new CProducerUnit(A, bin, query); bin.endTag(TAG); return(ret); }
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 static CDLLHintInfo decode(CEncodedObjectInputBufferI bin) { string tag = bin.thisTag(); Dictionary <string, string> attr = bin.getAttributes(); CDLLHintInfo ret = null; switch (tag) { case BOOL_TYPE: ret = new CDLLBoolHintInfo(attr, bin); break; case NAME_VALUE_SET: ret = new CDLLNameValueHintInfo(attr, bin); break; case NUMERIC_RANGE_VALUE_TYPE: ret = new CDLLNumericRangeValueHintInfo(attr, bin); break; case NUMERIC_VALUE_TYPE: ret = new CDLLNumericValueHintInfo(attr, bin); break; case STRING_VALUE_TYPE: ret = new CDLLStringValueHintInfo(attr, bin); break; case FILE_VALUE_TYPE: ret = new CDLLFileValueHintInfo(attr, bin); break; case CONTAINER_TYPE: ret = new CDLLContainerHintInfo(attr, bin); break; case LOCKED_CONTAINER_TYPE: ret = new CDLLLockableHintInfo(attr, bin); break; case RADIO_CONTAINER_TYPE: ret = new CDLLRadioContainerHintInfo(attr, bin); break; default: throw new Exception("Unknown decode type " + tag); } bin.endTag(tag); return(ret); }
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); }
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); }
public CSupplyRoute(CEncodedObjectInputBufferI bin) { bin.nextTag(TAG); Dictionary <string, string> A = bin.getAttributes(); rid_ = EncodeUtil.parseUInt(A[RID]); source_ = EncodeUtil.parseUInt(A[SOURCE]); sourceLoc_ = CLoc.fromKey(A[SOURCE_LOC]); dest_ = EncodeUtil.parseUInt(A[DEST]); destLoc_ = CLoc.fromKey(A[DEST_LOC]); inTransit_ = EncodeUtil.parseUInt(A[IN_TRANSIT]); nextArrival_ = EncodeUtil.parseUInt(A[NEXT_ARRIVAL]); bin.endTag(TAG); }
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); }
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); }
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_); }