summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--economy.c2
-rw-r--r--graph_gui.c93
-rw-r--r--lang/american.txt3
-rw-r--r--lang/czech.txt3
-rw-r--r--lang/danish.txt3
-rw-r--r--lang/dutch.txt3
-rw-r--r--lang/english.txt3
-rw-r--r--lang/finnish.txt3
-rw-r--r--lang/french.txt3
-rw-r--r--lang/galician.txt3
-rw-r--r--lang/german.txt3
-rw-r--r--lang/hungarian.txt3
-rw-r--r--lang/italian.txt3
-rw-r--r--lang/norwegian.txt3
-rw-r--r--lang/polish.txt3
-rw-r--r--lang/romanian.txt3
-rw-r--r--lang/slovak.txt3
-rw-r--r--lang/swedish.txt3
-rw-r--r--macros.h6
-rw-r--r--strgen/strgen.c10
-rw-r--r--strings.c16
21 files changed, 108 insertions, 67 deletions
diff --git a/economy.c b/economy.c
index 578230688..cf23e65fd 100644
--- a/economy.c
+++ b/economy.c
@@ -75,7 +75,7 @@ int64 CalculateCompanyValue(Player *p) {
}
if (p->player_money > 0)
- value += p->player_money;
+ value += p->money64; // add real money value
return value;
}
diff --git a/graph_gui.c b/graph_gui.c
index 35ac932d3..da33c0e72 100644
--- a/graph_gui.c
+++ b/graph_gui.c
@@ -13,6 +13,8 @@ static uint _legend_cargobits;
/* GENERIC GRAPH DRAWER */
/************************/
+enum {GRAPH_NUM = 16};
+
typedef struct GraphDrawer {
uint sel;
byte num_dataset;
@@ -27,10 +29,12 @@ typedef struct GraphDrawer {
uint height;
StringID format_str_y_axis;
byte color_3, color_2, bg_line_color;
- byte colors[16];
- uint32 cost[16][24];
+ byte colors[GRAPH_NUM];
+ uint64 cost[GRAPH_NUM][24]; // last 2 years
} GraphDrawer;
+#define INVALID_VALUE 0x80000000
+
void DrawGraph(GraphDrawer *gw)
{
@@ -39,14 +43,18 @@ void DrawGraph(GraphDrawer *gw)
int color;
int right, bottom;
int num_x, num_dataset;
- uint32 *row_ptr, *col_ptr;
- int32 mx;
+ uint64 *row_ptr, *col_ptr;
+ int64 mx;
int adj_height;
- uint32 y_scaling, tmp;
- int32 value;
- int32 cur_val;
+ uint64 y_scaling, tmp;
+ int64 value;
+ int64 cur_val;
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;
/* draw the vertical lines */
@@ -83,26 +91,34 @@ void DrawGraph(GraphDrawer *gw)
if (gw->num_on_x_axis == 0)
return;
- num_dataset = gw->num_dataset;assert(num_dataset > 0);
+ num_dataset = gw->num_dataset;
+ assert(num_dataset > 0);
+
row_ptr = gw->cost[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 {
- num_x = gw->num_on_x_axis;assert(num_x > 0);
- col_ptr = row_ptr;
- do {
- if (*col_ptr != 0x80000000) {
- mx = max(mx, myabs(*col_ptr));
- }
- } while (col_ptr++, --num_x);
- } while (row_ptr+=24, --num_dataset);
+ if (!(sel&1)) {
+ num_x = gw->num_on_x_axis;
+ assert(num_x > 0);
+ col_ptr = row_ptr;
+ do {
+ if (*col_ptr != INVALID_VALUE) {
+ mx = max64(mx, myabs64(*col_ptr));
+ }
+ } while (col_ptr++, --num_x);
+ }
+ } while (sel>>=1, row_ptr+=24, --num_dataset);
/* setup scaling */
- y_scaling = 0x80000000;
+ y_scaling = INVALID_VALUE;
value = adj_height * 2;
if (mx > value) {
mx = (mx + 7) & ~7;
- y_scaling = (uint32) (((uint64) (value>>1) << 32) / mx);
+ y_scaling = (((uint64) (value>>1) << 32) / mx);
value = mx;
}
@@ -114,7 +130,7 @@ void DrawGraph(GraphDrawer *gw)
i = 9;
do {
SET_DPARAM16(0, gw->format_str_y_axis);
- SET_DPARAM32(1, tmp);
+ SET_DPARAM64(1, (int64)tmp);
tmp -= (value >> 3);
DrawStringRightAligned(x, y, STR_0170, gw->color_3);
y += gw->height >> 3;
@@ -156,27 +172,27 @@ void DrawGraph(GraphDrawer *gw)
/* draw lines and dots */
i = 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 {
if (!(sel & 1)) {
x = gw->left + 55;
j = gw->num_on_x_axis;assert(j>0);
col_ptr = row_ptr;
color = gw->colors[i];
- old_y = old_x = 0x80000000;
+ old_y = old_x = INVALID_VALUE;
do {
cur_val = *col_ptr++;
- if (cur_val != (int32)0x80000000) {
- y = adj_height - BIGMULSS(cur_val, y_scaling >> 1, 31) + gw->top;
+ if (cur_val != INVALID_VALUE) {
+ y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top;
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);
old_x = x;
old_y = y;
} else {
- old_x = 0x80000000;
+ old_x = INVALID_VALUE;
}
} while (x+=22,--j);
}
@@ -310,7 +326,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
gd.top = 18;
gd.height = 136;
gd.include_neg = true;
- gd.format_str_y_axis = STR_7023;
+ gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 0x10;
gd.color_2 = 0xD7;
gd.bg_line_color = 0xE;
@@ -323,7 +339,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
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++;
}
numd++;
@@ -331,11 +347,9 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
gd.num_dataset=numd;
DrawGraph(&gd);
- break;
- }
-
+ } break;
case WE_CLICK:
- if (e->click.widget == 2)
+ if (e->click.widget == 2) /* Clicked on Legend */
ShowGraphLegend();
break;
}
@@ -386,7 +400,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
gd.top = 18;
gd.height = 104;
gd.include_neg = false;
- gd.format_str_y_axis = STR_7023;
+ gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 0x10;
gd.color_2 = 0xD7;
gd.bg_line_color = 0xE;
@@ -398,7 +412,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
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++;
}
numd++;
@@ -472,7 +486,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
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++;
}
numd++;
@@ -766,7 +780,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
continue;
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
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++;
}
numd++;
@@ -830,7 +844,7 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
gd.top = 18;
gd.height = 200;
gd.include_neg = false;
- gd.format_str_y_axis = STR_7023;
+ gd.format_str_y_axis = STR_CURRCOMPACT64;
gd.color_3 = 0x10;
gd.color_2 = 0xD7;
gd.bg_line_color = 0xE;
@@ -840,9 +854,10 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
FOR_ALL_PLAYERS(p) {
if (!p->is_active)
continue;
+
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
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++;
}
numd++;
@@ -917,7 +932,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
gd.top = 24;
gd.height = 104;
gd.include_neg = false;
- gd.format_str_y_axis = STR_7023;
+ gd.format_str_y_axis = STR_CURRCOMPACT32;
gd.color_3 = 16;
gd.color_2 = 215;
gd.bg_line_color = 14;
@@ -931,7 +946,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
for(i=0; i!=NUM_CARGO; i++) {
gd.colors[i] = _cargo_legend_colors[i];
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);
}
}
diff --git a/lang/american.txt b/lang/american.txt
index dfae22013..488d55570 100644
--- a/lang/american.txt
+++ b/lang/american.txt
@@ -1785,7 +1785,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Income Graph
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph
STR_7026_BANK_BALANCE :{WHITE}Bank Balance
diff --git a/lang/czech.txt b/lang/czech.txt
index 07f84aa21..f78a21661 100644
--- a/lang/czech.txt
+++ b/lang/czech.txt
@@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Celkem:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf prijmu
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf provozního zisku
STR_7026_BANK_BALANCE :{WHITE}Stav na uctu
diff --git a/lang/danish.txt b/lang/danish.txt
index e3e15f739..7a0bfdc2c 100644
--- a/lang/danish.txt
+++ b/lang/danish.txt
@@ -1720,7 +1720,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Indkomst Graf
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Profit Garf
STR_7026_BANK_BALANCE :{WHITE}Bank Balance
diff --git a/lang/dutch.txt b/lang/dutch.txt
index 022acb69d..120006aae 100644
--- a/lang/dutch.txt
+++ b/lang/dutch.txt
@@ -1675,7 +1675,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totaal:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Inkomstengrafiek
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7027_LOAN :{WHITE}Lening
STR_7028 :{BLACK}{CURRENCY64}
diff --git a/lang/english.txt b/lang/english.txt
index df2abd64a..8d41fb096 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -1853,7 +1853,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Income Graph
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Operating Profit Graph
STR_7026_BANK_BALANCE :{WHITE}Bank Balance
diff --git a/lang/finnish.txt b/lang/finnish.txt
index 17ada391d..3220354f1 100644
--- a/lang/finnish.txt
+++ b/lang/finnish.txt
@@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Yhteensä:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Tulokuvaaja
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Tuottokuvaaja
STR_7026_BANK_BALANCE :{WHITE}Tilin kate
diff --git a/lang/french.txt b/lang/french.txt
index 48bb0bc4f..d115788ce 100644
--- a/lang/french.txt
+++ b/lang/french.txt
@@ -1848,7 +1848,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graphique du Revenu
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graphique du profit d'opération
STR_7026_BANK_BALANCE :{WHITE}Equilibre bancaire
diff --git a/lang/galician.txt b/lang/galician.txt
index 47bff2890..85cf38faf 100644
--- a/lang/galician.txt
+++ b/lang/galician.txt
@@ -1785,7 +1785,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Gráfico de Ingresos
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Gráfica de Beneficios Operativos
STR_7026_BANK_BALANCE :{WHITE}Balance do Banco
diff --git a/lang/german.txt b/lang/german.txt
index 76e0a9c75..a22e2f123 100644
--- a/lang/german.txt
+++ b/lang/german.txt
@@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Gesamt:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Einkommensdiagramm
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Betriebsgewinndiagramm
STR_7026_BANK_BALANCE :{WHITE}Kontostand
diff --git a/lang/hungarian.txt b/lang/hungarian.txt
index 19d4ea848..28be7ba4d 100644
--- a/lang/hungarian.txt
+++ b/lang/hungarian.txt
@@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Összesen:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Jövedelem grafikon
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Működési nyereség grafikon
STR_7026_BANK_BALANCE :{WHITE}Banki egyenleg
diff --git a/lang/italian.txt b/lang/italian.txt
index a131b41c3..f1685d51b 100644
--- a/lang/italian.txt
+++ b/lang/italian.txt
@@ -1803,7 +1803,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totale:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Grafico Incassi
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Grafico Profitti Operazionali
STR_7026_BANK_BALANCE :{WHITE}Bilancio Bancario
diff --git a/lang/norwegian.txt b/lang/norwegian.txt
index 5dd10418e..37d1fca83 100644
--- a/lang/norwegian.txt
+++ b/lang/norwegian.txt
@@ -1648,7 +1648,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totalt:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Inntektsgraf
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Overskudd graf
STR_7026_BANK_BALANCE :{WHITE}Saldo
diff --git a/lang/polish.txt b/lang/polish.txt
index aaef63120..b67ef09c3 100644
--- a/lang/polish.txt
+++ b/lang/polish.txt
@@ -1745,7 +1745,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Calkowicie:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Wykres przychodow
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Wykres obrotow
STR_7026_BANK_BALANCE :{WHITE}Bilans bankowy
diff --git a/lang/romanian.txt b/lang/romanian.txt
index aa4f5849c..811d93b21 100644
--- a/lang/romanian.txt
+++ b/lang/romanian.txt
@@ -1851,7 +1851,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Total:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graficul veniturilor
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graficul profitului din operare
STR_7026_BANK_BALANCE :{WHITE}Balantă curentă
diff --git a/lang/slovak.txt b/lang/slovak.txt
index 8996c663a..0b0e56f9a 100644
--- a/lang/slovak.txt
+++ b/lang/slovak.txt
@@ -1647,7 +1647,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Spolu:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf zisku
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf prevadzkoveho zisku
STR_7026_BANK_BALANCE :{WHITE}Zostatok v banke
diff --git a/lang/swedish.txt b/lang/swedish.txt
index 0485669f4..cf16e4868 100644
--- a/lang/swedish.txt
+++ b/lang/swedish.txt
@@ -1750,7 +1750,8 @@ STR_701F :{BLACK}+{CURRENCY64}
STR_7020_TOTAL :{WHITE}Totalt:
STR_7021 :{STRING}{STRING}
STR_7022_INCOME_GRAPH :{WHITE}Graf över inkomster
-STR_7023 :{CURRCOMPACT}
+STR_CURRCOMPACT32 :{CURRCOMPACT}
+STR_CURRCOMPACT64 :{CURRCOMPACT64}
STR_7024 :{COMMA32}
STR_7025_OPERATING_PROFIT_GRAPH :{WHITE}Graf över vinst
STR_7026_BANK_BALANCE :{WHITE}Banksaldo
diff --git a/macros.h b/macros.h
index 5e0ff540c..40c923f7e 100644
--- a/macros.h
+++ b/macros.h
@@ -13,6 +13,7 @@
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 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 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));
}
+static INLINE int64 BIGMULSS64(int64 a, int64 b, int shift) {
+ return ((a) * (b)) >> (shift);
+}
+
static INLINE uint32 BIGMULUS(uint32 a, uint32 b, int 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)))
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_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }
diff --git a/strgen/strgen.c b/strgen/strgen.c
index 8726de932..9e146feca 100644
--- a/strgen/strgen.c
+++ b/strgen/strgen.c
@@ -246,10 +246,12 @@ static const CmdStruct _cmd_structs[] = {
{"CURRENCY", EmitSingleByte, 0x7F},
- {"CURRCOMPACT", EmitEscapedByte, 0}, // compact currency
- {"INT32", EmitEscapedByte, 1}, // compact currency
- {"REV", EmitEscapedByte, 2}, // openttd revision string
- {"SHORTCARGO", EmitEscapedByte, 3}, // short cargo description, only ### tons, or ### litres
+ // 0x85
+ {"CURRCOMPACT", EmitEscapedByte, 0}, // compact currency (32 bits)
+ {"INT32", EmitEscapedByte, 1}, // signed 32 bit integer
+ {"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},
diff --git a/strings.c b/strings.c
index 1c2d6dc84..f79b491ab 100644
--- a/strings.c
+++ b/strings.c
@@ -433,20 +433,19 @@ static byte *DecodeString(byte *buff, const byte *str)
// 0x85 is used as escape character..
case 0x85:
switch(*str++) {
- case 0:
+ case 0: /* {CURRCOMPACT} */
buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt32(), true);
break;
- case 1: // {INT32}
+ case 1: /* {INT32} */
buff = FormatNoCommaNumber(buff, GetParamInt32());
break;
-
- case 2: // {REV}
+ case 2: /* {REV} */
#ifdef WITH_REV
buff = str_cat(buff, (const byte*)_openttd_revision);
#endif
break;
- case 3: { // {SHORTCARGO}
- // Layout:
+ case 3: { /* {SHORTCARGO} */
+ // Short description of cargotypes. Layout:
// 8-bit = cargo type
// 16-bit = cargo count
char *s;
@@ -458,8 +457,11 @@ static byte *DecodeString(byte *buff, const byte *str)
memcpy(buff++, " ", 1);
while (*s) *buff++ = *s++;
+ } break;
+ case 4: /* {CURRCOMPACT64} */
+ // 64 bit compact currency-unit
+ buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt64(), true);
break;
- }
default:
error("!invalid escape sequence in string");