29 const auto edge_name =
30 std::array{QStringLiteral(
"ns"), QStringLiteral(
"we"),
31 QStringLiteral(
"ud"), QStringLiteral(
"lr")};
45 auto name = QStringLiteral(
"grid.main.%1").arg(edge_name[i]);
48 name = QStringLiteral(
"grid.city.%1").arg(edge_name[i]);
51 name = QStringLiteral(
"grid.worked.%1").arg(edge_name[i]);
54 name = QStringLiteral(
"grid.selected.%1").arg(edge_name[i]);
57 for (be = 0; be < 2; be++) {
58 name = QStringLiteral(
"grid.borders.%1").arg(edge_name[i][be]);
79 for (
int j = 0; j < 2; j++) {
94 for (
auto &edge :
m_borders.at(player_id)) {
95 for (
auto &pix : edge) {
104 std::vector<drawn_sprite>
107 const unit *punit)
const
121 std::vector<drawn_sprite> sprs;
128 int dummy_x, dummy_y;
134 if (
tile && !citymode) {
138 int radius =
game.
info.init_city_radius_sq
141 nullptr,
nullptr, utile,
nullptr,
nullptr,
142 nullptr,
nullptr,
nullptr, EFT_CITY_RADIUS_SQ);
182 }
else if (known[0] || known[1]) {
197 && known[0] && known[1]) {
201 if (owner0 != owner1) {
214 }
else if (
nullptr != ptile
QPixmap crop_sprite(const QPixmap *sprite)
Helper function to crop a sprite.
bool city_base_to_city_map(int *city_map_x, int *city_map_y, const struct city *const pcity, const struct tile *map_tile)
Finds the city map coordinate for a given map position and a city.
bool city_tile_to_city_map(int *city_map_x, int *city_map_y, const int city_radius_sq, const struct tile *city_center, const struct tile *map_tile)
Finds the city map coordinate for a given map position and a city center.
struct city * is_any_city_dialog_open()
void load_sprites() override
Loads all sprites that do not depend on the ruleset.
std::array< QPixmap *, EDGE_COUNT > m_selected
void initialize_player(const player *player) override
Initializes border data for a player.
std::array< std::array< unique_edge_data, EDGE_COUNT >, MAX_NUM_PLAYER_SLOTS > m_borders
Indices: [player][edge][in/out].
void free_player(int player_id) override
Frees border data for a player.
std::array< edge_data, EDGE_COUNT > m_basic_borders
std::vector< drawn_sprite > fill_sprite_array(const tile *ptile, const tile_edge *pedge, const tile_corner *pcorner, const unit *punit) const override
Fill in the grid sprites for the given tile, city, and unit.
std::array< QPixmap *, EDGE_COUNT > m_main
std::array< QPixmap *, EDGE_COUNT > m_worked
std::array< QPixmap *, EDGE_COUNT > m_city
layer_grid(struct tileset *ts, mapview_layer layer)
A layer when drawing the map.
mapview_layer type() const
QPixmap * load_sprite(const QStringList &possible_names, bool required=false, bool verbose=true) const
Shortcut to load a sprite from the tileset.
struct tileset * tileset() const
struct player * client_player()
Either controlling or observing.
enum known_type client_tile_get_known(const struct tile *ptile)
A tile's "known" field is used by the server to store whether each player knows the tile.
bool client_city_can_work_tile(const struct city *pcity, const struct tile *ptile)
Returns TRUE when a tile is available to be worked, or the city itself is currently working the tile ...
bool player_has_color(const struct tileset *t, const struct player *pplayer)
Return whether the player has a color assigned yet.
QColor get_player_color(const struct tileset *t, const struct player *pplayer)
Return the color of the player.
std::vector< unit * > & get_units_in_focus()
Returns list of units currently in focus.
int get_target_bonus_effects(struct effect_list *plist, const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, enum effect_type effect_type, enum vision_layer vision_layer, enum national_intelligence nintel)
Returns the effect bonus of a given type for any target.
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
This tile is native to unit.
client_options * gui_options
bool player_in_city_map(const struct player *pplayer, const struct tile *ptile)
Return true iff x,y is inside any of the player's city map.
int player_index(const struct player *pplayer)
Return the player index.
struct packet_game_info info
const struct tile * tile[NUM_EDGE_TILES]
#define tile_worked(_tile)
#define tile_owner(_tile)
int tileset_hex_width(const struct tileset *t)
Return the hex_width of the current tileset.
bool unit_drawn_with_city_outline(const struct unit *punit, bool check_focus)
Indicate whether a unit is to be drawn with a surrounding city outline under current conditions.
bool tileset_is_isometric(const struct tileset *t)
Return whether the current tileset is isometric.
int tileset_tile_height(const struct tileset *t)
Return the tile height of the current tileset.
int tileset_hex_height(const struct tileset *t)
Return the hex_height of the current tileset.
int tileset_tile_width(const struct tileset *t)
Return the tile width of the current tileset.
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
bool mapdeco_is_highlight_set(const struct tile *ptile)
Return TRUE if the given tile is highlighted.