1
0
Fork 0

(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.

-Fix: Graphs now accomodate 64bit numbers (so the company value graph doesn't plummet into -... if value is too big)
-Strgen: added CURRCOMPACT64 for this, and 64bit versions of several macros.
release/0.4.5
darkvater 2004-09-13 20:38:36 +00:00
parent add49120dd
commit fc9a450e75
21 changed files with 108 additions and 67 deletions

View File

@ -75,7 +75,7 @@ int64 CalculateCompanyValue(Player *p) {
} }
if (p->player_money > 0) if (p->player_money > 0)
value += p->player_money; value += p->money64; // add real money value
return value; return value;
} }

View File

@ -13,6 +13,8 @@ static uint _legend_cargobits;
/* GENERIC GRAPH DRAWER */ /* GENERIC GRAPH DRAWER */
/************************/ /************************/
enum {GRAPH_NUM = 16};
typedef struct GraphDrawer { typedef struct GraphDrawer {
uint sel; uint sel;
byte num_dataset; byte num_dataset;
@ -27,10 +29,12 @@ typedef struct GraphDrawer {
uint height; uint height;
StringID format_str_y_axis; StringID format_str_y_axis;
byte color_3, color_2, bg_line_color; byte color_3, color_2, bg_line_color;
byte colors[16]; byte colors[GRAPH_NUM];
uint32 cost[16][24]; uint64 cost[GRAPH_NUM][24]; // last 2 years
} GraphDrawer; } GraphDrawer;
#define INVALID_VALUE 0x80000000
void DrawGraph(GraphDrawer *gw) void DrawGraph(GraphDrawer *gw)
{ {
@ -39,14 +43,18 @@ void DrawGraph(GraphDrawer *gw)
int color; int color;
int right, bottom; int right, bottom;
int num_x, num_dataset; int num_x, num_dataset;
uint32 *row_ptr, *col_ptr; uint64 *row_ptr, *col_ptr;
int32 mx; int64 mx;
int adj_height; int adj_height;
uint32 y_scaling, tmp; uint64 y_scaling, tmp;
int32 value; int64 value;
int32 cur_val; int64 cur_val;
uint sel; uint sel;
/* the colors and cost array of GraphDrawer must accomodate
* both values for cargo and players. So if any are higher, quit */
assert(GRAPH_NUM >= NUM_CARGO && GRAPH_NUM >= MAX_PLAYERS);
color = _color_list[gw->bg_line_color].window_color_1b; color = _color_list[gw->bg_line_color].window_color_1b;
/* draw the vertical lines */ /* draw the vertical lines */
@ -83,26 +91,34 @@ void DrawGraph(GraphDrawer *gw)
if (gw->num_on_x_axis == 0) if (gw->num_on_x_axis == 0)
return; return;
num_dataset = gw->num_dataset;assert(num_dataset > 0); num_dataset = gw->num_dataset;
assert(num_dataset > 0);
row_ptr = gw->cost[0]; row_ptr = gw->cost[0];
mx = 0; mx = 0;
/* bit selection for the showing of various players, base max element
* on to-be shown player-information. This way the graph can scale */
sel = gw->sel;
do { do {
num_x = gw->num_on_x_axis;assert(num_x > 0); if (!(sel&1)) {
col_ptr = row_ptr; num_x = gw->num_on_x_axis;
do { assert(num_x > 0);
if (*col_ptr != 0x80000000) { col_ptr = row_ptr;
mx = max(mx, myabs(*col_ptr)); do {
} if (*col_ptr != INVALID_VALUE) {
} while (col_ptr++, --num_x); mx = max64(mx, myabs64(*col_ptr));
} while (row_ptr+=24, --num_dataset); }
} while (col_ptr++, --num_x);
}
} while (sel>>=1, row_ptr+=24, --num_dataset);
/* setup scaling */ /* setup scaling */
y_scaling = 0x80000000; y_scaling = INVALID_VALUE;
value = adj_height * 2; value = adj_height * 2;
if (mx > value) { if (mx > value) {
mx = (mx + 7) & ~7; mx = (mx + 7) & ~7;
y_scaling = (uint32) (((uint64) (value>>1) << 32) / mx); y_scaling = (((uint64) (value>>1) << 32) / mx);
value = mx; value = mx;
} }
@ -114,7 +130,7 @@ void DrawGraph(GraphDrawer *gw)
i = 9; i = 9;
do { do {
SET_DPARAM16(0, gw->format_str_y_axis); SET_DPARAM16(0, gw->format_str_y_axis);
SET_DPARAM32(1, tmp); SET_DPARAM64(1, (int64)tmp);
tmp -= (value >> 3); tmp -= (value >> 3);
DrawStringRightAligned(x, y, STR_0170, gw->color_3); DrawStringRightAligned(x, y, STR_0170, gw->color_3);
y += gw->height >> 3; y += gw->height >> 3;
@ -156,27 +172,27 @@ void DrawGraph(GraphDrawer *gw)
/* draw lines and dots */ /* draw lines and dots */
i = 0; i = 0;
row_ptr = gw->cost[0]; row_ptr = gw->cost[0];
sel = gw->sel; sel = gw->sel; // show only selected lines. GraphDrawer qw->sel set in Graph-Legend (_legend_showbits)
do { do {
if (!(sel & 1)) { if (!(sel & 1)) {
x = gw->left + 55; x = gw->left + 55;
j = gw->num_on_x_axis;assert(j>0); j = gw->num_on_x_axis;assert(j>0);
col_ptr = row_ptr; col_ptr = row_ptr;
color = gw->colors[i]; color = gw->colors[i];
old_y = old_x = 0x80000000; old_y = old_x = INVALID_VALUE;
do { do {
cur_val = *col_ptr++; cur_val = *col_ptr++;
if (cur_val != (int32)0x80000000) { if (cur_val != INVALID_VALUE) {
y = adj_height - BIGMULSS(cur_val, y_scaling >> 1, 31) + gw->top; y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top;
GfxFillRect(x-1, y-1, x+1, y+1, color); GfxFillRect(x-1, y-1, x+1, y+1, color);
if (old_x != 0x80000000) if (old_x != INVALID_VALUE)
GfxDrawLine(old_x, old_y, x, y, color); GfxDrawLine(old_x, old_y, x, y, color);
old_x = x; old_x = x;
old_y = y; old_y = y;
} else { } else {
old_x = 0x80000000; old_x = INVALID_VALUE;
} }
} while (x+=22,--j); } while (x+=22,--j);
} }
@ -310,7 +326,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
gd.top = 18; gd.top = 18;
gd.height = 136; gd.height = 136;
gd.include_neg = true; gd.include_neg = true;
gd.format_str_y_axis = STR_7023; gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 0x10; gd.color_3 = 0x10;
gd.color_2 = 0xD7; gd.color_2 = 0xD7;
gd.bg_line_color = 0xE; gd.bg_line_color = 0xE;
@ -323,7 +339,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
continue; continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
for(j=gd.num_on_x_axis,i=0; --j >= 0;) { for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? 0x80000000 : (p->old_economy[j].income + p->old_economy[j].expenses); gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)(p->old_economy[j].income + p->old_economy[j].expenses);
i++; i++;
} }
numd++; numd++;
@ -331,11 +347,9 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
gd.num_dataset=numd; gd.num_dataset=numd;
DrawGraph(&gd); DrawGraph(&gd);
break; } break;
}
case WE_CLICK: case WE_CLICK:
if (e->click.widget == 2) if (e->click.widget == 2) /* Clicked on Legend */
ShowGraphLegend(); ShowGraphLegend();
break; break;
} }
@ -386,7 +400,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
gd.top = 18; gd.top = 18;
gd.height = 104; gd.height = 104;
gd.include_neg = false; gd.include_neg = false;
gd.format_str_y_axis = STR_7023; gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 0x10; gd.color_3 = 0x10;
gd.color_2 = 0xD7; gd.color_2 = 0xD7;
gd.bg_line_color = 0xE; gd.bg_line_color = 0xE;
@ -398,7 +412,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
continue; continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
for(j=gd.num_on_x_axis,i=0; --j >= 0;) { for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? 0x80000000 : (p->old_economy[j].income); gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].income;
i++; i++;
} }
numd++; numd++;
@ -472,7 +486,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
continue; continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
for(j=gd.num_on_x_axis,i=0; --j >= 0;) { for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? 0x80000000 : p->old_economy[j].delivered_cargo; gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].delivered_cargo;
i++; i++;
} }
numd++; numd++;
@ -766,7 +780,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
continue; continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
for(j=gd.num_on_x_axis,i=0; --j >= 0;) { for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? 0x80000000 : p->old_economy[j].performance_history; gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].performance_history;
i++; i++;
} }
numd++; numd++;
@ -830,7 +844,7 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
gd.top = 18; gd.top = 18;
gd.height = 200; gd.height = 200;
gd.include_neg = false; gd.include_neg = false;
gd.format_str_y_axis = STR_7023; gd.format_str_y_axis = STR_CURRCOMPACT64;
gd.color_3 = 0x10; gd.color_3 = 0x10;
gd.color_2 = 0xD7; gd.color_2 = 0xD7;
gd.bg_line_color = 0xE; gd.bg_line_color = 0xE;
@ -840,9 +854,10 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
FOR_ALL_PLAYERS(p) { FOR_ALL_PLAYERS(p) {
if (!p->is_active) if (!p->is_active)
continue; continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
for(j=gd.num_on_x_axis,i=0; --j >= 0;) { for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? 0x80000000 : (p->old_economy[j].company_value); gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].company_value;
i++; i++;
} }
numd++; numd++;
@ -917,7 +932,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
gd.top = 24; gd.top = 24;
gd.height = 104; gd.height = 104;
gd.include_neg = false; gd.include_neg = false;
gd.format_str_y_axis = STR_7023; gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 16; gd.color_3 = 16;
gd.color_2 = 215; gd.color_2 = 215;
gd.bg_line_color = 14; gd.bg_line_color = 14;
@ -931,7 +946,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
for(i=0; i!=NUM_CARGO; i++) { for(i=0; i!=NUM_CARGO; i++) {
gd.colors[i] = _cargo_legend_colors[i]; gd.colors[i] = _cargo_legend_colors[i];
for(j=0; j!=20; j++) { for(j=0; j!=20; j++) {
gd.cost[i][j] = GetTransportedGoodsIncome(10, 20, j*6+6,i); gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j*6+6,i);
} }
} }

View File

@ -1785,7 +1785,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Income Graph STR_7022_INCOME_GRAPH :{WHITE}Income Graph
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph
STR_7026_BANK_BALANCE :{WHITE}Bank Balance STR_7026_BANK_BALANCE :{WHITE}Bank Balance

View File

@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Celkem: STR_7020_TOTAL :{WHITE}Celkem:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf prijmu STR_7022_INCOME_GRAPH :{WHITE}Graf prijmu
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf provozního zisku STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf provozního zisku
STR_7026_BANK_BALANCE :{WHITE}Stav na uctu STR_7026_BANK_BALANCE :{WHITE}Stav na uctu

View File

@ -1720,7 +1720,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Indkomst Graf STR_7022_INCOME_GRAPH :{WHITE}Indkomst Graf
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Profit Garf STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Profit Garf
STR_7026_BANK_BALANCE :{WHITE}Bank Balance STR_7026_BANK_BALANCE :{WHITE}Bank Balance

View File

@ -1675,7 +1675,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totaal: STR_7020_TOTAL :{WHITE}Totaal:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Inkomstengrafiek STR_7022_INCOME_GRAPH :{WHITE}Inkomstengrafiek
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7027_LOAN :{WHITE}Lening STR_7027_LOAN :{WHITE}Lening
STR_7028 :{BLACK}{CURRENCY64} STR_7028 :{BLACK}{CURRENCY64}

View File

@ -1853,7 +1853,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Income Graph STR_7022_INCOME_GRAPH :{WHITE}Income Graph
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph
STR_7026_BANK_BALANCE :{WHITE}Bank Balance STR_7026_BANK_BALANCE :{WHITE}Bank Balance

View File

@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Yhteensä: STR_7020_TOTAL :{WHITE}Yhteensä:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Tulokuvaaja STR_7022_INCOME_GRAPH :{WHITE}Tulokuvaaja
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Tuottokuvaaja STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Tuottokuvaaja
STR_7026_BANK_BALANCE :{WHITE}Tilin kate STR_7026_BANK_BALANCE :{WHITE}Tilin kate

View File

@ -1848,7 +1848,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graphique du Revenu STR_7022_INCOME_GRAPH :{WHITE}Graphique du Revenu
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graphique du profit d'opération STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graphique du profit d'opération
STR_7026_BANK_BALANCE :{WHITE}Equilibre bancaire STR_7026_BANK_BALANCE :{WHITE}Equilibre bancaire

View File

@ -1785,7 +1785,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Gráfico de Ingresos STR_7022_INCOME_GRAPH :{WHITE}Gráfico de Ingresos
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Gráfica de Beneficios Operativos STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Gráfica de Beneficios Operativos
STR_7026_BANK_BALANCE :{WHITE}Balance do Banco STR_7026_BANK_BALANCE :{WHITE}Balance do Banco

View File

@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Gesamt: STR_7020_TOTAL :{WHITE}Gesamt:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Einkommensdiagramm STR_7022_INCOME_GRAPH :{WHITE}Einkommensdiagramm
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Betriebsgewinndiagramm STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Betriebsgewinndiagramm
STR_7026_BANK_BALANCE :{WHITE}Kontostand STR_7026_BANK_BALANCE :{WHITE}Kontostand

View File

@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Összesen: STR_7020_TOTAL :{WHITE}Összesen:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Jövedelem grafikon STR_7022_INCOME_GRAPH :{WHITE}Jövedelem grafikon
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Mûködési nyereség grafikon STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Mûködési nyereség grafikon
STR_7026_BANK_BALANCE :{WHITE}Banki egyenleg STR_7026_BANK_BALANCE :{WHITE}Banki egyenleg

View File

@ -1803,7 +1803,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totale: STR_7020_TOTAL :{WHITE}Totale:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Grafico Incassi STR_7022_INCOME_GRAPH :{WHITE}Grafico Incassi
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Grafico Profitti Operazionali STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Grafico Profitti Operazionali
STR_7026_BANK_BALANCE :{WHITE}Bilancio Bancario STR_7026_BANK_BALANCE :{WHITE}Bilancio Bancario

View File

@ -1648,7 +1648,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totalt: STR_7020_TOTAL :{WHITE}Totalt:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Inntektsgraf STR_7022_INCOME_GRAPH :{WHITE}Inntektsgraf
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Overskudd graf STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Overskudd graf
STR_7026_BANK_BALANCE :{WHITE}Saldo STR_7026_BANK_BALANCE :{WHITE}Saldo

View File

@ -1745,7 +1745,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Calkowicie: STR_7020_TOTAL :{WHITE}Calkowicie:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Wykres przychodow STR_7022_INCOME_GRAPH :{WHITE}Wykres przychodow
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Wykres obrotow STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Wykres obrotow
STR_7026_BANK_BALANCE :{WHITE}Bilans bankowy STR_7026_BANK_BALANCE :{WHITE}Bilans bankowy

View File

@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total: STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graficul veniturilor STR_7022_INCOME_GRAPH :{WHITE}Graficul veniturilor
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graficul profitului din operare STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graficul profitului din operare
STR_7026_BANK_BALANCE :{WHITE}Balantã curentã STR_7026_BANK_BALANCE :{WHITE}Balantã curentã

View File

@ -1647,7 +1647,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Spolu: STR_7020_TOTAL :{WHITE}Spolu:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf zisku STR_7022_INCOME_GRAPH :{WHITE}Graf zisku
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf prevadzkoveho zisku STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf prevadzkoveho zisku
STR_7026_BANK_BALANCE :{WHITE}Zostatok v banke STR_7026_BANK_BALANCE :{WHITE}Zostatok v banke

View File

@ -1750,7 +1750,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totalt: STR_7020_TOTAL :{WHITE}Totalt:
STR_7021 :{STRING}{STRING} STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf över inkomster STR_7022_INCOME_GRAPH :{WHITE}Graf över inkomster
STR_7023 :{CURRCOMPACT} STR_CURRCOMPACT32 :{CURRCOMPACT}
STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32} STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf över vinst STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf över vinst
STR_7026_BANK_BALANCE :{WHITE}Banksaldo STR_7026_BANK_BALANCE :{WHITE}Banksaldo

View File

@ -13,6 +13,7 @@
static INLINE int min(int a, int b) { if (a <= b) return a; return b; } static INLINE int min(int a, int b) { if (a <= b) return a; return b; }
static INLINE int max(int a, int b) { if (a >= b) return a; return b; } static INLINE int max(int a, int b) { if (a >= b) return a; return b; }
static INLINE int64 max64(int64 a, int64 b) { if (a >= b) return a; return b; }
static INLINE uint minu(uint a, uint b) { if (a <= b) return a; return b; } static INLINE uint minu(uint a, uint b) { if (a <= b) return a; return b; }
static INLINE uint maxu(uint a, uint b) { if (a >= b) return a; return b; } static INLINE uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
@ -49,6 +50,10 @@ static INLINE int32 BIGMULSS(int32 a, int32 b, int shift) {
return (int32)(((int64)(a) * (int64)(b)) >> (shift)); return (int32)(((int64)(a) * (int64)(b)) >> (shift));
} }
static INLINE int64 BIGMULSS64(int64 a, int64 b, int shift) {
return ((a) * (b)) >> (shift);
}
static INLINE uint32 BIGMULUS(uint32 a, uint32 b, int shift) { static INLINE uint32 BIGMULUS(uint32 a, uint32 b, int shift) {
return (uint32)(((uint64)(a) * (uint64)(b)) >> (shift)); return (uint32)(((uint64)(a) * (uint64)(b)) >> (shift));
} }
@ -194,6 +199,7 @@ static INLINE int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
#define intswap(a,b) ((b) = intxchg_(&(a), (b))) #define intswap(a,b) ((b) = intxchg_(&(a), (b)))
static INLINE int myabs(int a) { if (a<0) a = -a; return a; } static INLINE int myabs(int a) { if (a<0) a = -a; return a; }
static INLINE int64 myabs64(int64 a) { if (a<0) a = -a; return a; }
static INLINE void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; } static INLINE void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; }
static INLINE void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; } static INLINE void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }

View File

@ -246,10 +246,12 @@ static const CmdStruct _cmd_structs[] = {
{"CURRENCY", EmitSingleByte, 0x7F}, {"CURRENCY", EmitSingleByte, 0x7F},
{"CURRCOMPACT", EmitEscapedByte, 0}, // compact currency // 0x85
{"INT32", EmitEscapedByte, 1}, // compact currency {"CURRCOMPACT", EmitEscapedByte, 0}, // compact currency (32 bits)
{"REV", EmitEscapedByte, 2}, // openttd revision string {"INT32", EmitEscapedByte, 1}, // signed 32 bit integer
{"SHORTCARGO", EmitEscapedByte, 3}, // short cargo description, only ### tons, or ### litres {"REV", EmitEscapedByte, 2}, // openttd revision string
{"SHORTCARGO", EmitEscapedByte, 3}, // short cargo description, only ### tons, or ### litres
{"CURRCOMPACT64", EmitEscapedByte, 4}, // compact currency 64 bits
{"STRINL", EmitStringInl, 0x81}, {"STRINL", EmitStringInl, 0x81},

View File

@ -433,20 +433,19 @@ static byte *DecodeString(byte *buff, const byte *str)
// 0x85 is used as escape character.. // 0x85 is used as escape character..
case 0x85: case 0x85:
switch(*str++) { switch(*str++) {
case 0: case 0: /* {CURRCOMPACT} */
buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt32(), true); buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt32(), true);
break; break;
case 1: // {INT32} case 1: /* {INT32} */
buff = FormatNoCommaNumber(buff, GetParamInt32()); buff = FormatNoCommaNumber(buff, GetParamInt32());
break; break;
case 2: /* {REV} */
case 2: // {REV}
#ifdef WITH_REV #ifdef WITH_REV
buff = str_cat(buff, (const byte*)_openttd_revision); buff = str_cat(buff, (const byte*)_openttd_revision);
#endif #endif
break; break;
case 3: { // {SHORTCARGO} case 3: { /* {SHORTCARGO} */
// Layout: // Short description of cargotypes. Layout:
// 8-bit = cargo type // 8-bit = cargo type
// 16-bit = cargo count // 16-bit = cargo count
char *s; char *s;
@ -458,8 +457,11 @@ static byte *DecodeString(byte *buff, const byte *str)
memcpy(buff++, " ", 1); memcpy(buff++, " ", 1);
while (*s) *buff++ = *s++; while (*s) *buff++ = *s++;
} break;
case 4: /* {CURRCOMPACT64} */
// 64 bit compact currency-unit
buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt64(), true);
break; break;
}
default: default:
error("!invalid escape sequence in string"); error("!invalid escape sequence in string");