本文整理汇总了C++中PlayerInfo::FleetDepreciation方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::FleetDepreciation方法的具体用法?C++ PlayerInfo::FleetDepreciation怎么用?C++ PlayerInfo::FleetDepreciation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::FleetDepreciation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateRequirements
void OutfitInfoDisplay::UpdateRequirements(const Outfit &outfit, const PlayerInfo &player, bool canSell)
{
requirementLabels.clear();
requirementValues.clear();
requirementsHeight = 20;
int day = player.GetDate().DaysSinceEpoch();
int64_t cost = outfit.Cost();
int64_t buyValue = player.StockDepreciation().Value(&outfit, day);
int64_t sellValue = player.FleetDepreciation().Value(&outfit, day);
if(buyValue == cost)
requirementLabels.push_back("cost:");
else
{
ostringstream out;
out << "cost (" << (100 * buyValue) / cost << "%):";
requirementLabels.push_back(out.str());
}
requirementValues.push_back(Format::Number(buyValue));
requirementsHeight += 20;
if(canSell && sellValue != buyValue)
{
if(sellValue == cost)
requirementLabels.push_back("sells for:");
else
{
ostringstream out;
out << "sells for (" << (100 * sellValue) / cost << "%):";
requirementLabels.push_back(out.str());
}
requirementValues.push_back(Format::Number(sellValue));
requirementsHeight += 20;
}
static const string names[] = {
"outfit space needed:", "outfit space",
"weapon capacity needed:", "weapon capacity",
"engine capacity needed:", "engine capacity",
"gun ports needed:", "gun ports",
"turret mounts needed:", "turret mounts"
};
static const int NAMES = sizeof(names) / sizeof(names[0]);
for(int i = 0; i + 1 < NAMES; i += 2)
if(outfit.Get(names[i + 1]))
{
requirementLabels.push_back(string());
requirementValues.push_back(string());
requirementsHeight += 10;
requirementLabels.push_back(names[i]);
requirementValues.push_back(Format::Number(-outfit.Get(names[i + 1])));
requirementsHeight += 20;
}
}