(svn r23826) -Fix [FS#4972]: the detailed performance rating window showed the cargo count of the current quarter instead of the last quarter like the tooltip says

This commit is contained in:
rubidium
2012-01-20 20:18:19 +00:00
parent 15331fa03c
commit 70c7fbd90e
9 changed files with 54 additions and 33 deletions

View File

@@ -105,6 +105,33 @@ public:
{
return this->amount[cargo];
}
/**
* Get the sum of all cargo amounts.
* @return The sum.
*/
template <typename T>
inline const T GetSum() const
{
T ret = 0;
for (size_t i = 0; i < lengthof(this->amount); i++) {
ret += this->amount[i];
}
return ret;
}
/**
* Get the amount of cargos that have an amount.
* @return The amount.
*/
inline byte GetCount() const
{
byte count = 0;
for (size_t i = 0; i < lengthof(this->amount); i++) {
if (this->amount[i] != 0) count++;
}
return count;
}
};