public override void aiRestored(CStateEvent cse) { elogger_.info("Restored started"); base.aiRestored(cse); elogger_.info("Restored done"); elogger_.info(pname_ + " is now self aware."); }
//This event is passed to give you the state of the AI - only done at the beginning, //for reload it will be null public virtual void aiRestored(CStateEvent cse) { if (cse != null) { processEvent(cse, alogger_); } alogger_.info("Player Restored"); }
//////////////////////////////////////////////////////////// //Game State - This event is sent initially and on reloads //Gives the current state of your forces and what you can see private void processGameState(CStateEvent gse) { //Player Information numPlayers_ = gse.players_.Count; for (int i = 0; i < numPlayers_; i++) { players_.Add(gse.players_[i]); if (i == position_) { pname_ = gse.players_[i].pname_; } } curturn_ = gse.curturn_; rdWeight_ = gse.rdWeight_; unitsBeforeDrain_ = gse.unitsBeforeDrain_; //Map Information mapUtil_ = new CMapUtil(gse.w_, gse.hw_, gse.h_, gse.vw_); map_ = new AIMap(gse.w_, gse.hw_, gse.h_, gse.vw_, gse.gameRules_.stackCount_); uint fogid = gse.flyoverGid_; addMapLocations(gse.exploredLocs_); addCities(gse.cities_); addProds(gse.prods_); addUnits(gse.units_); addSpots(gse.spots_); addSupplyRoutes(gse.routes_); gameRules_ = gse.gameRules_; vc_ = gse.vc_; if (gse.proposals_ != null) { foreach (CProposal p in gse.proposals_) { proposals_.Add(p); } } //Grab Flyover if need be (Basic and Standard Games) if (fogid != CUnitConstants.NOUNIT) { foUnit_ = getUnit(fogid); } prodReport_.Clear(); if (gse.prodData_ != null) { foreach (CProductionReportData prd in gse.prodData_) { prodReport_.Add(prd); } } gameStateReceived(); }