mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r8319) -Codechange: Remove the remaining colours from GraphDrawer as they're also the same everywhere.
This commit is contained in:
parent
43e275f758
commit
60864af5d1
@ -23,7 +23,11 @@ static uint _legend_cargobits;
|
|||||||
/* GENERIC GRAPH DRAWER */
|
/* GENERIC GRAPH DRAWER */
|
||||||
/************************/
|
/************************/
|
||||||
|
|
||||||
enum {GRAPH_NUM = 16};
|
enum {
|
||||||
|
GRAPH_MAX_DATASETS = 16,
|
||||||
|
GRAPH_AXIS_LABEL_COLOUR = 16,
|
||||||
|
GRAPH_AXIS_LINE_COLOUR = 215,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct GraphDrawer {
|
typedef struct GraphDrawer {
|
||||||
uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown)
|
uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown)
|
||||||
@ -38,9 +42,8 @@ typedef struct GraphDrawer {
|
|||||||
int left, top;
|
int left, top;
|
||||||
uint height;
|
uint height;
|
||||||
StringID format_str_y_axis;
|
StringID format_str_y_axis;
|
||||||
byte color_3, color_2;
|
byte colors[GRAPH_MAX_DATASETS];
|
||||||
byte colors[GRAPH_NUM];
|
int64 cost[GRAPH_MAX_DATASETS][24]; // last 2 years
|
||||||
int64 cost[GRAPH_NUM][24]; // last 2 years
|
|
||||||
} GraphDrawer;
|
} GraphDrawer;
|
||||||
|
|
||||||
static const int64 INVALID_VALUE = 0x80000000;
|
static const int64 INVALID_VALUE = 0x80000000;
|
||||||
@ -62,7 +65,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||||||
|
|
||||||
/* the colors and cost array of GraphDrawer must accomodate
|
/* the colors and cost array of GraphDrawer must accomodate
|
||||||
* both values for cargo and players. So if any are higher, quit */
|
* both values for cargo and players. So if any are higher, quit */
|
||||||
assert(GRAPH_NUM >= (int)NUM_CARGO && GRAPH_NUM >= (int)MAX_PLAYERS);
|
assert(GRAPH_MAX_DATASETS >= (int)NUM_CARGO && GRAPH_MAX_DATASETS >= (int)MAX_PLAYERS);
|
||||||
|
|
||||||
byte grid_colour = _colour_gradient[14][4];
|
byte grid_colour = _colour_gradient[14][4];
|
||||||
|
|
||||||
@ -87,14 +90,14 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||||||
} while (--i);
|
} while (--i);
|
||||||
|
|
||||||
/* draw vertical edge line */
|
/* draw vertical edge line */
|
||||||
GfxFillRect(x, gw->top, x, bottom, gw->color_2);
|
GfxFillRect(x, gw->top, x, bottom, GRAPH_AXIS_LINE_COLOUR);
|
||||||
|
|
||||||
adj_height = gw->height;
|
adj_height = gw->height;
|
||||||
if (gw->include_neg) adj_height >>= 1;
|
if (gw->include_neg) adj_height >>= 1;
|
||||||
|
|
||||||
/* draw horiz edge line */
|
/* draw horiz edge line */
|
||||||
y = adj_height + gw->top;
|
y = adj_height + gw->top;
|
||||||
GfxFillRect(x, y, right, y, gw->color_2);
|
GfxFillRect(x, y, right, y, GRAPH_AXIS_LINE_COLOUR);
|
||||||
|
|
||||||
/* find the max element */
|
/* find the max element */
|
||||||
if (gw->num_on_x_axis == 0)
|
if (gw->num_on_x_axis == 0)
|
||||||
@ -141,7 +144,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||||||
SetDParam(0, gw->format_str_y_axis);
|
SetDParam(0, gw->format_str_y_axis);
|
||||||
SetDParam64(1, (int64)tmp);
|
SetDParam64(1, (int64)tmp);
|
||||||
tmp -= (value >> 3);
|
tmp -= (value >> 3);
|
||||||
DrawStringRightAligned(x, y, STR_0170, gw->color_3);
|
DrawStringRightAligned(x, y, STR_0170, GRAPH_AXIS_LABEL_COLOUR);
|
||||||
y += gw->height >> 3;
|
y += gw->height >> 3;
|
||||||
} while (--i);
|
} while (--i);
|
||||||
|
|
||||||
@ -156,7 +159,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||||||
SetDParam(2, k);
|
SetDParam(2, k);
|
||||||
SetDParam(0, j + STR_0162_JAN);
|
SetDParam(0, j + STR_0162_JAN);
|
||||||
SetDParam(1, j + STR_0162_JAN + 2);
|
SetDParam(1, j + STR_0162_JAN + 2);
|
||||||
DrawString(x, y, j == 0 ? STR_016F : STR_016E, gw->color_3);
|
DrawString(x, y, j == 0 ? STR_016F : STR_016E, GRAPH_AXIS_LABEL_COLOUR);
|
||||||
|
|
||||||
j += 3;
|
j += 3;
|
||||||
if (j >= 12) {
|
if (j >= 12) {
|
||||||
@ -172,7 +175,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||||||
i = gw->num_on_x_axis;assert(i>0);
|
i = gw->num_on_x_axis;assert(i>0);
|
||||||
do {
|
do {
|
||||||
SetDParam(0, j);
|
SetDParam(0, j);
|
||||||
DrawString(x, y, STR_01CB, gw->color_3);
|
DrawString(x, y, STR_01CB, GRAPH_AXIS_LABEL_COLOUR);
|
||||||
j += gw->unk61C;
|
j += gw->unk61C;
|
||||||
x += 22;
|
x += 22;
|
||||||
} while (--i);
|
} while (--i);
|
||||||
@ -340,8 +343,6 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 136;
|
gd.height = 136;
|
||||||
gd.include_neg = true;
|
gd.include_neg = true;
|
||||||
gd.format_str_y_axis = STR_CURRCOMPACT;
|
gd.format_str_y_axis = STR_CURRCOMPACT;
|
||||||
gd.color_3 = 0x10;
|
|
||||||
gd.color_2 = 0xD7;
|
|
||||||
|
|
||||||
SetupGraphDrawerForPlayers(&gd);
|
SetupGraphDrawerForPlayers(&gd);
|
||||||
|
|
||||||
@ -413,8 +414,6 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 104;
|
gd.height = 104;
|
||||||
gd.include_neg = false;
|
gd.include_neg = false;
|
||||||
gd.format_str_y_axis = STR_CURRCOMPACT;
|
gd.format_str_y_axis = STR_CURRCOMPACT;
|
||||||
gd.color_3 = 0x10;
|
|
||||||
gd.color_2 = 0xD7;
|
|
||||||
SetupGraphDrawerForPlayers(&gd);
|
SetupGraphDrawerForPlayers(&gd);
|
||||||
|
|
||||||
numd = 0;
|
numd = 0;
|
||||||
@ -485,8 +484,6 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 104;
|
gd.height = 104;
|
||||||
gd.include_neg = false;
|
gd.include_neg = false;
|
||||||
gd.format_str_y_axis = STR_7024;
|
gd.format_str_y_axis = STR_7024;
|
||||||
gd.color_3 = 0x10;
|
|
||||||
gd.color_2 = 0xD7;
|
|
||||||
SetupGraphDrawerForPlayers(&gd);
|
SetupGraphDrawerForPlayers(&gd);
|
||||||
|
|
||||||
numd = 0;
|
numd = 0;
|
||||||
@ -557,8 +554,6 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 200;
|
gd.height = 200;
|
||||||
gd.include_neg = false;
|
gd.include_neg = false;
|
||||||
gd.format_str_y_axis = STR_7024;
|
gd.format_str_y_axis = STR_7024;
|
||||||
gd.color_3 = 0x10;
|
|
||||||
gd.color_2 = 0xD7;
|
|
||||||
SetupGraphDrawerForPlayers(&gd);
|
SetupGraphDrawerForPlayers(&gd);
|
||||||
|
|
||||||
numd = 0;
|
numd = 0;
|
||||||
@ -632,8 +627,6 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 200;
|
gd.height = 200;
|
||||||
gd.include_neg = false;
|
gd.include_neg = false;
|
||||||
gd.format_str_y_axis = STR_CURRCOMPACT;
|
gd.format_str_y_axis = STR_CURRCOMPACT;
|
||||||
gd.color_3 = 0x10;
|
|
||||||
gd.color_2 = 0xD7;
|
|
||||||
SetupGraphDrawerForPlayers(&gd);
|
SetupGraphDrawerForPlayers(&gd);
|
||||||
|
|
||||||
numd = 0;
|
numd = 0;
|
||||||
@ -715,8 +708,6 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
|||||||
gd.height = 104;
|
gd.height = 104;
|
||||||
gd.include_neg = false;
|
gd.include_neg = false;
|
||||||
gd.format_str_y_axis = STR_CURRCOMPACT;
|
gd.format_str_y_axis = STR_CURRCOMPACT;
|
||||||
gd.color_3 = 16;
|
|
||||||
gd.color_2 = 215;
|
|
||||||
gd.num_dataset = NUM_CARGO;
|
gd.num_dataset = NUM_CARGO;
|
||||||
gd.num_on_x_axis = 20;
|
gd.num_on_x_axis = 20;
|
||||||
gd.num_vert_lines = 20;
|
gd.num_vert_lines = 20;
|
||||||
|
Loading…
Reference in New Issue
Block a user