File: colors_common.h

package info (click to toggle)
freeciv 2.6.2-1~bpo10+1
  • links: PTS, VCS
  • area: main
  • in suites: buster-backports
  • size: 212,500 kB
  • sloc: ansic: 443,831; cpp: 29,541; sh: 7,982; makefile: 7,886; python: 1,933; xml: 945
file content (142 lines) | stat: -rw-r--r-- 6,728 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/********************************************************************** 
 Freeciv - Copyright (C) 2005 - The Freeciv Project
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifndef FC__COLORS_COMMON_H
#define FC__COLORS_COMMON_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* utility */
#include "registry.h"

/* common */
#include "fc_types.h"

/* The color system is designed on the assumption that almost, but
 * not quite, all displays will be truecolor. */

struct color;
struct color_system;
struct tileset;
struct rgbcolor;

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

#define SPECENUM_COUNT    COLOR_LAST
#include "specenum_gen.h"

struct color *get_color(const struct tileset *t, enum color_std stdcolor);
bool player_has_color(const struct tileset *t,
                      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);

/* Functions used by the tileset to allocate the color system. */
struct color_system *color_system_read(struct section_file *file);
void color_system_free(struct color_system *colors);

/* Utilities for color values */
struct color *color_best_contrast(struct color *subject,
                                  struct color **candidates, int ncandidates);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* FC__COLORS_COMMON_H */