Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/colors_common.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Functions
colors_common.h File Reference
`#include "registry.h"`
`#include "fc_types.h"`
`#include "specenum_gen.h"`

Go to the source code of this file.

## Macros

#define | SPECENUM_NAME color_std
#define | SPECENUM_VALUE0 COLOR_MAPVIEW_UNKNOWN /* Black */
#define | SPECENUM_VALUE0NAME "mapview_unknown"
#define | SPECENUM_VALUE1 COLOR_MAPVIEW_CITYTEXT /* white */
#define | SPECENUM_VALUE1NAME "mapview_citytext"
#define | SPECENUM_VALUE2 COLOR_MAPVIEW_CITYTEXT_DARK /* black */
#define | SPECENUM_VALUE2NAME "mapview_citytext_dark"
#define | SPECENUM_VALUE3 COLOR_MAPVIEW_CITYPROD_NEGATIVE /* red */
#define | SPECENUM_VALUE3NAME "mapview_cityprod_negative"
#define | SPECENUM_VALUE4 COLOR_MAPVIEW_CITYGROWTH_BLOCKED /* red */
#define | SPECENUM_VALUE4NAME "mapview_cityblocked"
#define | SPECENUM_VALUE5 COLOR_MAPVIEW_GOTO /* cyan */
#define | SPECENUM_VALUE5NAME "mapview_goto"
#define | SPECENUM_VALUE6 COLOR_MAPVIEW_SELECTION /* yellow */
#define | SPECENUM_VALUE6NAME "mapview_selection"
#define | SPECENUM_VALUE7 COLOR_MAPVIEW_TRADE_ROUTE_LINE
#define | SPECENUM_VALUE7NAME "mapview_trade_route_line"
#define | SPECENUM_VALUE8 COLOR_MAPVIEW_TRADE_ROUTES_ALL_BUILT /* green */
#define | SPECENUM_VALUE8NAME "mapview_trade_routes_all_built"
#define | SPECENUM_VALUE9 COLOR_MAPVIEW_TRADE_ROUTES_SOME_BUILT /* yellow */
#define | SPECENUM_VALUE9NAME "mapview_trade_routes_some_built"
#define | SPECENUM_VALUE10 COLOR_MAPVIEW_TRADE_ROUTES_NO_BUILT /* red */
#define | SPECENUM_VALUE10NAME "mapview_trade_routes_no_built"
#define | SPECENUM_VALUE11 COLOR_MAPVIEW_CITY_LINK /* green */
#define | SPECENUM_VALUE11NAME "mapview_city_link"
#define | SPECENUM_VALUE12 COLOR_MAPVIEW_TILE_LINK /* red */
#define | SPECENUM_VALUE12NAME "mapview_tile_link"
#define | SPECENUM_VALUE13 COLOR_MAPVIEW_UNIT_LINK /* cyan */
#define | SPECENUM_VALUE13NAME "mapview_unit_link"
#define | SPECENUM_VALUE14 COLOR_SPACESHIP_BACKGROUND /* black */
#define | SPECENUM_VALUE14NAME "spaceship_background"
#define | SPECENUM_VALUE15 COLOR_OVERVIEW_UNKNOWN /* Black */
#define | SPECENUM_VALUE15NAME "overview_unknown"
#define | SPECENUM_VALUE16 COLOR_OVERVIEW_MY_CITY /* white */
#define | SPECENUM_VALUE16NAME "overview_mycity"
#define | SPECENUM_VALUE17 COLOR_OVERVIEW_ALLIED_CITY
#define | SPECENUM_VALUE17NAME "overview_alliedcity"
#define | SPECENUM_VALUE18 COLOR_OVERVIEW_ENEMY_CITY /* cyan */
#define | SPECENUM_VALUE18NAME "overview_enemycity"
#define | SPECENUM_VALUE19 COLOR_OVERVIEW_MY_UNIT /* yellow */
#define | SPECENUM_VALUE19NAME "overview_myunit"
#define | SPECENUM_VALUE20 COLOR_OVERVIEW_ALLIED_UNIT
#define | SPECENUM_VALUE20NAME "overview_alliedunit"
#define | SPECENUM_VALUE21 COLOR_OVERVIEW_ENEMY_UNIT /* red */
#define | SPECENUM_VALUE21NAME "overview_enemyunit"
#define | SPECENUM_VALUE22 COLOR_OVERVIEW_OCEAN /* ocean/blue */
#define | SPECENUM_VALUE22NAME "overview_ocean"
#define | SPECENUM_VALUE23 COLOR_OVERVIEW_LAND /* ground/green */
#define | SPECENUM_VALUE23NAME "overview_ground"
#define | SPECENUM_VALUE24 COLOR_OVERVIEW_FROZEN /* frozen/grey */
#define | SPECENUM_VALUE24NAME "overview_frozen"
#define | SPECENUM_VALUE25 COLOR_OVERVIEW_VIEWRECT /* white */
#define | SPECENUM_VALUE25NAME "overview_viewrect"
#define | SPECENUM_VALUE26 COLOR_REQTREE_RESEARCHING /* cyan */
#define | SPECENUM_VALUE26NAME "reqtree_researching"
#define | SPECENUM_VALUE27 COLOR_REQTREE_KNOWN /* green */
#define | SPECENUM_VALUE27NAME "reqtree_known"
#define | SPECENUM_VALUE28 COLOR_REQTREE_GOAL_PREREQS_KNOWN
#define | SPECENUM_VALUE28NAME "reqtree_goal_prereqs_known"
#define | SPECENUM_VALUE29 COLOR_REQTREE_GOAL_UNKNOWN
#define | SPECENUM_VALUE29NAME "reqtree_goal_unknown"
#define | SPECENUM_VALUE30 COLOR_REQTREE_PREREQS_KNOWN /* yellow */
#define | SPECENUM_VALUE30NAME "reqtree_prereqs_known"
#define | SPECENUM_VALUE31 COLOR_REQTREE_UNKNOWN /* red */
#define | SPECENUM_VALUE31NAME "reqtree_unknown"
#define | SPECENUM_VALUE32 COLOR_REQTREE_UNREACHABLE
#define | SPECENUM_VALUE32NAME "reqtree_unreachable"
#define | SPECENUM_VALUE33 COLOR_REQTREE_NOT_GETTABLE
#define | SPECENUM_VALUE33NAME "reqtree_not_gettable"
#define | SPECENUM_VALUE34 COLOR_REQTREE_GOAL_NOT_GETTABLE
#define | SPECENUM_VALUE34NAME "reqtree_goal_not_gettable"
#define | SPECENUM_VALUE35 COLOR_REQTREE_BACKGROUND /* black */
#define | SPECENUM_VALUE35NAME "reqtree_background"
#define | SPECENUM_VALUE36 COLOR_REQTREE_TEXT /* black */
#define | SPECENUM_VALUE36NAME "reqtree_text"
#define | SPECENUM_VALUE37 COLOR_REQTREE_EDGE /* gray */
#define | SPECENUM_VALUE37NAME "reqtree_edge"
#define | SPECENUM_VALUE38 COLOR_PLAYER_COLOR_BACKGROUND /* black */
#define | SPECENUM_VALUE38NAME "playerdlg_background"
#define | SPECENUM_COUNT COLOR_LAST

## Functions

struct color * | get_color (const struct tileset *t, enum color_std stdcolor)
bool | player_has_color (const struct player *pplayer)
struct color * | get_player_color (const struct tileset *t, const struct player *pplayer)
struct color * | get_terrain_color (const struct tileset *t, const struct terrain *pterrain)
struct color * | ensure_color (struct rgbcolor *rgb)
struct color_system * | color_system_read (struct section_file *file)
void | color_system_free (struct color_system *colors)
struct color * | color_best_contrast (struct color *subject, struct color **candidates, int ncandidates)

## Macro Definition Documentation

## ◆ SPECENUM_COUNT

#define SPECENUM_COUNT COLOR_LAST

Definition at line 120 of file colors_common.h.

## ◆ SPECENUM_NAME

#define SPECENUM_NAME color_std

Definition at line 35 of file colors_common.h.

## ◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0 COLOR_MAPVIEW_UNKNOWN /* Black */

Definition at line 37 of file colors_common.h.

## ◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME "mapview_unknown"

Definition at line 38 of file colors_common.h.

## ◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1 COLOR_MAPVIEW_CITYTEXT /* white */

Definition at line 39 of file colors_common.h.

## ◆ SPECENUM_VALUE10

#define SPECENUM_VALUE10 COLOR_MAPVIEW_TRADE_ROUTES_NO_BUILT /* red */

Definition at line 57 of file colors_common.h.

## ◆ SPECENUM_VALUE10NAME

#define SPECENUM_VALUE10NAME "mapview_trade_routes_no_built"

Definition at line 58 of file colors_common.h.

## ◆ SPECENUM_VALUE11

#define SPECENUM_VALUE11 COLOR_MAPVIEW_CITY_LINK /* green */

Definition at line 59 of file colors_common.h.

## ◆ SPECENUM_VALUE11NAME

#define SPECENUM_VALUE11NAME "mapview_city_link"

Definition at line 60 of file colors_common.h.

## ◆ SPECENUM_VALUE12

#define SPECENUM_VALUE12 COLOR_MAPVIEW_TILE_LINK /* red */

Definition at line 61 of file colors_common.h.

## ◆ SPECENUM_VALUE12NAME

#define SPECENUM_VALUE12NAME "mapview_tile_link"

Definition at line 62 of file colors_common.h.

## ◆ SPECENUM_VALUE13

#define SPECENUM_VALUE13 COLOR_MAPVIEW_UNIT_LINK /* cyan */

Definition at line 63 of file colors_common.h.

## ◆ SPECENUM_VALUE13NAME

#define SPECENUM_VALUE13NAME "mapview_unit_link"

Definition at line 64 of file colors_common.h.

## ◆ SPECENUM_VALUE14

#define SPECENUM_VALUE14 COLOR_SPACESHIP_BACKGROUND /* black */

Definition at line 66 of file colors_common.h.

## ◆ SPECENUM_VALUE14NAME

#define SPECENUM_VALUE14NAME "spaceship_background"

Definition at line 67 of file colors_common.h.

## ◆ SPECENUM_VALUE15

#define SPECENUM_VALUE15 COLOR_OVERVIEW_UNKNOWN /* Black */

Definition at line 69 of file colors_common.h.

## ◆ SPECENUM_VALUE15NAME

#define SPECENUM_VALUE15NAME "overview_unknown"

Definition at line 70 of file colors_common.h.

## ◆ SPECENUM_VALUE16

#define SPECENUM_VALUE16 COLOR_OVERVIEW_MY_CITY /* white */

Definition at line 71 of file colors_common.h.

## ◆ SPECENUM_VALUE16NAME

#define SPECENUM_VALUE16NAME "overview_mycity"

Definition at line 72 of file colors_common.h.

## ◆ SPECENUM_VALUE17

#define SPECENUM_VALUE17 COLOR_OVERVIEW_ALLIED_CITY

Definition at line 73 of file colors_common.h.

## ◆ SPECENUM_VALUE17NAME

#define SPECENUM_VALUE17NAME "overview_alliedcity"

Definition at line 74 of file colors_common.h.

## ◆ SPECENUM_VALUE18

#define SPECENUM_VALUE18 COLOR_OVERVIEW_ENEMY_CITY /* cyan */

Definition at line 75 of file colors_common.h.

## ◆ SPECENUM_VALUE18NAME

#define SPECENUM_VALUE18NAME "overview_enemycity"

Definition at line 76 of file colors_common.h.

## ◆ SPECENUM_VALUE19

#define SPECENUM_VALUE19 COLOR_OVERVIEW_MY_UNIT /* yellow */

Definition at line 77 of file colors_common.h.

## ◆ SPECENUM_VALUE19NAME

#define SPECENUM_VALUE19NAME "overview_myunit"

Definition at line 78 of file colors_common.h.

## ◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME "mapview_citytext"

Definition at line 40 of file colors_common.h.

## ◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2 COLOR_MAPVIEW_CITYTEXT_DARK /* black */

Definition at line 41 of file colors_common.h.

## ◆ SPECENUM_VALUE20

#define SPECENUM_VALUE20 COLOR_OVERVIEW_ALLIED_UNIT

Definition at line 79 of file colors_common.h.

## ◆ SPECENUM_VALUE20NAME

#define SPECENUM_VALUE20NAME "overview_alliedunit"

Definition at line 80 of file colors_common.h.

## ◆ SPECENUM_VALUE21

#define SPECENUM_VALUE21 COLOR_OVERVIEW_ENEMY_UNIT /* red */

Definition at line 81 of file colors_common.h.

## ◆ SPECENUM_VALUE21NAME

#define SPECENUM_VALUE21NAME "overview_enemyunit"

Definition at line 82 of file colors_common.h.

## ◆ SPECENUM_VALUE22

#define SPECENUM_VALUE22 COLOR_OVERVIEW_OCEAN /* ocean/blue */

Definition at line 83 of file colors_common.h.

## ◆ SPECENUM_VALUE22NAME

#define SPECENUM_VALUE22NAME "overview_ocean"

Definition at line 84 of file colors_common.h.

## ◆ SPECENUM_VALUE23

#define SPECENUM_VALUE23 COLOR_OVERVIEW_LAND /* ground/green */

Definition at line 85 of file colors_common.h.

## ◆ SPECENUM_VALUE23NAME

#define SPECENUM_VALUE23NAME "overview_ground"

Definition at line 86 of file colors_common.h.

## ◆ SPECENUM_VALUE24

#define SPECENUM_VALUE24 COLOR_OVERVIEW_FROZEN /* frozen/grey */

Definition at line 87 of file colors_common.h.

## ◆ SPECENUM_VALUE24NAME

#define SPECENUM_VALUE24NAME "overview_frozen"

Definition at line 88 of file colors_common.h.

## ◆ SPECENUM_VALUE25

#define SPECENUM_VALUE25 COLOR_OVERVIEW_VIEWRECT /* white */

Definition at line 89 of file colors_common.h.

## ◆ SPECENUM_VALUE25NAME

#define SPECENUM_VALUE25NAME "overview_viewrect"

Definition at line 90 of file colors_common.h.

## ◆ SPECENUM_VALUE26

#define SPECENUM_VALUE26 COLOR_REQTREE_RESEARCHING /* cyan */

Definition at line 92 of file colors_common.h.

## ◆ SPECENUM_VALUE26NAME

#define SPECENUM_VALUE26NAME "reqtree_researching"

Definition at line 93 of file colors_common.h.

## ◆ SPECENUM_VALUE27

#define SPECENUM_VALUE27 COLOR_REQTREE_KNOWN /* green */

Definition at line 94 of file colors_common.h.

## ◆ SPECENUM_VALUE27NAME

#define SPECENUM_VALUE27NAME "reqtree_known"

Definition at line 95 of file colors_common.h.

## ◆ SPECENUM_VALUE28

#define SPECENUM_VALUE28 COLOR_REQTREE_GOAL_PREREQS_KNOWN

Definition at line 96 of file colors_common.h.

## ◆ SPECENUM_VALUE28NAME

#define SPECENUM_VALUE28NAME "reqtree_goal_prereqs_known"

Definition at line 97 of file colors_common.h.

## ◆ SPECENUM_VALUE29

#define SPECENUM_VALUE29 COLOR_REQTREE_GOAL_UNKNOWN

Definition at line 98 of file colors_common.h.

## ◆ SPECENUM_VALUE29NAME

#define SPECENUM_VALUE29NAME "reqtree_goal_unknown"

Definition at line 99 of file colors_common.h.

## ◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME "mapview_citytext_dark"

Definition at line 42 of file colors_common.h.

## ◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3 COLOR_MAPVIEW_CITYPROD_NEGATIVE /* red */

Definition at line 43 of file colors_common.h.

## ◆ SPECENUM_VALUE30

#define SPECENUM_VALUE30 COLOR_REQTREE_PREREQS_KNOWN /* yellow */

Definition at line 100 of file colors_common.h.

## ◆ SPECENUM_VALUE30NAME

#define SPECENUM_VALUE30NAME "reqtree_prereqs_known"

Definition at line 101 of file colors_common.h.

## ◆ SPECENUM_VALUE31

#define SPECENUM_VALUE31 COLOR_REQTREE_UNKNOWN /* red */

Definition at line 102 of file colors_common.h.

## ◆ SPECENUM_VALUE31NAME

#define SPECENUM_VALUE31NAME "reqtree_unknown"

Definition at line 103 of file colors_common.h.

## ◆ SPECENUM_VALUE32

#define SPECENUM_VALUE32 COLOR_REQTREE_UNREACHABLE

Definition at line 104 of file colors_common.h.

## ◆ SPECENUM_VALUE32NAME

#define SPECENUM_VALUE32NAME "reqtree_unreachable"

Definition at line 105 of file colors_common.h.

## ◆ SPECENUM_VALUE33

#define SPECENUM_VALUE33 COLOR_REQTREE_NOT_GETTABLE

Definition at line 106 of file colors_common.h.

## ◆ SPECENUM_VALUE33NAME

#define SPECENUM_VALUE33NAME "reqtree_not_gettable"

Definition at line 107 of file colors_common.h.

## ◆ SPECENUM_VALUE34

#define SPECENUM_VALUE34 COLOR_REQTREE_GOAL_NOT_GETTABLE

Definition at line 108 of file colors_common.h.

## ◆ SPECENUM_VALUE34NAME

#define SPECENUM_VALUE34NAME "reqtree_goal_not_gettable"

Definition at line 109 of file colors_common.h.

## ◆ SPECENUM_VALUE35

#define SPECENUM_VALUE35 COLOR_REQTREE_BACKGROUND /* black */

Definition at line 110 of file colors_common.h.

## ◆ SPECENUM_VALUE35NAME

#define SPECENUM_VALUE35NAME "reqtree_background"

Definition at line 111 of file colors_common.h.

## ◆ SPECENUM_VALUE36

#define SPECENUM_VALUE36 COLOR_REQTREE_TEXT /* black */

Definition at line 112 of file colors_common.h.

## ◆ SPECENUM_VALUE36NAME

#define SPECENUM_VALUE36NAME "reqtree_text"

Definition at line 113 of file colors_common.h.

## ◆ SPECENUM_VALUE37

#define SPECENUM_VALUE37 COLOR_REQTREE_EDGE /* gray */

Definition at line 114 of file colors_common.h.

## ◆ SPECENUM_VALUE37NAME

#define SPECENUM_VALUE37NAME "reqtree_edge"

Definition at line 115 of file colors_common.h.

## ◆ SPECENUM_VALUE38

#define SPECENUM_VALUE38 COLOR_PLAYER_COLOR_BACKGROUND /* black */

Definition at line 117 of file colors_common.h.

## ◆ SPECENUM_VALUE38NAME

#define SPECENUM_VALUE38NAME "playerdlg_background"

Definition at line 118 of file colors_common.h.

## ◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME "mapview_cityprod_negative"

Definition at line 44 of file colors_common.h.

## ◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4 COLOR_MAPVIEW_CITYGROWTH_BLOCKED /* red */

Definition at line 45 of file colors_common.h.

## ◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME "mapview_cityblocked"

Definition at line 46 of file colors_common.h.

## ◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5 COLOR_MAPVIEW_GOTO /* cyan */

Definition at line 47 of file colors_common.h.

## ◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME "mapview_goto"

Definition at line 48 of file colors_common.h.

## ◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6 COLOR_MAPVIEW_SELECTION /* yellow */

Definition at line 49 of file colors_common.h.

## ◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME "mapview_selection"

Definition at line 50 of file colors_common.h.

## ◆ SPECENUM_VALUE7

#define SPECENUM_VALUE7 COLOR_MAPVIEW_TRADE_ROUTE_LINE

Definition at line 51 of file colors_common.h.

## ◆ SPECENUM_VALUE7NAME

#define SPECENUM_VALUE7NAME "mapview_trade_route_line"

Definition at line 52 of file colors_common.h.

## ◆ SPECENUM_VALUE8

#define SPECENUM_VALUE8 COLOR_MAPVIEW_TRADE_ROUTES_ALL_BUILT /* green */

Definition at line 53 of file colors_common.h.

## ◆ SPECENUM_VALUE8NAME

#define SPECENUM_VALUE8NAME "mapview_trade_routes_all_built"

Definition at line 54 of file colors_common.h.

## ◆ SPECENUM_VALUE9

#define SPECENUM_VALUE9 COLOR_MAPVIEW_TRADE_ROUTES_SOME_BUILT /* yellow */

Definition at line 55 of file colors_common.h.

## ◆ SPECENUM_VALUE9NAME

#define SPECENUM_VALUE9NAME "mapview_trade_routes_some_built"

Definition at line 56 of file colors_common.h.

## Function Documentation

## ◆ color_best_contrast()

struct color * color_best_contrast | ( | struct color * | subject,
|  | struct color ** | candidates,
|  | int | ncandidates
| ) |  |

Find the colour from 'candidates' with the best perceptual contrast from 'subject'.

Definition at line 150 of file colors_common.c.

Referenced by diplo_wdg::diplo_wdg(), and show_full_citybar().

## ◆ color_system_free()

void color_system_free | ( | struct color_system * | colors | ) |

Called when the client first starts to free any allocated colors.

Definition at line 70 of file colors_common.c.

Referenced by tileset_free_toplevel().

## ◆ color_system_read()

struct color_system * color_system_read | ( | struct section_file * | file | ) |

Called when the client first starts to allocate the default colors.

Currently this must be called in ui_main, generally after UI initialization.

Definition at line 44 of file colors_common.c.

Referenced by tileset_read_toplevel().

## ◆ ensure_color()

struct color * ensure_color | ( | struct rgbcolor * | rgb | ) |

Return the RGB color, allocating it if necessary.

Definition at line 87 of file colors_common.c.

Referenced by get_color(), get_player_color(), get_terrain_color(), and tileset_background_init().

## ◆ get_color()

struct color * get_color | ( | const struct tileset * | t,
|  | enum color_std | stdcolor
| ) |  |

Return a pointer to the given "standard" color.

Definition at line 100 of file colors_common.c.

Referenced by apply_tags(), apply_text_tag(), calculate_overview_dimensions(), city_dialog_redraw_map(), create_player_icon(), create_tech_tree(), diplo_wdg::diplo_wdg(), draw_calculated_trade_routes(), draw_reqtree(), draw_segment(), draw_selection_rectangle(), draw_trade_route_line(), get_game_color(), link_mark_color(), map_canvas_resized(), overview_tile_color(), put_spaceship(), redraw_overview(), setup_canvas_color_for_state(), show_full_citybar(), show_small_citybar(), show_tile_label(), and update_map_canvas().

## ◆ get_player_color()

struct color * get_player_color | ( | const struct tileset * | t,
|  | const struct player * | pplayer
| ) |  |

Return the color of the player. In pregame, callers should check player_has_color() before calling this.

Definition at line 125 of file colors_common.c.

Referenced by create_player_icon(), plr_item::data(), diplo_wdg::diplo_wdg(), overview_tile_color(), popup_find_dialog(), show_full_citybar(), tileset_player_init(), update_goto_dialog(), and fc_client::update_start_page().

## ◆ get_terrain_color()

struct color * get_terrain_color | ( | const struct tileset * | t,
|  | const struct terrain * | pterrain
| ) |  |

Return a pointer to the given "terrain" color.

Definition at line 137 of file colors_common.c.

Referenced by overview_tile_color().

## ◆ player_has_color()

bool player_has_color | ( | const struct player * | pplayer | ) |

Return whether the player has a color assigned yet. Should only be FALSE in pregame.

Definition at line 113 of file colors_common.c.

Referenced by create_player_icon(), tileset_player_init(), and fc_client::update_start_page().