Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/remove stuff11 #1132

Merged
merged 6 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions client/diplodlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
#include "sprite.h"
#include "top_bar.h"

typedef advance *p_advance;
typedef city *p_city;

/**
Constructor for diplomacy widget
*/
Expand Down
39 changes: 0 additions & 39 deletions client/goto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,45 +296,6 @@ void goto_unit_killed(struct unit *punit)
*/
bool goto_is_active() { return !goto_finders.empty(); }

/**
Return the path length (in turns).
WARNING: not useful for determining paths of scattered groups.
*/
bool goto_get_turns(int *min, int *max)
{
fc_assert_ret_val(min != nullptr, false);
fc_assert_ret_val(max != nullptr, false);

*min = FC_INFINITY;
*max = -1;

if (!goto_is_active()) {
return false;
}
if (nullptr == goto_destination) {
// Not a valid position.
return false;
}

if (hover_state == HOVER_CONNECT) {
// FIXME unsupported
} else {
// In other modes, we want to know the turn number to reach the tile.
for (auto &[unit_id, finder] : goto_finders) {
auto destination = hover_state == HOVER_PATROL
? game_unit_by_number(unit_id)->tile
: goto_destination;
auto path = finder.find_path(freeciv::tile_destination(destination));
if (path) {
*min = std::max(*min, path->turns());
*max = std::max(*max, path->turns());
}
}
}

return true;
}

/**
Returns the state of 'ptile': turn number to print, and whether 'ptile'
is a waypoint.
Expand Down
3 changes: 0 additions & 3 deletions client/goto.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void exit_goto_state();
void goto_unit_killed(struct unit *punit);

bool goto_is_active();
bool goto_get_turns(int *min, int *max);
bool goto_tile_state(const struct tile *ptile, enum goto_tile_state *state,
int *turns, bool *waypoint);
bool goto_add_waypoint();
Expand All @@ -45,8 +44,6 @@ bool is_valid_goto_destination(const struct tile *ptile);
bool is_valid_goto_draw_line(struct tile *dest_tile);

void request_orders_cleared(struct unit *punit);
void send_goto_path(struct unit *punit, PFPath *path,
struct unit_order *last_order);
void send_rally_path(city *pcity, unit *punit, const PFPath &path,
unit_order *final_order);
bool send_goto_tile(struct unit *punit, struct tile *ptile);
Expand Down
8 changes: 0 additions & 8 deletions client/gui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const char *const gui_character_encoding = "UTF-8";
const char *client_string = "gui-qt";
static fc_client *freeciv_qt;

void reset_unit_table();
static void apply_help_font(struct option *poption);
static void apply_notify_font(struct option *poption);
static void apply_titlebar(struct option *poption);
Expand Down Expand Up @@ -356,13 +355,6 @@ void gui_update_allfonts()
gui_options.gui_qt_increase_fonts = 0;
}

/**
Called when the tileset is changed to reset the unit pixmap table.
*/
void reset_unit_table()
{ // FIXME
}

/**
Open dialog to confirm that user wants to quit client.
*/
Expand Down
18 changes: 6 additions & 12 deletions common/metaknowledge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,9 @@ static bool can_plr_see_all_sym_diplrels_of(const struct player *pplayer,
static bool is_req_knowable(
const struct player *pow_player, 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 output_type *target_output,
const struct specialist *target_specialist,
const struct tile *target_tile, const struct unit *target_unit,
const struct requirement *req, const enum req_problem_type prob_type)
{
Q_UNUSED(target_output)
Q_UNUSED(target_specialist)
Q_UNUSED(target_building)
fc_assert_ret_val_msg(nullptr != pow_player, false, "No point of view");

if (req->source.kind == VUT_UTFLAG || req->source.kind == VUT_UTYPE
Expand All @@ -181,7 +176,7 @@ static bool is_req_knowable(
return prob_type == RPT_CERTAIN;
}

return target_unit && can_player_see_unit(pow_player, target_unit);
return can_player_see_unit(pow_player, target_unit);
case REQ_RANGE_CADJACENT:
case REQ_RANGE_ADJACENT:
case REQ_RANGE_CONTINENT:
Expand Down Expand Up @@ -214,11 +209,11 @@ static bool is_req_knowable(
case USP_NATIVE_TILE:
case USP_NATIVE_EXTRA:
// Known if the unit is seen by the player.
return target_unit && can_player_see_unit(pow_player, target_unit);
return can_player_see_unit(pow_player, target_unit);
case USP_HAS_HOME_CITY:
case USP_MOVED_THIS_TURN:
// Known to the unit's owner.
return target_unit && unit_owner(target_unit) == pow_player;
return unit_owner(target_unit) == pow_player;
case USP_COUNT:
fc_assert_msg(req->source.value.unit_state != USP_COUNT,
"Invalid unit state property.");
Expand Down Expand Up @@ -286,7 +281,7 @@ static bool is_req_knowable(
return prob_type == RPT_CERTAIN;
}

if (pow_player == target_player || pow_player == other_player) {
if (pow_player == other_player) {
return true;
}

Expand Down Expand Up @@ -642,8 +637,7 @@ enum fc_tristate mke_eval_req(
const struct unit_type *target_unittype;

if (!is_req_knowable(pow_player, target_player, other_player, target_city,
target_building, target_tile, target_unit,
target_output, target_specialist, req, prob_type)) {
target_tile, target_unit, req, prob_type)) {
return TRI_MAYBE;
}

Expand Down
Loading