summaryrefslogtreecommitdiff
path: root/src/graph_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-02-20 22:09:21 +0000
committerpeter1138 <peter1138@openttd.org>2007-02-20 22:09:21 +0000
commitef2daa5060e251834e82df1ba3e081579ff84f2f (patch)
tree9caff20858ac3f06265e4f69d54b9cdb03a47004 /src/graph_gui.cpp
parent6621beb126c4bf1481b9d7826f3efd10c2bb8308 (diff)
downloadopenttd-ef2daa5060e251834e82df1ba3e081579ff84f2f.tar.xz
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r--src/graph_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 8188414eb..6f5693347 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -13,8 +13,7 @@
#include "variables.h"
#include "date.h"
#include "helpers.hpp"
-
-const byte _cargo_colours[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 48};
+#include "cargotype.h"
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_players;
@@ -749,13 +748,14 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
* clk_dif will move one pixel down and one pixel to the right
* when the button is clicked */
byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0;
+ const CargoSpec *cs = GetCargo(i);
GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
- GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, _cargo_colours[i]);
- SetDParam(0, _cargoc.names_s[i]);
+ GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour);
+ SetDParam(0, cs->name != 0 ? cs->name : (StringID)STR_EMPTY);
DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0);
y += 8;
- gd.colors[i] = _cargo_colours[i];
+ gd.colors[i] = cs->legend_colour;
for (j = 0; j != 20; j++) {
gd.cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 6 + 6, i);
}