From 4c7441d7954c02c2a28bf05f6d9f7b0bb73eb647 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 9 Jun 2022 00:46:49 +0300 Subject: [PATCH 26/26] 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 | 22 +++--- server/savegame/savegame2.c | 68 +++++++++--------- server/savegame/savegame3.c | 110 ++++++++++++++--------------- server/score.c | 2 +- server/techtools.c | 2 +- utility/ioz.c | 2 +- 22 files changed, 128 insertions(+), 127 deletions(-) diff --git a/ai/default/aihand.c b/ai/default/aihand.c index 2a244bde6b..c026b97fa9 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 a9a0b9e093..de3b7886b1 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 24ef7c90b7..118c18b1bf 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1312,7 +1312,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 9f5fd2f5e9..ea30ea7d14 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 1ca9b0e2d6..e200e24ded 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 09c6127710..cf1ff8f159 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -5295,7 +5295,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 04bab2dd86..bb91c1ff6b 100644 --- a/common/effects.c +++ b/common/effects.c @@ -1202,7 +1202,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 4dbfc0c889..815a32b862 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3284,7 +3284,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 ff11ff47e4..53db8aeae6 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 00234b169a..64e7a01a5e 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -295,6 +295,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) { @@ -310,7 +311,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 a826b6fb64..fc01d0ceb8 100644 --- a/server/savegame/savecompat.c +++ b/server/savegame/savecompat.c @@ -143,7 +143,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, @@ -195,7 +195,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++) { @@ -340,7 +340,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"); @@ -598,7 +598,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"); @@ -704,7 +704,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"); @@ -1310,7 +1310,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"); @@ -1497,7 +1497,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"); @@ -1797,7 +1797,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 */ @@ -1893,7 +1893,7 @@ static void compat_load_030200(struct loaddata *loading, int set_count; bool gamestart_valid = FALSE; - /* 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.2.0"); @@ -2020,7 +2020,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"); @@ -2492,7 +2492,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 924aabeef1..5d9b064d54 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; @@ -1522,7 +1522,7 @@ static void sg_load_game(struct loaddata *loading) const char *string; 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. */ @@ -1659,7 +1659,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")) { @@ -1718,7 +1718,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); @@ -1736,7 +1736,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")) { @@ -1808,7 +1808,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), @@ -1828,7 +1828,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"); @@ -1848,7 +1848,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, @@ -1926,7 +1926,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 @@ -1966,7 +1966,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. */ @@ -1981,7 +1981,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. */ @@ -1997,7 +1997,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. */ @@ -2014,7 +2014,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 @@ -2044,7 +2044,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)), @@ -2080,7 +2080,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 @@ -2163,7 +2163,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) { @@ -2247,7 +2247,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, @@ -2289,7 +2289,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) { @@ -2357,7 +2357,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 @@ -2605,7 +2605,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) { @@ -2774,7 +2774,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. */ @@ -3259,7 +3259,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, @@ -3679,7 +3679,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, @@ -4406,7 +4406,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 @@ -4459,7 +4459,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) */ @@ -4545,7 +4545,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) { @@ -4564,7 +4564,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: @@ -4865,7 +4865,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. */ @@ -4951,7 +4951,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"); @@ -4969,7 +4969,7 @@ static void sg_load_treaties(struct loaddata *loading) int tidx; const char *plr0; - /* 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, @@ -5051,7 +5051,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"); @@ -5080,7 +5080,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. */ @@ -5124,7 +5124,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 e091fbbe3b..323607fa4f 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -1247,7 +1247,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. */ @@ -1648,7 +1648,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. */ @@ -1927,7 +1927,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) { @@ -1952,7 +1952,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; @@ -1976,7 +1976,7 @@ static void sg_load_game(struct loaddata *loading) const char *str; 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. */ @@ -2146,7 +2146,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 @@ -2272,7 +2272,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")) { @@ -2313,7 +2313,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)) { @@ -2351,7 +2351,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); @@ -2362,7 +2362,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); @@ -2380,7 +2380,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. */ @@ -2451,7 +2451,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), @@ -2466,7 +2466,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; @@ -2540,7 +2540,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"); @@ -2558,7 +2558,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) { @@ -2628,7 +2628,7 @@ Save [counters]. ****************************************************************************/ static void sg_save_counters(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(); const char **countnames;; @@ -2683,7 +2683,7 @@ static void sg_save_counters(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. @@ -2729,7 +2729,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()) { @@ -2769,7 +2769,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 @@ -2809,7 +2809,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. */ @@ -2837,7 +2837,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. */ @@ -2868,7 +2868,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. */ @@ -2903,7 +2903,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 @@ -2985,7 +2985,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) { @@ -3040,7 +3040,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) { @@ -3159,7 +3159,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) { @@ -3285,7 +3285,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, @@ -3329,7 +3329,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) { @@ -3366,7 +3366,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) { @@ -3422,7 +3422,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) { @@ -3489,7 +3489,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 @@ -3737,7 +3737,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) { @@ -3897,7 +3897,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) @@ -3968,7 +3968,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. */ @@ -4435,7 +4435,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; @@ -4740,7 +4740,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, @@ -5325,7 +5325,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), @@ -5702,7 +5702,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, @@ -6222,7 +6222,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 @@ -6276,7 +6276,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), @@ -6525,7 +6525,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) */ @@ -6606,7 +6606,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 @@ -6694,7 +6694,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) { @@ -6712,7 +6712,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: @@ -6984,7 +6984,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) { @@ -7151,7 +7151,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. */ @@ -7257,7 +7257,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) { @@ -7317,7 +7317,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"); @@ -7328,7 +7328,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) { @@ -7351,7 +7351,7 @@ static void sg_load_treaties(struct loaddata *loading) int tidx; const char *plr0; - /* 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, @@ -7475,7 +7475,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"); @@ -7519,7 +7519,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. */ @@ -7557,7 +7557,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"); @@ -7584,7 +7584,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) { @@ -7749,6 +7749,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 e4164cbc5b..a78d301a48 100644 --- a/server/techtools.c +++ b/server/techtools.c @@ -965,7 +965,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