From aaefc67b94e1ad97e8dd0f46da010394fb8cce6d Mon Sep 17 00:00:00 2001 From: Pranav Date: Sun, 10 Jul 2022 22:28:43 +0200 Subject: [PATCH] Remove unnecessary macros and fix documentation --- ai/default/daicity.h | 2 -- client/cityrep.h | 2 -- client/climisc.h | 1 - client/mapview_common.h | 1 - client/options.h | 2 -- common/clientutils.cpp | 3 --- common/extras.h | 1 - common/game.h | 4 ---- common/map.h | 17 ----------------- common/requirements.h | 13 ------------- 10 files changed, 46 deletions(-) diff --git a/ai/default/daicity.h b/ai/default/daicity.h index dc72483fa9..e65409fe83 100644 --- a/ai/default/daicity.h +++ b/ai/default/daicity.h @@ -22,8 +22,6 @@ struct adv_data; struct tech_vector; -// defined and only used within aicity.c - // Who's coming to kill us, for attack co-ordination struct ai_invasion { int attack; // Units capable of attacking city diff --git a/client/cityrep.h b/client/cityrep.h index 29a854145c..1b3053d168 100644 --- a/client/cityrep.h +++ b/client/cityrep.h @@ -20,9 +20,7 @@ #include "cityrepdata.h" #include "climisc.h" -#define NEG_VAL(x) ((x) < 0 ? (x) : (-x)) #define CMA_NONE (10000) -#define CMA_CUSTOM (10001) class QHBoxLayout; class QItemSelection; diff --git a/client/climisc.h b/client/climisc.h index 5871b5c88e..1ae2964b3c 100644 --- a/client/climisc.h +++ b/client/climisc.h @@ -56,7 +56,6 @@ cid cid_encode_building(const struct impr_type *pimprove); cid cid_encode_from_city(const struct city *pcity); struct universal cid_decode(cid cid); -#define cid_production cid_decode bool city_unit_supported(const struct city *pcity, const struct universal *target); diff --git a/client/mapview_common.h b/client/mapview_common.h index 860cef7e00..34d60f51b4 100644 --- a/client/mapview_common.h +++ b/client/mapview_common.h @@ -46,7 +46,6 @@ extern struct view mapview; * reenabled afterwards. */ extern bool can_slide; -#define BORDER_WIDTH 2 #define GOTO_WIDTH 2 /* diff --git a/client/options.h b/client/options.h index c3939a8041..4311080d48 100644 --- a/client/options.h +++ b/client/options.h @@ -201,7 +201,6 @@ extern const struct option_set *server_optset; struct option *optset_option_by_number(const struct option_set *poptset, int id); -#define optset_option_by_index optset_option_by_number struct option *optset_option_by_name(const struct option_set *poptset, const char *name); struct option *optset_option_first(const struct option_set *poptset); @@ -212,7 +211,6 @@ const char *optset_category_name(const struct option_set *poptset, // Common option functions. const struct option_set *option_optset(const struct option *poption); int option_number(const struct option *poption); -#define option_index option_number const char *option_name(const struct option *poption); const char *option_description(const struct option *poption); QString option_help_text(const struct option *poption); diff --git a/common/clientutils.cpp b/common/clientutils.cpp index 0666ee0d73..31d833b15c 100644 --- a/common/clientutils.cpp +++ b/common/clientutils.cpp @@ -35,9 +35,6 @@ struct actcalc { /** Calculate completion time for all unit activities on tile. - If pmodunit is supplied, take into account the effect if it changed to - doing new_act on new_tgt instead of whatever it's currently doing (if - anything). */ static void calc_activity(struct actcalc *calc, const struct tile *ptile, Activity_type_id new_act) diff --git a/common/extras.h b/common/extras.h index d1868e1a91..641c25ad67 100644 --- a/common/extras.h +++ b/common/extras.h @@ -170,7 +170,6 @@ struct extra_type *extra_type_by_translated_name(const char *name); #define extra_base_get(_e_) (_e_)->data.base #define extra_road_get(_e_) (_e_)->data.road -#define extra_resource_get(_e_) (_e_)->data.resource void extra_to_caused_by_list(struct extra_type *pextra, enum extra_cause cause); diff --git a/common/game.h b/common/game.h index f638f085ec..2f3c9ed012 100644 --- a/common/game.h +++ b/common/game.h @@ -763,10 +763,6 @@ extern struct world wld; #define RS_MIN_CITY_CENTER_OUTPUT 0 #define RS_MAX_CITY_CENTER_OUTPUT RS_MAX_VALUE -#define RS_DEFAULT_CITIES_MIN_DIST 2 -#define RS_MIN_CITIES_MIN_DIST 1 -#define RS_MAX_CITIES_MIN_DIST RS_MAX_VALUE - // the constants CITY_MAP_*_RADIUS are defined in city.c #define RS_DEFAULT_CITY_RADIUS_SQ CITY_MAP_DEFAULT_RADIUS_SQ #define RS_MIN_CITY_RADIUS_SQ CITY_MAP_MIN_RADIUS_SQ diff --git a/common/map.h b/common/map.h index ce13258367..8ebbc6feb4 100644 --- a/common/map.h +++ b/common/map.h @@ -136,21 +136,6 @@ bool map_startpos_remove(struct tile *ptile); *(pnat_x) = 2 * (map_x) - *(pnat_y)) \ : (*(pnat_x) = (map_x), *(pnat_y) = (map_y))) -/* Provide a block to convert from map to native coordinates. This allows - * you to use a native version of the map position within the block. Note - * that the native position is declared as const and can't be changed - * inside the block. */ -#define do_in_native_pos(nat_x, nat_y, map_x, map_y) \ - { \ - int _nat_x, _nat_y; \ - MAP_TO_NATIVE_POS(&_nat_x, &_nat_y, map_x, map_y); \ - { \ - const int nat_x = _nat_x, nat_y = _nat_y; - -#define do_in_native_pos_end \ - } \ - } - /* Provide a block to convert from map to natural coordinates. This allows * you to use a natural version of the map position within the block. Note * that the natural position is declared as const and can't be changed @@ -167,8 +152,6 @@ bool map_startpos_remove(struct tile *ptile); } // Width and height of the map, in native coordinates. -#define NATIVE_WIDTH wld.map.xsize -#define NATIVE_HEIGHT wld.map.ysize // Width and height of the map, in natural coordinates. #define NATURAL_WIDTH (MAP_IS_ISOMETRIC ? 2 * wld.map.xsize : wld.map.xsize) diff --git a/common/requirements.h b/common/requirements.h index 912d0d4cfa..83758e6957 100644 --- a/common/requirements.h +++ b/common/requirements.h @@ -305,19 +305,6 @@ bool universal_is_relevant_to_requirement(const struct requirement *req, sv_universal_fulfills_requirements( \ false, (_rqs_), \ (struct universal){.value = {.utype = (_ut_)}, .kind = VUT_UTYPE}) -#define requirement_fulfilled_by_extra(_ex_, _rqs_) \ - sv_universal_fulfills_requirements( \ - false, (_rqs_), \ - (struct universal){.value = {.extra = (_ex_)}, .kind = VUT_EXTRA}) -#define requirement_fulfilled_by_output_type(_o_, _rqs_) \ - sv_universal_fulfills_requirements( \ - false, (_rqs_), \ - (struct universal){.value = {.outputtype = (_o_)}, \ - .kind = VUT_OTYPE}) -#define requirement_fulfilled_by_action(_act_, _rqs_) \ - sv_universal_fulfills_requirements( \ - false, (_rqs_), \ - (struct universal){.value = {.action = (_act_)}, .kind = VUT_ACTION}) #define requirement_needs_improvement(_imp_, _rqs_) \ sv_universal_fulfills_requirements( \