本文整理汇总了C++中PlayerInfo::FlagshipPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::FlagshipPtr方法的具体用法?C++ PlayerInfo::FlagshipPtr怎么用?C++ PlayerInfo::FlagshipPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::FlagshipPtr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: player
// Constructor.
BoardingPanel::BoardingPanel(PlayerInfo &player, const shared_ptr<Ship> &victim)
: player(player), you(player.FlagshipPtr()), victim(victim),
attackOdds(*you, *victim), defenseOdds(*victim, *you),
initialCrew(you->Crew())
{
// The escape key should close this panel rather than bringing up the main menu.
SetInterruptible(false);
// Figure out how much the victim's commodities are worth in the current
// system and add them to the list of plunder.
const System &system = *player.GetSystem();
for(const auto &it : victim->Cargo().Commodities())
plunder.emplace_back(it.first, it.second, system.Trade(it.first));
// You cannot plunder hand to hand weapons, because they are kept in the
// crew's quarters, not mounted on the exterior of the ship. Certain other
// outfits are also unplunderable, like mass expansions.
for(const auto &it : victim->Outfits())
if(!it.first->Get("unplunderable"))
plunder.emplace_back(it.first, it.second);
// Some "ships" do not represent something the player could actually pilot.
if(!victim->IsCapturable())
messages.emplace_back("This is not a ship that you can capture.");
// Sort the plunder by price per ton.
sort(plunder.begin(), plunder.end());
}
示例2: player
// Constructor.
BoardingPanel::BoardingPanel(PlayerInfo &player, const shared_ptr<Ship> &victim)
: player(player), you(player.FlagshipPtr()), victim(victim),
attackOdds(*you, *victim), defenseOdds(*victim, *you)
{
// The escape key should close this panel rather than bringing up the main menu.
SetInterruptible(false);
// Figure out how much the victim's commodities are worth in the current
// system and add them to the list of plunder.
const System &system = *player.GetSystem();
for(const auto &it : victim->Cargo().Commodities())
if(it.second)
plunder.emplace_back(it.first, it.second, system.Trade(it.first));
// You cannot plunder hand to hand weapons, because they are kept in the
// crew's quarters, not mounted on the exterior of the ship. Certain other
// outfits are also unplunderable, like mass expansions.
auto sit = victim->Outfits().begin();
auto cit = victim->Cargo().Outfits().begin();
while(sit != victim->Outfits().end() || cit != victim->Cargo().Outfits().end())
{
const Outfit *outfit = nullptr;
int count = 0;
// Merge the outfit lists from the ship itself and its cargo bay. If an
// outfit exists in both locations, combine the counts.
bool shipIsFirst = (cit == victim->Cargo().Outfits().end() ||
(sit != victim->Outfits().end() && sit->first <= cit->first));
bool cargoIsFirst = (sit == victim->Outfits().end() ||
(cit != victim->Cargo().Outfits().end() && cit->first <= sit->first));
if(shipIsFirst)
{
outfit = sit->first;
// Don't include outfits that are installed and unplunderable. But,
// "unplunderable" outfits can still be stolen from cargo.
if(!sit->first->Get("unplunderable"))
count += sit->second;
++sit;
}
if(cargoIsFirst)
{
outfit = cit->first;
count += cit->second;
++cit;
}
if(outfit && count)
plunder.emplace_back(outfit, count);
}
// Some "ships" do not represent something the player could actually pilot.
if(!victim->IsCapturable())
messages.emplace_back("This is not a ship that you can capture.");
// Sort the plunder by price per ton.
sort(plunder.begin(), plunder.end());
}
示例3: player
BoardingPanel::BoardingPanel(PlayerInfo &player, const shared_ptr<Ship> &victim)
: player(player), you(player.FlagshipPtr()), victim(victim),
attackOdds(&*you, &*victim), defenseOdds(&*victim, &*you),
initialCrew(you->Crew())
{
SetInterruptible(false);
const System &system = *player.GetSystem();
for(const auto &it : victim->Cargo().Commodities())
plunder.emplace_back(it.first, it.second, system.Trade(it.first));
// You cannot plunder hand to hand weapons, because they are kept in the
// crew's quarters, not mounted on the exterior of the ship.
for(const auto &it : victim->Outfits())
if(it.first->Category() != "Hand to Hand")
plunder.emplace_back(it.first, it.second);
sort(plunder.begin(), plunder.end());
}