From afd00e23b51f8ffd41f74fb783a05920c619a135 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 9 Jun 2022 00:54:04 +0300 Subject: [PATCH 13/13] Never compare boolean value to exact value of TRUE or FALSE See osdn #44401 Signed-off-by: Marko Lindqvist --- ai/default/aihand.c | 2 +- ai/default/aiunit.c | 6 +- client/client_main.c | 2 +- client/control.c | 4 +- client/gui-sdl2/graphics.c | 2 +- client/gui-sdl2/widget_scrollbar.c | 2 +- client/tilespec.c | 2 +- common/aicore/caravan.c | 2 +- common/citizens.c | 10 +-- common/effects.c | 2 +- common/fc_interface.c | 2 +- common/server_settings.c | 2 +- server/citizenshand.c | 4 +- server/cityturn.c | 2 +- server/report.c | 2 +- server/rscompat.c | 3 +- server/savegame/savecompat.c | 20 +++--- server/savegame/savegame2.c | 68 +++++++++--------- server/savegame/savegame3.c | 108 ++++++++++++++--------------- server/score.c | 2 +- server/techtools.c | 2 +- utility/ioz.c | 2 +- 22 files changed, 126 insertions(+), 125 deletions(-) diff --git a/ai/default/aihand.c b/ai/default/aihand.c index 62d6a2028d..cf9132fd36 100644 --- a/ai/default/aihand.c +++ b/ai/default/aihand.c @@ -651,7 +651,7 @@ static void dai_manage_taxes(struct ai_type *ait, struct player *pplayer) city_list_iterate(pplayer->cities, pcity) { struct cm_result *cmr = cm_result_new(pcity); - if (def_ai_city_data(pcity, ait)->celebrate == TRUE) { + if (def_ai_city_data(pcity, ait)->celebrate) { log_base(LOGLEVEL_TAX, "setting %s to celebrate", city_name_get(pcity)); cm_query_result(pcity, &cmp, cmr, FALSE); if (cmr->found_a_valid) { diff --git a/ai/default/aiunit.c b/ai/default/aiunit.c index f4da1c9053..f35dfcb3d0 100644 --- a/ai/default/aiunit.c +++ b/ai/default/aiunit.c @@ -996,12 +996,12 @@ static void single_invader(struct ai_city *city_data, /**********************************************************************//** Mark invasion possibilities of punit in the surrounding cities. The given radius limites the area which is searched for cities. The - center of the area is either the unit itself (dest == FALSE) or the - destination of the current goto (dest == TRUE). The invasion threat + center of the area is either the unit itself (dest FALSE) or the + destination of the current goto (dest TRUE). The invasion threat is marked in pcity->server.ai.invasion by setting the "which" bit (to tell attack which can only kill units from occupy possibility). - If dest == TRUE then a valid goto is presumed. + If dest is TRUE then a valid goto is presumed. **************************************************************************/ static void invasion_funct(struct ai_type *ait, struct unit *punit, bool dest, int radius, int which) diff --git a/client/client_main.c b/client/client_main.c index 35e68d9491..6358d7c631 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1323,7 +1323,7 @@ bool is_server_busy(void) **************************************************************************/ bool client_is_global_observer(void) { - return client.conn.playing == NULL && client.conn.observer == TRUE; + return client.conn.playing == NULL && client.conn.observer; } /**********************************************************************//** diff --git a/client/control.c b/client/control.c index b3f36e0452..d2a4f9ac4d 100644 --- a/client/control.c +++ b/client/control.c @@ -2672,7 +2672,7 @@ void do_move_unit(struct unit *punit, struct unit *target_unit) && !unit_has_orders(punit) && punit->activity != ACTIVITY_GOTO && punit->activity != ACTIVITY_SENTRY - && ((gui_options.auto_center_on_automated == TRUE + && ((gui_options.auto_center_on_automated && punit->ssa_controller != SSA_NONE) || (punit->ssa_controller == SSA_NONE)) && !tile_visible_and_not_on_border_mapcanvas(dst_tile)) { @@ -2697,7 +2697,7 @@ void do_move_unit(struct unit *punit, struct unit *target_unit) * the tile without the unit (because it was unlinked above). */ refresh_unit_mapcanvas(punit, src_tile, TRUE, FALSE); - if (gui_options.auto_center_on_automated == FALSE + if (!gui_options.auto_center_on_automated && punit->ssa_controller != SSA_NONE) { /* Dont animate automatic units */ } else if (do_animation) { diff --git a/client/gui-sdl2/graphics.c b/client/gui-sdl2/graphics.c index 56f99301d1..176bc9c89d 100644 --- a/client/gui-sdl2/graphics.c +++ b/client/gui-sdl2/graphics.c @@ -1711,7 +1711,7 @@ SDL_Surface *resize_surface_box(const SDL_Surface *psrc, return NULL; } - if (!((scale_up == FALSE) && ((new_width >= psrc->w) && (new_height >= psrc->h)))) { + if (!(!scale_up && ((new_width >= psrc->w) && (new_height >= psrc->h)))) { if ((new_width - psrc->w) <= (new_height - psrc->h)) { /* horizontal limit */ tmp_surface = zoomSurface((SDL_Surface*)psrc, diff --git a/client/gui-sdl2/widget_scrollbar.c b/client/gui-sdl2/widget_scrollbar.c index 9f47b38718..32a5a1c8dd 100644 --- a/client/gui-sdl2/widget_scrollbar.c +++ b/client/gui-sdl2/widget_scrollbar.c @@ -1247,7 +1247,7 @@ bool add_widget_to_vertical_scroll_widget_list(struct advanced_dialog *dlg, if (seen) { if (!dlg->begin_active_widget_list) { /* first element ( active list empty ) */ - fc_assert_msg(FALSE == dir, "Forbided List Operation"); + fc_assert_msg(!dir, "Forbidden List Operation"); new_widget->size.x = start_x; new_widget->size.y = start_y; dlg->begin_active_widget_list = new_widget; diff --git a/client/tilespec.c b/client/tilespec.c index d97c2159d8..7852081aa5 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -5226,7 +5226,7 @@ static int fill_terrain_sprite_layer(struct tileset *t, Indicate whether a unit is to be drawn with a surrounding city outline under current conditions. (This includes being in focus, but if the caller has already checked that, - they can bypass this slightly expensive check with check_focus == FALSE.) + they can bypass this slightly expensive check with check_focus FALSE.) ****************************************************************************/ bool unit_drawn_with_city_outline(const struct unit *punit, bool check_focus) { diff --git a/common/aicore/caravan.c b/common/aicore/caravan.c index 002ad22048..da6c7e3815 100644 --- a/common/aicore/caravan.c +++ b/common/aicore/caravan.c @@ -361,7 +361,7 @@ static double trade_benefit(const struct player *caravan_owner, + one_city_trade_benefit(dest, caravan_owner, countloser, newtrade); } else { /* Always fails. */ - fc_assert_msg(FALSE == param->convert_trade, + fc_assert_msg(!param->convert_trade, "Unimplemented functionality: " "using CM to calculate trade."); return 0; diff --git a/common/citizens.c b/common/citizens.c index ee7f217490..2d83875816 100644 --- a/common/citizens.c +++ b/common/citizens.c @@ -33,7 +33,7 @@ void citizens_init(struct city *pcity) { fc_assert_ret(pcity); - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return; } @@ -74,7 +74,7 @@ void citizens_free(struct city *pcity) citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot) { - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return 0; } @@ -106,7 +106,7 @@ void citizens_nation_add(struct city *pcity, const struct player_slot *pslot, { citizens nationality = citizens_nation_get(pcity, pslot); - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return; } @@ -145,7 +145,7 @@ void citizens_nation_move(struct city *pcity, void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count) { - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return; } @@ -164,7 +164,7 @@ citizens citizens_count(const struct city *pcity) /* Use int here to check for an possible overflow at the end. */ int count = 0; - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return city_size_get(pcity); } diff --git a/common/effects.c b/common/effects.c index f4293cb71f..a73d06217e 100644 --- a/common/effects.c +++ b/common/effects.c @@ -1168,7 +1168,7 @@ void get_effect_req_text(const struct effect *peffect, fc_strlcat(buf, multiplier_name_translation(peffect->multiplier), buf_len); } - /* FIXME: should we do something for present == FALSE reqs? + /* FIXME: should we do something for present FALSE reqs? * Currently we just ignore them. */ requirement_vector_iterate(&peffect->reqs, preq) { if (!preq->present) { diff --git a/common/fc_interface.c b/common/fc_interface.c index 8ddab2c58e..b7e63a2630 100644 --- a/common/fc_interface.c +++ b/common/fc_interface.c @@ -38,7 +38,7 @@ bool fc_funcs_defined = FALSE; /************************************************************************//** Return the function pointer. Only possible before interface_init() was - called (fc_funcs_defined == FALSE). + called (fc_funcs_defined FALSE). ****************************************************************************/ struct functions *fc_interface_funcs(void) { diff --git a/common/server_settings.c b/common/server_settings.c index da23cc47f2..054bec6b5c 100644 --- a/common/server_settings.c +++ b/common/server_settings.c @@ -107,7 +107,7 @@ ssetv ssetv_from_values(server_setting_id setting, int value) { /* Only Boolean and TRUE can be supported unless setting value encoding * is implemented. */ - if (value != TRUE) { + if (!value) { fc_assert(value); return SSETV_NONE; } diff --git a/server/citizenshand.c b/server/citizenshand.c index 26cfb648dc..f3eaa3f432 100644 --- a/server/citizenshand.c +++ b/server/citizenshand.c @@ -57,7 +57,7 @@ void citizens_update(struct city *pcity, struct player *plr) citizens_print(pcity); } - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return; } @@ -147,7 +147,7 @@ void citizens_print(const struct city *pcity) { fc_assert_ret(pcity); - if (game.info.citizen_nationality != TRUE) { + if (!game.info.citizen_nationality) { return; } diff --git a/server/cityturn.c b/server/cityturn.c index c796fe97a9..0d3fcb5270 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3255,7 +3255,7 @@ static void update_city_activity(struct city *pcity) /* Keep old behaviour when building new improvement could keep city celebrating */ - if (is_happy == FALSE) { + if (!is_happy) { is_happy = city_happy(pcity); } diff --git a/server/report.c b/server/report.c index 1e116767e2..0bd100e211 100644 --- a/server/report.c +++ b/server/report.c @@ -1598,7 +1598,7 @@ void report_final_scores(struct conn_list *dest) i = 0; players_iterate(pplayer) { - if (is_barbarian(pplayer) == FALSE) { + if (!is_barbarian(pplayer)) { size[i].value = pplayer->score.game; size[i].player = pplayer; i++; diff --git a/server/rscompat.c b/server/rscompat.c index 5bcf062976..c6b75b7750 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -296,6 +296,7 @@ void rscompat_enablers_add_obligatory_hard_reqs(void) action_iterate(act_id) { bool restart_enablers_for_action; + do { restart_enablers_for_action = FALSE; action_enabler_list_iterate(action_enablers_for_action(act_id), ae) { @@ -311,7 +312,7 @@ void rscompat_enablers_add_obligatory_hard_reqs(void) break; } } action_enabler_list_iterate_end; - } while (restart_enablers_for_action == TRUE); + } while (restart_enablers_for_action); } action_iterate_end; } diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c index 1f72a7277d..6a351c2cd8 100644 --- a/server/savegame/savecompat.c +++ b/server/savegame/savecompat.c @@ -138,7 +138,7 @@ void sg_load_compat(struct loaddata *loading, enum sgf_version format_class) { int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); loading->version = secfile_lookup_int_default(loading->file, -1, @@ -190,7 +190,7 @@ void sg_load_post_load_compat(struct loaddata *loading, { int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); for (i = 0; i < compat_num; i++) { @@ -335,7 +335,7 @@ struct extra_type *resource_by_identifier(const char identifier) static void compat_load_020400(struct loaddata *loading, enum sgf_version format_class) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data from savegame to version 2.4.0"); @@ -590,7 +590,7 @@ static void compat_load_020500(struct loaddata *loading, "Base" }; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data from savegame to version 2.5.0"); @@ -696,7 +696,7 @@ static void compat_load_020600(struct loaddata *loading, int ti; int turn; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data from savegame to version 2.6.0"); @@ -1299,7 +1299,7 @@ static void compat_load_030000(struct loaddata *loading, bool started; int old_turn; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data from savegame to version 3.0.0"); @@ -1486,7 +1486,7 @@ static void insert_server_side_agent(struct loaddata *loading, static void compat_load_030100(struct loaddata *loading, enum sgf_version format_class) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data from savegame to version 3.1.0"); @@ -1786,7 +1786,7 @@ static void upgrade_server_side_agent(struct loaddata *loading) static void compat_post_load_030100(struct loaddata *loading, enum sgf_version format_class) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Action orders were new in 3.0 */ @@ -1877,7 +1877,7 @@ static void compat_load_dev(struct loaddata *loading) { int game_version; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); log_debug("Upgrading data between development revisions"); @@ -2212,7 +2212,7 @@ static void compat_post_load_dev(struct loaddata *loading) { int game_version; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (!secfile_lookup_int(loading->file, &game_version, "scenario.game_version")) { diff --git a/server/savegame/savegame2.c b/server/savegame/savegame2.c index 870b9e4485..60aac57ed7 100644 --- a/server/savegame/savegame2.c +++ b/server/savegame/savegame2.c @@ -1150,7 +1150,7 @@ static void sg_load_savefile(struct loaddata *loading) int i; const char *terr_name; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load savefile options. */ @@ -1497,7 +1497,7 @@ static void sg_load_ruledata(struct loaddata *loading) int i; const char *name; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); for (i = 0; @@ -1523,7 +1523,7 @@ static void sg_load_game(struct loaddata *loading) const char *level; int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load version. */ @@ -1679,7 +1679,7 @@ static void sg_load_game(struct loaddata *loading) ****************************************************************************/ static void sg_load_random(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (secfile_lookup_bool_default(loading->file, FALSE, "random.saved")) { @@ -1738,7 +1738,7 @@ static void sg_load_random(struct loaddata *loading) ****************************************************************************/ static void sg_load_script(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); script_server_state_load(loading->file); @@ -1756,7 +1756,7 @@ static void sg_load_scenario(struct loaddata *loading) const char *buf; bool lake_flood_default; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (NULL == secfile_section_lookup(loading->file, "scenario")) { @@ -1828,7 +1828,7 @@ static void sg_load_scenario(struct loaddata *loading) sg_failure_ret(loading->server_state == S_S_INITIAL || (loading->server_state == S_S_RUNNING - && game.scenario.players == TRUE), + && game.scenario.players), "Invalid scenario definition (server state '%s' and " "players are %s).", server_states_name(loading->server_state), @@ -1848,7 +1848,7 @@ static void sg_load_scenario(struct loaddata *loading) ****************************************************************************/ static void sg_load_settings(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); settings_game_load(loading->file, "settings"); @@ -1868,7 +1868,7 @@ static void sg_load_settings(struct loaddata *loading) ****************************************************************************/ static void sg_load_map(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* This defaults to TRUE even if map has not been generated. Also, @@ -1946,7 +1946,7 @@ static void sg_load_map(struct loaddata *loading) ****************************************************************************/ static void sg_load_map_tiles(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Initialize the map for the current topology. 'map.xsize' and @@ -1986,7 +1986,7 @@ static void sg_load_map_tiles(struct loaddata *loading) ****************************************************************************/ static void sg_load_map_tiles_extras(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load extras. */ @@ -2001,7 +2001,7 @@ static void sg_load_map_tiles_extras(struct loaddata *loading) ****************************************************************************/ static void sg_load_map_tiles_bases(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load bases. */ @@ -2017,7 +2017,7 @@ static void sg_load_map_tiles_bases(struct loaddata *loading) ****************************************************************************/ static void sg_load_map_tiles_roads(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load roads. */ @@ -2034,7 +2034,7 @@ static void sg_load_map_tiles_roads(struct loaddata *loading) static void sg_load_map_tiles_specials(struct loaddata *loading, bool rivers_overlay) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* If 'rivers_overlay' is set to TRUE, load only the rivers overlay map @@ -2064,7 +2064,7 @@ static void sg_load_map_tiles_specials(struct loaddata *loading, ****************************************************************************/ static void sg_load_map_tiles_resources(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); LOAD_MAP_CHAR(ch, ptile, tile_set_resource(ptile, char2resource(ch)), @@ -2100,7 +2100,7 @@ static void sg_load_map_startpos(struct loaddata *loading) bool exclude; int i, startpos_count; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); startpos_count @@ -2183,7 +2183,7 @@ static void sg_load_map_owner(struct loaddata *loading) struct tile *claimer = NULL; struct player *eowner = NULL; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { @@ -2267,7 +2267,7 @@ static void sg_load_map_worked(struct loaddata *loading) { int x, y; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(loading->worked_tiles == NULL, @@ -2309,7 +2309,7 @@ static void sg_load_map_worked(struct loaddata *loading) ****************************************************************************/ static void sg_load_map_known(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); players_iterate(pplayer) { @@ -2377,7 +2377,7 @@ static void sg_load_players_basic(struct loaddata *loading) const char *string; bool shuffle_loaded = TRUE; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (S_S_INITIAL == loading->server_state @@ -2625,7 +2625,7 @@ static void sg_load_players_basic(struct loaddata *loading) ****************************************************************************/ static void sg_load_players(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { @@ -2794,7 +2794,7 @@ static void sg_load_player_main(struct loaddata *loading, const char *barb_str; size_t nval; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Basic player data. */ @@ -3279,7 +3279,7 @@ static void sg_load_player_cities(struct loaddata *loading, int ncities, i, plrno = player_number(plr); bool tasks_handled; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(secfile_lookup_int(loading->file, &ncities, @@ -3698,7 +3698,7 @@ static void sg_load_player_units(struct loaddata *loading, { int nunits, i, plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(secfile_lookup_int(loading->file, &nunits, @@ -4425,7 +4425,7 @@ static void sg_load_player_units_transport(struct loaddata *loading, { int nunits, i, plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Recheck the number of units for the player. This is a copied from @@ -4478,7 +4478,7 @@ static void sg_load_player_attributes(struct loaddata *loading, { int plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Toss any existing attribute_block (should not exist) */ @@ -4564,7 +4564,7 @@ static void sg_load_player_vision(struct loaddata *loading, int i; bool someone_alive = FALSE; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.server.revealmap & REVEAL_MAP_DEAD) { @@ -4583,7 +4583,7 @@ static void sg_load_player_vision(struct loaddata *loading, if (!plr->is_alive || -1 == total_ncities - || FALSE == game.info.fogofwar + || !game.info.fogofwar || !secfile_lookup_bool_default(loading->file, TRUE, "game.save_private_map")) { /* We have: @@ -4884,7 +4884,7 @@ static void sg_load_researches(struct loaddata *loading) const char *string; int i, j; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Initialize all researches. */ @@ -4970,7 +4970,7 @@ static void sg_load_researches(struct loaddata *loading) ****************************************************************************/ static void sg_load_event_cache(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); event_cache_load(loading->file, "event_cache"); @@ -4989,7 +4989,7 @@ static void sg_load_treaties(struct loaddata *loading) const char *plr0; struct treaty_list *treaties = get_all_treaties(); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); for (tidx = 0; (plr0 = secfile_lookup_str_default(loading->file, NULL, @@ -5071,7 +5071,7 @@ static void sg_load_history(struct loaddata *loading) struct history_report *hist = history_report_get(); int turn; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); turn = secfile_lookup_int_default(loading->file, -2, "history.turn"); @@ -5100,7 +5100,7 @@ static void sg_load_mapimg(struct loaddata *loading) { int mapdef_count, i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Clear all defined map images. */ @@ -5144,7 +5144,7 @@ static void sg_load_sanitycheck(struct loaddata *loading) { int players; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c index 96a346469c..1300bed861 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -1238,7 +1238,7 @@ static void sg_load_savefile(struct loaddata *loading) bool ruleset_datafile; bool current_ruleset_rejected; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load savefile options. */ @@ -1639,7 +1639,7 @@ static void sg_save_savefile(struct savedata *saving) { int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Save savefile options. */ @@ -1918,7 +1918,7 @@ static void sg_save_savefile(struct savedata *saving) static void sg_save_savefile_options(struct savedata *saving, const char *option) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (option == NULL) { @@ -1943,7 +1943,7 @@ static void sg_load_ruledata(struct loaddata *loading) int i; const char *name; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); for (i = 0; @@ -1968,7 +1968,7 @@ static void sg_load_game(struct loaddata *loading) const char *level; int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load server state. */ @@ -2154,7 +2154,7 @@ static void sg_save_game(struct savedata *saving) char global_advances[game.control.num_tech_types + 1]; int i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Game state: once the game is no longer a new game (ie, has been @@ -2282,7 +2282,7 @@ static void sg_save_game(struct savedata *saving) ****************************************************************************/ static void sg_load_random(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (secfile_lookup_bool_default(loading->file, FALSE, "random.saved")) { @@ -2323,7 +2323,7 @@ static void sg_load_random(struct loaddata *loading) ****************************************************************************/ static void sg_save_random(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (fc_rand_is_init() && (!saving->scenario || game.scenario.save_random)) { @@ -2361,7 +2361,7 @@ static void sg_save_random(struct savedata *saving) ****************************************************************************/ static void sg_load_script(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); script_server_state_load(loading->file); @@ -2372,7 +2372,7 @@ static void sg_load_script(struct loaddata *loading) ****************************************************************************/ static void sg_save_script(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); script_server_state_save(saving->file); @@ -2390,7 +2390,7 @@ static void sg_load_scenario(struct loaddata *loading) const char *buf; int game_version; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load version. */ @@ -2461,7 +2461,7 @@ static void sg_load_scenario(struct loaddata *loading) sg_failure_ret(loading->server_state == S_S_INITIAL || (loading->server_state == S_S_RUNNING - && game.scenario.players == TRUE), + && game.scenario.players), "Invalid scenario definition (server state '%s' and " "players are %s).", server_states_name(loading->server_state), @@ -2476,7 +2476,7 @@ static void sg_save_scenario(struct savedata *saving) struct entry *mod_entry; int game_version; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); game_version = MAJOR_VERSION * 1000000 + MINOR_VERSION * 10000 + PATCH_VERSION * 100; @@ -2550,7 +2550,7 @@ static void sg_save_scenario(struct savedata *saving) ****************************************************************************/ static void sg_load_settings(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); settings_game_load(loading->file, "settings"); @@ -2568,7 +2568,7 @@ static void sg_save_settings(struct savedata *saving) { enum map_generator real_generator = wld.map.server.generator; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (saving->scenario) { @@ -2591,7 +2591,7 @@ static void sg_save_settings(struct savedata *saving) ****************************************************************************/ static void sg_load_map(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* This defaults to TRUE even if map has not been generated. @@ -2637,7 +2637,7 @@ static void sg_load_map(struct loaddata *loading) ****************************************************************************/ static void sg_save_map(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (map_is_empty()) { @@ -2677,7 +2677,7 @@ static void sg_save_map(struct savedata *saving) ****************************************************************************/ static void sg_load_map_tiles(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Initialize the map for the current topology. 'map.xsize' and @@ -2717,7 +2717,7 @@ static void sg_load_map_tiles(struct loaddata *loading) ****************************************************************************/ static void sg_save_map_tiles(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Save the terrain type. */ @@ -2745,7 +2745,7 @@ static void sg_save_map_tiles(struct savedata *saving) ****************************************************************************/ static void sg_load_map_tiles_extras(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Load extras. */ @@ -2776,7 +2776,7 @@ static void sg_load_map_tiles_extras(struct loaddata *loading) ****************************************************************************/ static void sg_save_map_tiles_extras(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Save extras. */ @@ -2811,7 +2811,7 @@ static void sg_load_map_startpos(struct loaddata *loading) bool exclude; int i, startpos_count; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); startpos_count @@ -2893,7 +2893,7 @@ static void sg_save_map_startpos(struct savedata *saving) const char SEPARATOR = '#'; int i = 0; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (!game.server.save_options.save_starts) { @@ -2948,7 +2948,7 @@ static void sg_load_map_owner(struct loaddata *loading) struct tile *claimer = NULL; struct extra_type *placing = NULL; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { @@ -3067,7 +3067,7 @@ static void sg_save_map_owner(struct savedata *saving) { int x, y; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (saving->scenario && !saving->save_players) { @@ -3193,7 +3193,7 @@ static void sg_load_map_worked(struct loaddata *loading) { int x, y; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(loading->worked_tiles == NULL, @@ -3237,7 +3237,7 @@ static void sg_save_map_worked(struct savedata *saving) { int x, y; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (saving->scenario && !saving->save_players) { @@ -3274,7 +3274,7 @@ static void sg_save_map_worked(struct savedata *saving) ****************************************************************************/ static void sg_load_map_known(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); players_iterate(pplayer) { @@ -3330,7 +3330,7 @@ static void sg_load_map_known(struct loaddata *loading) ****************************************************************************/ static void sg_save_map_known(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (!saving->save_players) { @@ -3397,7 +3397,7 @@ static void sg_load_players_basic(struct loaddata *loading) const char *str; bool shuffle_loaded = TRUE; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (S_S_INITIAL == loading->server_state @@ -3645,7 +3645,7 @@ static void sg_load_players_basic(struct loaddata *loading) ****************************************************************************/ static void sg_load_players(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { @@ -3805,7 +3805,7 @@ static void sg_load_players(struct loaddata *loading) ****************************************************************************/ static void sg_save_players(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if ((saving->scenario && !saving->save_players) @@ -3876,7 +3876,7 @@ static void sg_load_player_main(struct loaddata *loading, size_t nval; const char *kind; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Basic player data. */ @@ -4343,7 +4343,7 @@ static void sg_save_player_main(struct savedata *saving, const char *flag_names[PLRF_COUNT]; int set_count; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); set_count = 0; @@ -4648,7 +4648,7 @@ static void sg_load_player_cities(struct loaddata *loading, int ncities, i, plrno = player_number(plr); bool tasks_handled; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(secfile_lookup_int(loading->file, &ncities, @@ -5230,7 +5230,7 @@ static void sg_save_player_cities(struct savedata *saving, int plrno = player_number(plr); bool nations[MAX_NUM_PLAYER_SLOTS]; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); secfile_insert_int(saving->file, city_list_size(plr->cities), @@ -5605,7 +5605,7 @@ static void sg_load_player_units(struct loaddata *loading, { int nunits, i, plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); sg_failure_ret(secfile_lookup_int(loading->file, &nunits, @@ -6125,7 +6125,7 @@ static void sg_load_player_units_transport(struct loaddata *loading, { int nunits, i, plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Recheck the number of units for the player. This is a copied from @@ -6179,7 +6179,7 @@ static void sg_save_player_units(struct savedata *saving, int i = 0; int longest_order = 0; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); secfile_insert_int(saving->file, unit_list_size(plr->units), @@ -6428,7 +6428,7 @@ static void sg_load_player_attributes(struct loaddata *loading, { int plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Toss any existing attribute_block (should not exist) */ @@ -6509,7 +6509,7 @@ static void sg_save_player_attributes(struct savedata *saving, { int plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* This is a big heap of opaque data from the client. Although the binary @@ -6597,7 +6597,7 @@ static void sg_load_player_vision(struct loaddata *loading, int i; bool someone_alive = FALSE; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.server.revealmap & REVEAL_MAP_DEAD) { @@ -6615,7 +6615,7 @@ static void sg_load_player_vision(struct loaddata *loading, } if (-1 == total_ncities - || FALSE == game.info.fogofwar + || !game.info.fogofwar || !secfile_lookup_bool_default(loading->file, TRUE, "game.save_private_map")) { /* We have: @@ -6887,7 +6887,7 @@ static void sg_save_player_vision(struct savedata *saving, { int i, plrno = player_number(plr); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (!game.info.fogofwar || !game.server.save_options.save_private_map) { @@ -7054,7 +7054,7 @@ static void sg_load_researches(struct loaddata *loading) int *vlist_research; vlist_research = NULL; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Initialize all researches. */ @@ -7164,7 +7164,7 @@ static void sg_save_researches(struct savedata *saving) int *vlist_research; vlist_research = NULL; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (saving->save_players) { @@ -7224,7 +7224,7 @@ static void sg_save_researches(struct savedata *saving) ****************************************************************************/ static void sg_load_event_cache(struct loaddata *loading) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); event_cache_load(loading->file, "event_cache"); @@ -7235,7 +7235,7 @@ static void sg_load_event_cache(struct loaddata *loading) ****************************************************************************/ static void sg_save_event_cache(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (saving->scenario) { @@ -7259,7 +7259,7 @@ static void sg_load_treaties(struct loaddata *loading) const char *plr0; struct treaty_list *treaties = get_all_treaties(); - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); for (tidx = 0; (plr0 = secfile_lookup_str_default(loading->file, NULL, @@ -7372,7 +7372,7 @@ static void sg_load_history(struct loaddata *loading) struct history_report *hist = history_report_get(); int turn; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); turn = secfile_lookup_int_default(loading->file, -2, "history.turn"); @@ -7416,7 +7416,7 @@ static void sg_load_mapimg(struct loaddata *loading) { int mapdef_count, i; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); /* Clear all defined map images. */ @@ -7454,7 +7454,7 @@ static void sg_load_mapimg(struct loaddata *loading) ****************************************************************************/ static void sg_save_mapimg(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); secfile_insert_int(saving->file, mapimg_count(), "mapimg.count"); @@ -7481,7 +7481,7 @@ static void sg_load_sanitycheck(struct loaddata *loading) { int players; - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); if (game.info.is_new_game) { @@ -7646,6 +7646,6 @@ static void sg_load_sanitycheck(struct loaddata *loading) ****************************************************************************/ static void sg_save_sanitycheck(struct savedata *saving) { - /* Check status and return if not OK (sg_success != TRUE). */ + /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); } diff --git a/server/score.c b/server/score.c index a7b83b354e..bfb79a5853 100644 --- a/server/score.c +++ b/server/score.c @@ -458,7 +458,7 @@ void rank_users(bool interrupt) } players_iterate_end; } - if (interrupt == FALSE) { + if (!interrupt) { /* game ended for a victory condition */ /* first pass: locate those alive who haven't surrendered, set them to diff --git a/server/techtools.c b/server/techtools.c index 6df3b4287f..0ba433487f 100644 --- a/server/techtools.c +++ b/server/techtools.c @@ -978,7 +978,7 @@ void choose_tech(struct research *research, Tech_type_id tech) } } advance_index_iterate_end; research->researching = tech; - if (research->got_tech_multi == FALSE) { + if (!research->got_tech_multi) { research->bulbs_researched = 0; } research->bulbs_researched = research->bulbs_researched + bulbs_res; diff --git a/utility/ioz.c b/utility/ioz.c index 5247dbbd34..fdd63c68d4 100644 --- a/utility/ioz.c +++ b/utility/ioz.c @@ -193,7 +193,7 @@ static inline bool fz_method_is_valid(enum fz_method method) #define fz_method_validate(method) \ (fz_method_is_valid(method) ? method \ - : (fc_assert_msg(TRUE == fz_method_is_valid(method), \ + : (fc_assert_msg(fz_method_is_valid(method), \ "Unsupported compress method %d, reverting to plain.",\ method), FZ_PLAIN)) -- 2.35.1