mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r7444) -Codechange: Use one (global) cargo-colours array for drawing cargo-colours. Change Food
colour to pink everywhere (fixes FS#303)
This commit is contained in:
parent
a5cd252952
commit
2f3c5a05bb
@ -16,6 +16,8 @@
|
|||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
|
|
||||||
|
const byte _cargo_colours[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 48};
|
||||||
|
|
||||||
static uint _legend_excludebits;
|
static uint _legend_excludebits;
|
||||||
static uint _legend_cargobits;
|
static uint _legend_cargobits;
|
||||||
|
|
||||||
@ -699,8 +701,6 @@ void ShowCompanyValueGraph(void)
|
|||||||
/* PAYMENT RATES */
|
/* PAYMENT RATES */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
static const byte _cargo_legend_colors[12] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 215};
|
|
||||||
|
|
||||||
static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
@ -746,11 +746,11 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
|||||||
byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0;
|
byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0;
|
||||||
|
|
||||||
GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
|
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_legend_colors[i]);
|
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]);
|
SetDParam(0, _cargoc.names_s[i]);
|
||||||
DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0);
|
DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0);
|
||||||
y += 8;
|
y += 8;
|
||||||
gd.colors[i] = _cargo_legend_colors[i];
|
gd.colors[i] = _cargo_colours[i];
|
||||||
for (j = 0; j != 20; j++) {
|
for (j = 0; j != 20; j++) {
|
||||||
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j * 6 + 6, i);
|
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j * 6 + 6, i);
|
||||||
}
|
}
|
||||||
|
1
gui.h
1
gui.h
@ -20,6 +20,7 @@ void ShowPatchesSelection(void);
|
|||||||
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right);
|
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right);
|
||||||
|
|
||||||
/* graph_gui.c */
|
/* graph_gui.c */
|
||||||
|
extern const byte _cargo_colours[NUM_CARGO];
|
||||||
void ShowOperatingProfitGraph(void);
|
void ShowOperatingProfitGraph(void);
|
||||||
void ShowIncomeGraph(void);
|
void ShowIncomeGraph(void);
|
||||||
void ShowDeliveredCargoGraph(void);
|
void ShowDeliveredCargoGraph(void);
|
||||||
|
@ -46,8 +46,7 @@ static StationSortListingTypeFunction StationRatingMaxSorter;
|
|||||||
|
|
||||||
static void StationsWndShowStationRating(int x, int y, int type, uint acceptance, int rating)
|
static void StationsWndShowStationRating(int x, int y, int type, uint acceptance, int rating)
|
||||||
{
|
{
|
||||||
static const byte _rating_colors[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 55, 184, 10, 191, 48};
|
int color = _cargo_colours[type];
|
||||||
int color = _rating_colors[type];
|
|
||||||
uint w;
|
uint w;
|
||||||
|
|
||||||
if (acceptance > 575) acceptance = 575;
|
if (acceptance > 575) acceptance = 575;
|
||||||
@ -304,7 +303,6 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
|||||||
int max;
|
int max;
|
||||||
int i, cg_ofst;
|
int i, cg_ofst;
|
||||||
int x = 0, y = 0, xb = 2; // offset from top of widget
|
int x = 0, y = 0, xb = 2; // offset from top of widget
|
||||||
static const byte _cargo_legend_colors[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 215};
|
|
||||||
|
|
||||||
/* draw sorting criteria string */
|
/* draw sorting criteria string */
|
||||||
DrawString(85, 26, _station_sort_listing[sl->sort_type], 0x10);
|
DrawString(85, 26, _station_sort_listing[sl->sort_type], 0x10);
|
||||||
@ -318,7 +316,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
|||||||
for (i = 0; i < NUM_CARGO; i++) {
|
for (i = 0; i < NUM_CARGO; i++) {
|
||||||
cg_ofst = IsWindowWidgetLowered(w, i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
|
cg_ofst = IsWindowWidgetLowered(w, i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
|
||||||
|
|
||||||
GfxFillRect(x + cg_ofst, y + cg_ofst + 1, x + cg_ofst + 10 , y + cg_ofst + 7, _cargo_legend_colors[i]);
|
GfxFillRect(x + cg_ofst, y + cg_ofst + 1, x + cg_ofst + 10 , y + cg_ofst + 7, _cargo_colours[i]);
|
||||||
DrawString(x + cg_ofst + 2, y + cg_ofst + 1, _cargoc.names_short[i], i == 11 ? 15 : 16);
|
DrawString(x + cg_ofst + 2, y + cg_ofst + 1, _cargoc.names_short[i], i == 11 ? 15 : 16);
|
||||||
x += 14;
|
x += 14;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user