@@ -92,13 +92,13 @@ const ScoreInfo _score_info[] = {
{ 8, 50}, // SCORE_CARGO
{10000000, 50}, // SCORE_MONEY
{ 250000, 50}, // SCORE_LOAN
{ 0, 0} // SCORE_TOTAL
};
int _score_part[MAX_COMPANIES][SCORE_END];
int64 _score_part[MAX_COMPANIES][SCORE_END];
Economy _economy;
Prices _price;
Money _additional_cash_required;
static PriceMultipliers _price_base_multiplier;
/**
@@ -180,13 +180,13 @@ int UpdateCompanyRatingAndValue(Company
min_profit >>= 8; // remove the fract part
_score_part[owner][SCORE_VEHICLES] = num;
/* Don't allow negative min_profit to show */
if (min_profit > 0) {
_score_part[owner][SCORE_MIN_PROFIT] = ClampToI32(min_profit);
_score_part[owner][SCORE_MIN_PROFIT] = min_profit;
}
/* Count stations */
{
uint num = 0;
@@ -210,16 +210,16 @@ int UpdateCompanyRatingAndValue(Company
do {
min_income = min(min_income, cee->income + cee->expenses);
max_income = max(max_income, cee->income + cee->expenses);
} while (++cee, --numec);
if (min_income > 0) {
_score_part[owner][SCORE_MIN_INCOME] = ClampToI32(min_income);
_score_part[owner][SCORE_MIN_INCOME] = min_income;
_score_part[owner][SCORE_MAX_INCOME] = ClampToI32(max_income);
_score_part[owner][SCORE_MAX_INCOME] = max_income;
/* Generate score depending on amount of transported cargo */
int numec = min(c->num_valid_stat_ent, 4);
@@ -227,31 +227,31 @@ int UpdateCompanyRatingAndValue(Company
const CompanyEconomyEntry *cee = c->old_economy;
OverflowSafeInt64 total_delivered = 0;
total_delivered += cee->delivered_cargo.GetSum<OverflowSafeInt64>();
_score_part[owner][SCORE_DELIVERED] = ClampToI32(total_delivered);
_score_part[owner][SCORE_DELIVERED] = total_delivered;
/* Generate score for variety of cargo */
_score_part[owner][SCORE_CARGO] = c->old_economy->delivered_cargo.GetCount();
/* Generate score for company's money */
if (c->money > 0) {
_score_part[owner][SCORE_MONEY] = ClampToI32(c->money);
_score_part[owner][SCORE_MONEY] = c->money;
/* Generate score for loan */
_score_part[owner][SCORE_LOAN] = ClampToI32(_score_info[SCORE_LOAN].needed - c->current_loan);
_score_part[owner][SCORE_LOAN] = _score_info[SCORE_LOAN].needed - c->current_loan;
/* Now we calculate the score for each item.. */
int total_score = 0;
int s;
@@ -19,13 +19,13 @@
#include "company_type.h"
void ResetPriceBaseMultipliers();
void SetPriceBaseMultiplier(Price price, int factor);
extern const ScoreInfo _score_info[];
extern int _score_part[MAX_COMPANIES][SCORE_END];
extern int64 _score_part[MAX_COMPANIES][SCORE_END];
extern Economy _economy;
/* Prices and also the fractional part. */
extern Prices _price;
int UpdateCompanyRatingAndValue(Company *c, bool update);
void StartupIndustryDailyChanges(bool init_counter);
@@ -1399,15 +1399,15 @@ struct PerformanceRatingDetailWindow : W
/* The colours used to show how the progress is going */
int colour_done = _colour_gradient[COLOUR_GREEN][4];
int colour_notdone = _colour_gradient[COLOUR_RED][4];
/* Draw all the score parts */
int val = _score_part[company][score_type];
int needed = _score_info[score_type].needed;
int score = _score_info[score_type].score;
int64 val = _score_part[company][score_type];
int64 needed = _score_info[score_type].needed;
/* SCORE_TOTAL has his own rules ;) */
if (score_type == SCORE_TOTAL) {
for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) score += _score_info[i].score;
needed = SCORE_MAX;
@@ -1419,26 +1419,26 @@ struct PerformanceRatingDetailWindow : W
/* Draw the score */
SetDParam(0, score);
DrawString(this->score_info_left, this->score_info_right, text_top, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT);
/* Calculate the %-bar */
uint x = Clamp(val, 0, needed) * this->bar_width / needed;
uint x = Clamp<int64>(val, 0, needed) * this->bar_width / needed;
bool rtl = _current_text_dir == TD_RTL;
if (rtl) {
x = this->bar_right - x;
} else {
x = this->bar_left + x;
/* Draw the bar */
if (x != this->bar_left) GfxFillRect(this->bar_left, bar_top, x, bar_top + this->bar_height, rtl ? colour_notdone : colour_done);
if (x != this->bar_right) GfxFillRect(x, bar_top, this->bar_right, bar_top + this->bar_height, rtl ? colour_done : colour_notdone);
/* Draw it */
SetDParam(0, Clamp(val, 0, needed) * 100 / needed);
SetDParam(0, Clamp<int64>(val, 0, needed) * 100 / needed);
DrawString(this->bar_left, this->bar_right, text_top, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING, SA_HOR_CENTER);
/* SCORE_LOAN is inversed */
if (score_type == SCORE_LOAN) val = needed - val;
/* Draw the amount we have against what is needed
Status change: