(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.
--- a/economy.c Mon Sep 13 18:42:45 2004 +0000
+++ b/economy.c Mon Sep 13 20:38:36 2004 +0000
@@ -75,7 +75,7 @@
}
if (p->player_money > 0)
- value += p->player_money;
+ value += p->money64; // add real money value
return value;
}
--- a/graph_gui.c Mon Sep 13 18:42:45 2004 +0000
+++ b/graph_gui.c Mon Sep 13 20:38:36 2004 +0000
@@ -13,6 +13,8 @@
/* GENERIC GRAPH DRAWER */
/************************/
+enum {GRAPH_NUM = 16};
+
typedef struct GraphDrawer {
uint sel;
byte num_dataset;
@@ -27,10 +29,12 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
}
--- a/lang/american.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/american.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1785,7 +1785,8 @@
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
--- a/lang/czech.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/czech.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1851,7 +1851,8 @@
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
--- a/lang/danish.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/danish.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1720,7 +1720,8 @@
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
--- a/lang/dutch.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/dutch.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1675,7 +1675,8 @@
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}
--- a/lang/english.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/english.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1853,7 +1853,8 @@
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
--- a/lang/finnish.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/finnish.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1851,7 +1851,8 @@
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
--- a/lang/french.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/french.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1848,7 +1848,8 @@
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
--- a/lang/galician.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/galician.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1785,7 +1785,8 @@
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
--- a/lang/german.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/german.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1851,7 +1851,8 @@
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
--- a/lang/hungarian.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/hungarian.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1851,7 +1851,8 @@
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
--- a/lang/italian.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/italian.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1803,7 +1803,8 @@
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
--- a/lang/norwegian.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/norwegian.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1648,7 +1648,8 @@
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
--- a/lang/polish.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/polish.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1745,7 +1745,8 @@
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
--- a/lang/romanian.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/romanian.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1851,7 +1851,8 @@
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ă
--- a/lang/slovak.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/slovak.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1647,7 +1647,8 @@
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
--- a/lang/swedish.txt Mon Sep 13 18:42:45 2004 +0000
+++ b/lang/swedish.txt Mon Sep 13 20:38:36 2004 +0000
@@ -1750,7 +1750,8 @@
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
--- a/macros.h Mon Sep 13 18:42:45 2004 +0000
+++ b/macros.h Mon Sep 13 20:38:36 2004 +0000
@@ -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 @@
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 @@
#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; }
--- a/strgen/strgen.c Mon Sep 13 18:42:45 2004 +0000
+++ b/strgen/strgen.c Mon Sep 13 20:38:36 2004 +0000
@@ -246,10 +246,12 @@
{"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},
--- a/strings.c Mon Sep 13 18:42:45 2004 +0000
+++ b/strings.c Mon Sep 13 20:38:36 2004 +0000
@@ -433,20 +433,19 @@
// 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 @@
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");