Skip to content

Commit

Permalink
Format code tree for clang-format-18
Browse files Browse the repository at this point in the history
  • Loading branch information
jwrober committed Dec 12, 2024
1 parent 688e583 commit 5de5379
Show file tree
Hide file tree
Showing 35 changed files with 207 additions and 181 deletions.
2 changes: 1 addition & 1 deletion ai/default/daimilitary.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
to finish him off. */
#define FINISH_HIM_CITY_COUNT 5

typedef struct unit_list *(player_unit_list_getter)(struct player *pplayer);
typedef struct unit_list *(player_unit_list_getter) (struct player *pplayer);

struct unit_type *dai_choose_defender_versus(struct city *pcity,
struct unit *attacker);
Expand Down
3 changes: 1 addition & 2 deletions ai/tex/texai.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ bool fc_ai_tex_setup(struct ai_type *ai)

qstrncpy(ai->name, "tex", sizeof(ai->name));

ai->private = new struct dai_private_data {
};
ai->private = new struct dai_private_data {};
ai->private->contemplace_workers =
false; /* We use custom code to set worker want and type */

Expand Down
3 changes: 1 addition & 2 deletions ai/tex/texaicity.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,7 @@ void texai_req_worker_task_rcv(struct texai_req *req)
**************************************************************************/
void texai_city_alloc(struct ai_type *ait, struct city *pcity)
{
struct texai_city *city_data = new struct texai_city {
};
struct texai_city *city_data = new struct texai_city {};

city_data->defai.building_wait = BUILDING_WAIT_MINIMUM;
adv_init_choice(&(city_data->defai.choice));
Expand Down
3 changes: 1 addition & 2 deletions ai/threaded/threadedai.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,7 @@ bool fc_ai_threaded_setup(struct ai_type *ai)

qstrncpy(ai->name, "threaded", sizeof(ai->name));

ai->private = new struct dai_private_data {
};
ai->private = new struct dai_private_data {};
ai->private->contemplace_workers = true;

tai_init_self(ai);
Expand Down
12 changes: 7 additions & 5 deletions client/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,13 @@ struct option {

#define OPTION_INIT(optset, spec_type, spec_table_var, common_table, \
spec_table, changed_cb, cb_data) \
{ \
.poptset = optset, .type = spec_type, .common_vtable = &common_table, \
.spec_table_var = &spec_table, .changed_callback = changed_cb, \
.callback_data = cb_data, .gui_data = nullptr \
}
{.poptset = optset, \
.type = spec_type, \
.common_vtable = &common_table, \
.spec_table_var = &spec_table, \
.changed_callback = changed_cb, \
.callback_data = cb_data, \
.gui_data = nullptr}
#define OPTION_BOOL_INIT(optset, common_table, bool_table, changed_cb) \
OPTION_INIT(optset, OT_BOOLEAN, bool_vtable, common_table, bool_table, \
changed_cb, 0)
Expand Down
4 changes: 2 additions & 2 deletions client/views/view_map_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, const tile *ptile)
* backing store we need to draw it in case the canvas is resized.
*/
return (*canvas_x > -tileset_tile_width(tileset)
&& *canvas_x<mapview.store_width
&& * canvas_y> - tileset_tile_height(tileset)
&& *canvas_x < mapview.store_width
&& *canvas_y > -tileset_tile_height(tileset)
&& *canvas_y < (mapview.store_height
+ (tileset_full_tile_height(tileset)
- tileset_tile_height(tileset))));
Expand Down
2 changes: 1 addition & 1 deletion common/aicore/path_finding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ struct pf_danger_node {
signed short cost; // See comment above.
unsigned extra_cost; // See comment above.
signed dir_to_here : 4; // See comment above.
} * danger_segment;
} *danger_segment;
};

// Derived structure of struct pf_map.
Expand Down
2 changes: 1 addition & 1 deletion common/clientutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void calc_activity(struct actcalc *calc, const struct tile *ptile)
int rmextra_units[MAX_EXTRA_TYPES][ACTIVITY_LAST];
int activity_total[ACTIVITY_LAST];
int activity_units[ACTIVITY_LAST];
} * t;
} *t;

t = new tmp_state[1]();
memset(calc, 0, sizeof(*calc));
Expand Down
4 changes: 1 addition & 3 deletions common/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ static const char *event_sections[] = {
N_("Vote: %s"), N_("Wonder: %s"), nullptr};

#define GEN_EV(event, section, descr) \
{ \
#event, nullptr, section, descr, nullptr, event \
}
{#event, nullptr, section, descr, nullptr, event}

/*
* Holds information about all event types. The entries don't have
Expand Down
7 changes: 2 additions & 5 deletions common/featured_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
// Offset type (in bytes).
typedef int ft_offset_t;
// Unset offset value.
#define FT_OFFSET_UNSET ((ft_offset_t) -1)
#define FT_OFFSET_UNSET ((ft_offset_t) - 1)

// Opaque type.
struct text_tag;
Expand Down Expand Up @@ -135,10 +135,7 @@ struct ft_color {
const char *foreground;
const char *background;
};
#define FT_COLOR(fg, bg) \
{ \
fg, bg \
}
#define FT_COLOR(fg, bg) {fg, bg}
/**************************************************************************
Constructor.
**************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion common/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ extern struct world wld;
#define GAME_DEFAULT_SCORETURN 20

#define GAME_DEFAULT_VICTORY_CONDITIONS \
((victory_condition_type)(1 << VC_SPACERACE | 1 << VC_ALLIED))
((victory_condition_type) (1 << VC_SPACERACE | 1 << VC_ALLIED))
#define GAME_DEFAULT_END_SPACESHIP true

#define GAME_DEFAULT_SPACESHIP_TRAVEL_TIME 100
Expand Down
2 changes: 1 addition & 1 deletion common/helpdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4203,7 +4203,7 @@ void helptext_government(char *buf, size_t bufsz, struct player *pplayer,
ratio);
}
} // else this effect somehow has no effect; keep quiet
} // else there was some extra condition making it complicated
} // else there was some extra condition making it complicated
break;
case EFT_UNIT_UPKEEP_FREE_PER_CITY:
if (!unittype) {
Expand Down
10 changes: 5 additions & 5 deletions common/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool map_startpos_remove(struct tile *ptile);
#endif // FREECIV_DEBUG

#define native_pos_to_index_nocheck(nat_x, nat_y) \
((nat_x) + (nat_y) *wld.map.xsize)
((nat_x) + (nat_y) * wld.map.xsize)
#define native_pos_to_index(nat_x, nat_y) \
(CHECK_NATIVE_POS((nat_x), (nat_y)), \
native_pos_to_index_nocheck(nat_x, nat_y))
Expand All @@ -116,14 +116,14 @@ bool map_startpos_remove(struct tile *ptile);

/* Obscure math. See explanation in doc/HACKING. */
#define NATIVE_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y) \
(MAP_IS_ISOMETRIC ? (*(pmap_x) = ((nat_y) + ((nat_y) &1)) / 2 + (nat_x), \
(MAP_IS_ISOMETRIC ? (*(pmap_x) = ((nat_y) + ((nat_y) & 1)) / 2 + (nat_x), \
*(pmap_y) = (nat_y) - *(pmap_x) + wld.map.xsize) \
: (*(pmap_x) = (nat_x), *(pmap_y) = (nat_y)))

#define MAP_TO_NATIVE_POS(pnat_x, pnat_y, map_x, map_y) \
(MAP_IS_ISOMETRIC \
? (*(pnat_y) = (map_x) + (map_y) -wld.map.xsize, \
*(pnat_x) = (2 * (map_x) - *(pnat_y) - (*(pnat_y) &1)) / 2) \
? (*(pnat_y) = (map_x) + (map_y) - wld.map.xsize, \
*(pnat_x) = (2 * (map_x) - *(pnat_y) - (*(pnat_y) & 1)) / 2) \
: (*(pnat_x) = (map_x), *(pnat_y) = (map_y)))

#define NATURAL_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y) \
Expand All @@ -132,7 +132,7 @@ bool map_startpos_remove(struct tile *ptile);
: (*(pmap_x) = (nat_x), *(pmap_y) = (nat_y)))

#define MAP_TO_NATURAL_POS(pnat_x, pnat_y, map_x, map_y) \
(MAP_IS_ISOMETRIC ? (*(pnat_y) = (map_x) + (map_y) -wld.map.xsize, \
(MAP_IS_ISOMETRIC ? (*(pnat_y) = (map_x) + (map_y) - wld.map.xsize, \
*(pnat_x) = 2 * (map_x) - *(pnat_y)) \
: (*(pnat_x) = (map_x), *(pnat_y) = (map_y)))

Expand Down
5 changes: 1 addition & 4 deletions common/name_translation.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ struct name_translation {
};

// Inititalization macro.
#define NAME_INIT \
{ \
nullptr, "\0", "\0" \
}
#define NAME_INIT {nullptr, "\0", "\0"}

/****************************************************************************
Initializes a name translation structure.
Expand Down
2 changes: 1 addition & 1 deletion common/path_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ path_finder::path_finder(const unit *unit)
*/
path_finder::path_finder(const unit *unit, const path::step &init)
: m_d(std::make_unique<path_finder_private>(
unit, detail::vertex{init, nullptr}))
unit, detail::vertex{init, nullptr}))
{
}

Expand Down
7 changes: 4 additions & 3 deletions common/requirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3171,9 +3171,10 @@ bool is_req_active(
req->source.value.building);
break;
case VUT_IMPR_GENUS:
eval = (target_building ? BOOL_TO_TRISTATE(
target_building->genus == req->source.value.impr_genus)
: TRI_MAYBE);
eval =
(target_building ? BOOL_TO_TRISTATE(target_building->genus
== req->source.value.impr_genus)
: TRI_MAYBE);
break;
case VUT_EXTRA:
eval = is_extra_type_in_range(target_tile, target_city, req->range,
Expand Down
2 changes: 1 addition & 1 deletion common/server_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ received a copy of the GNU General Public License along with Freeciv21.
#include "fc_types.h"

// Special value to signal the absence of a server setting.
#define SERVER_SETTING_NONE ((server_setting_id) -1)
#define SERVER_SETTING_NONE ((server_setting_id) - 1)

// Pure server settings.
server_setting_id server_setting_by_name(const char *name);
Expand Down
4 changes: 1 addition & 3 deletions common/vision.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ struct vision {

// Initialize a vision radius array.
#define V_RADIUS(main_sq, invis_sq, subs_sq) \
{ \
(short) (main_sq), (short) (invis_sq), (short) (subs_sq) \
}
{(short) (main_sq), (short) (invis_sq), (short) (subs_sq)}

#define ASSERT_VISION(v) \
do { \
Expand Down
2 changes: 1 addition & 1 deletion server/advisors/autosettlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ adv_want settler_evaluate_improvements(struct unit *punit,
}
extra_type_iterate_end;
} // endif: can we arrive sooner than current worker, if any?
} // endif: are we travelling to a legal destination?
} // endif: are we travelling to a legal destination?
}
city_tile_iterate_index_end;
}
Expand Down
2 changes: 1 addition & 1 deletion server/aiiface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool load_ai_module(const char *modname)
struct ai_type *ai = ai_type_alloc();
bool setup_success;
lt_dlhandle handle;
bool (*setup_func)(struct ai_type * ai);
bool (*setup_func)(struct ai_type *ai);
const char *(*capstr_func)(void);
const char *capstr;
char buffer[2048];
Expand Down
6 changes: 2 additions & 4 deletions server/diplomats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,8 @@ bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat,
struct city *pcity, const struct action *paction)
{
struct player *cplayer;
struct packet_unit_short_info unit_packet {
};
struct packet_city_info city_packet {
};
struct packet_unit_short_info unit_packet {};
struct packet_city_info city_packet {};
struct traderoute_packet_list *routes;

// Fetch target city's player. Sanity checks.
Expand Down
2 changes: 1 addition & 1 deletion server/savegame/savecompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int current_compat_ver() { return compat[compat_current].version; }
*/
char bin2ascii_hex(int value, int halfbyte_wanted)
{
return hex_chars[((value) >> ((halfbyte_wanted) *4)) & 0xf];
return hex_chars[((value) >> ((halfbyte_wanted) * 4)) & 0xf];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ void calc_civ_score(struct player *pplayer)
}
unit_list_iterate_end

improvement_iterate(i)
improvement_iterate(i)
{
if (is_great_wonder(i) && (wonder_city = city_from_great_wonder(i))
&& player_owns_city(pplayer, wonder_city)) {
Expand Down
Loading

0 comments on commit 5de5379

Please sign in to comment.