Exemplo n.º 1
0
void
MissionSelector::show(bool enableClose)
{
  mCloseButton->setEnabled(enableClose);
  
  Mission* currentMission = rMain()->getMission();
  if(ConfigManager::getPlayer()->getHomeBase() == currentMission) {
    mHomeBaseButton->setVisible(false);
  }
  else {
    mHomeBaseButton->setVisible(true);
  }  

  sort(mCampaigns.begin(), mCampaigns.end(), lessCampaign);
  mCampaignList->removeAllItems();  
  for(vector<Campaign*>::const_iterator iCampaign = mCampaigns.begin(); iCampaign != mCampaigns.end(); ++iCampaign) {
    Campaign* campaign = *iCampaign;
    mCampaignList->addItem(campaign->getName());
  }  

  sort(mMissions.begin(), mMissions.end(), lessEntry);
  updateMissionList();
  
  Dialog::show();
}
Exemplo n.º 2
0
void Campaigns::loadCampaign(const Campaign &campaign) {
	unload(false);

	try {
		_currentCampaign = getCampaign(campaign.getUID());
		if (!_currentCampaign)
			throw Common::Exception("Campaign does not exist in this context");

		_currentCampaign->load();

	} catch (Common::Exception &e) {
		unload(false);

		e.add("Failed loading campaign \"%s\" (\"%s\")",
		      campaign.getUID().c_str(), campaign.getName().getString().c_str());
		throw e;
	}

	_hasCampaign = true;
}