/// Eine Figur geht ins Lagerhaus void nobHarborBuilding::AddFigure(noFigure * figure, const bool increase_visual_counts) { // Brauchen wir einen Bauarbeiter für die Expedition? if(figure->GetJobType() == JOB_BUILDER && expedition.active && !expedition.builder) { nobBaseWarehouse::RemoveDependentFigure(figure); em->AddToKillList(figure); expedition.builder = true; // Ggf. ist jetzt alles benötigte da CheckExpeditionReady(); } // Brauchen wir einen Spähter für die Expedition? else if(figure->GetJobType() == JOB_SCOUT && exploration_expedition.active && !IsExplorationExpeditionReady()) { nobBaseWarehouse::RemoveDependentFigure(figure); em->AddToKillList(figure); ++exploration_expedition.scouts; ++goods.people[JOB_SCOUT]; // Ggf. ist jetzt alles benötigte da CheckExplorationExpeditionReady(); } else // ansonsten weiterdelegieren nobBaseWarehouse::AddFigure(figure,increase_visual_counts); }
/// Startet eine Erkundungs-Expedition oder stoppt sie, wenn bereits eine stattfindet void nobHarborBuilding::StartExplorationExpedition() { // Schon eine Expedition gestartet? if(exploration_expedition.active) { StopExplorationExpedition(); return; } // Initialisierung exploration_expedition.active = true; exploration_expedition.scouts = 0; // Look for missing scouts if(inventory[JOB_SCOUT] < SCOUTS_EXPLORATION_EXPEDITION) { unsigned missing = SCOUTS_EXPLORATION_EXPEDITION - inventory[JOB_SCOUT]; //got scouts in ANY storehouse? GameClientPlayer& owner = gwg->GetPlayer(player); for(std::list<nobBaseWarehouse*>::const_iterator it = owner.GetStorehouses().begin(); it != owner.GetStorehouses().end(); ++it) { const unsigned numScouts = (*it)->GetRealFiguresCount(JOB_SCOUT); if(numScouts >= missing) { missing = 0; break; } else if(numScouts > 0) missing -= numScouts; } // Recruit missing ones if possible while(missing > 0 && TryRecruitJob(JOB_SCOUT)) missing--; // Order scouts, we still requires for(unsigned i = inventory[JOB_SCOUT]; i < SCOUTS_EXPLORATION_EXPEDITION; ++i) owner.AddJobWanted(JOB_SCOUT, this); } if(inventory[JOB_SCOUT]) { exploration_expedition.scouts = std::min(inventory[JOB_SCOUT], SCOUTS_EXPLORATION_EXPEDITION); inventory.real.Remove(JOB_SCOUT, exploration_expedition.scouts); } CheckExplorationExpeditionReady(); }
/// Startet eine Erkundungs-Expedition oder stoppt sie, wenn bereits eine stattfindet void nobHarborBuilding::StartExplorationExpedition() { // Schon eine Expedition gestartet? if(exploration_expedition.active) { // Dann diese stoppen exploration_expedition.active = false; // Erkunder zurücktransferieren if(exploration_expedition.scouts) { real_goods.people[JOB_SCOUT] += exploration_expedition.scouts; // Evtl. Abnehmer für die Figur wieder finden gwg->GetPlayer(player)->FindWarehouseForAllJobs(JOB_SCOUT); } return; } // Initialisierung exploration_expedition.active = true; exploration_expedition.scouts = 0; // In unseren Warenbestand gucken und die erforderlichen Erkunder rausziehen if(real_goods.people[JOB_SCOUT]) { exploration_expedition.scouts = min(real_goods.people[JOB_SCOUT],SCOUTS_EXPLORATION_EXPEDITION); real_goods.people[JOB_SCOUT] -= exploration_expedition.scouts; } // Den Rest bestellen for(unsigned i = exploration_expedition.scouts;i<SCOUTS_EXPLORATION_EXPEDITION;++i) gwg->GetPlayer(player)->AddJobWanted(JOB_SCOUT,this); CheckExplorationExpeditionReady(); }