Skip to content

Commit

Permalink
Allow reopening investigated cities
Browse files Browse the repository at this point in the history
The client was already remembering information about investigated cities, but
there was no way of seeing it once out of the city screen. Allow reopening the
city screen by clicking on the city.

Closes #2059.
  • Loading branch information
lmoureaux committed Nov 23, 2023
1 parent 6b2149f commit 070a5bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,7 @@ void control_mouse_cursor(struct tile *ptile)
if (nullptr != punit && unit_owner(punit) == client_player()) {
// Set mouse cursor to select a unit.
mouse_cursor_type = CURSOR_SELECT;
} else if (nullptr != pcity
&& can_player_see_city_internals(client.conn.playing,
pcity)) {
} else if (nullptr != pcity && pcity->client.full) {
// Set mouse cursor to select a city.
mouse_cursor_type = CURSOR_SELECT;
} else {
Expand Down Expand Up @@ -2544,8 +2542,7 @@ void do_map_click(struct tile *ptile, enum quickselect_type qtype)
unit_focus_set_and_select(qunit);
maybe_goto = gui_options->keyboardless_goto;
}
} else if (nullptr != pcity
&& can_player_see_city_internals(client.conn.playing, pcity)) {
} else if (nullptr != pcity && pcity->client.full) {
// Otherwise use popups.
popup_city_dialog(pcity);
} else if (!near_pcity && unit_list_size(ptile->units) == 0
Expand Down
3 changes: 3 additions & 0 deletions client/packhand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ void handle_city_info(const struct packet_city_info *packet)
|| (gui_options->draw_city_trade_routes && trade_routes_changed);
}

pcity->client.full = true;
sz_strlcpy(pcity->name, packet->name);

// check data
Expand Down Expand Up @@ -1155,6 +1156,8 @@ void handle_city_short_info(const struct packet_city_short_info *packet)
memset(pcity->specialists, 0, sizeof(pcity->specialists));
}

pcity->client.full = false;

pcity->specialists[DEFAULT_SPECIALIST] = packet->size;
city_size_set(pcity, packet->size);

Expand Down
1 change: 1 addition & 0 deletions common/city.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ struct city {

struct {
/* Only used at the client (the server is omniscient; ./client/). */
bool full; // Did we get a full city info packet (owner or investigate)
bool occupied;
int walls;
bool happy;
Expand Down

0 comments on commit 070a5bd

Please sign in to comment.