From f698a0465c4fda9a5cdc5a4594ab113049011e86 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 9 Jun 2022 01:02:37 +0300 Subject: [PATCH 11/11] 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 | 10 +-- 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/legacysave.c | 4 +- server/report.c | 2 +- server/savecompat.c | 10 +-- server/savegame2.c | 68 +++++++++--------- server/savegame3.c | 108 ++++++++++++++--------------- server/score.c | 2 +- server/techtools.c | 2 +- utility/ioz.c | 2 +- 22 files changed, 124 insertions(+), 124 deletions(-) diff --git a/ai/default/aihand.c b/ai/default/aihand.c index a5a5744cf2..8cc3229c26 100644 --- a/ai/default/aihand.c +++ b/ai/default/aihand.c @@ -652,7 +652,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 4153e66f93..62feea3d38 100644 --- a/ai/default/aiunit.c +++ b/ai/default/aiunit.c @@ -995,12 +995,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 d6b48f6116..2e5e017af5 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1324,7 +1324,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 0a64d492c9..0f2e7cb26d 100644 --- a/client/control.c +++ b/client/control.c @@ -2578,9 +2578,9 @@ 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 - && punit->ai_controlled == TRUE) - || (punit->ai_controlled == FALSE)) + && ((gui_options.auto_center_on_automated + && punit->ai_controlled) + || (!punit->ai_controlled)) && !tile_visible_and_not_on_border_mapcanvas(dst_tile)) { center_tile_mapcanvas(dst_tile); } @@ -2603,8 +2603,8 @@ 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 - && punit->ai_controlled == TRUE) { + if (!gui_options.auto_center_on_automated + && punit->ai_controlled) { /* Dont animate automatic units */ } else if (do_animation) { int dx, dy; diff --git a/client/gui-sdl2/graphics.c b/client/gui-sdl2/graphics.c index 0ed4c6a292..ba316dd1d8 100644 --- a/client/gui-sdl2/graphics.c +++ b/client/gui-sdl2/graphics.c @@ -1708,7 +1708,7 @@ SDL_Surface *ResizeSurfaceBox(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 */ tmpSurface = zoomSurface((SDL_Surface*)pSrc, diff --git a/client/gui-sdl2/widget_scrollbar.c b/client/gui-sdl2/widget_scrollbar.c index 8e643c9df9..0e76341023 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_DLG *pDlg, if (seen) { if (!pDlg->pBeginActiveWidgetList) { /* first element ( active list empty ) */ - fc_assert_msg(FALSE == dir, "Forbided List Operation"); + fc_assert_msg(!dir, "Forbidden List Operation"); pNew_Widget->size.x = start_x; pNew_Widget->size.y = start_y; pDlg->pBeginActiveWidgetList = pNew_Widget; diff --git a/client/tilespec.c b/client/tilespec.c index 81de15e839..2da3e1551f 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -5174,7 +5174,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 3945616558..0af2a487c0 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 88f8195020..906e6a60e0 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 dfca083eb9..0cb0099af6 100644 --- a/common/effects.c +++ b/common/effects.c @@ -1105,7 +1105,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 e02835970d..8a5efe1074 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 b6138f4351..4060f41b7a 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 c67fe7fee1..1e27681271 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 5663947d89..ad86231e31 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3134,7 +3134,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/legacysave.c b/server/legacysave.c index ebcb0382e7..88cff69be2 100644 --- a/server/legacysave.c +++ b/server/legacysave.c @@ -3362,10 +3362,10 @@ static void game_load_internal(struct section_file *file) tmp_server_state = S_S_INITIAL; } - if (game.scenario.is_scenario == TRUE + if (game.scenario.is_scenario && (tmp_server_state != S_S_INITIAL || (tmp_server_state == S_S_RUNNING - && game.scenario.players == TRUE))) { + && game.scenario.players))) { log_fatal("Invalid scenario definition (server state '%d' and " "players are %s).", tmp_server_state, game.scenario.players ? "saved" : "not saved"); diff --git a/server/report.c b/server/report.c index 7d9a4e0653..cbfdcb3822 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/savecompat.c b/server/savecompat.c index bd2109518b..44ced7b6ff 100644 --- a/server/savecompat.c +++ b/server/savecompat.c @@ -124,7 +124,7 @@ void sg_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(); loading->version = secfile_lookup_int_default(loading->file, -1, @@ -261,7 +261,7 @@ struct extra_type *resource_by_identifier(const char identifier) ****************************************************************************/ static void compat_load_020400(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(); log_debug("Upgrading data from savegame to version 2.4.0"); @@ -515,7 +515,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"); @@ -620,7 +620,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"); @@ -1222,7 +1222,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"); diff --git a/server/savegame2.c b/server/savegame2.c index 13ed0486bd..2d2f4a0a64 100644 --- a/server/savegame2.c +++ b/server/savegame2.c @@ -1152,7 +1152,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. */ @@ -1486,7 +1486,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; @@ -1512,7 +1512,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. */ @@ -1670,7 +1670,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")) { @@ -1729,7 +1729,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); @@ -1747,7 +1747,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")) { @@ -1819,7 +1819,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), @@ -1839,7 +1839,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"); @@ -1859,7 +1859,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, @@ -1937,7 +1937,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 @@ -1977,7 +1977,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. */ @@ -1992,7 +1992,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. */ @@ -2008,7 +2008,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. */ @@ -2025,7 +2025,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 @@ -2055,7 +2055,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)), @@ -2091,7 +2091,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 @@ -2174,7 +2174,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) { @@ -2258,7 +2258,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, @@ -2300,7 +2300,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) { @@ -2368,7 +2368,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 @@ -2612,7 +2612,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) { @@ -2781,7 +2781,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. */ @@ -3267,7 +3267,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, @@ -3686,7 +3686,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, @@ -4364,7 +4364,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 @@ -4417,7 +4417,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) */ @@ -4503,7 +4503,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) { @@ -4522,7 +4522,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: @@ -4821,7 +4821,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. */ @@ -4907,7 +4907,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"); @@ -4926,7 +4926,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, @@ -5012,7 +5012,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"); @@ -5041,7 +5041,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. */ @@ -5085,7 +5085,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/savegame3.c b/server/savegame3.c index 1a638828ce..57744dc223 100644 --- a/server/savegame3.c +++ b/server/savegame3.c @@ -1282,7 +1282,7 @@ static void sg_load_savefile(struct loaddata *loading) const char *ruleset = NULL; 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. */ @@ -1595,7 +1595,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. */ @@ -1850,7 +1850,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) { @@ -1875,7 +1875,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; @@ -1900,7 +1900,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. */ @@ -2089,7 +2089,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 @@ -2217,7 +2217,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")) { @@ -2258,7 +2258,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)) { @@ -2296,7 +2296,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); @@ -2307,7 +2307,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); @@ -2325,7 +2325,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. */ @@ -2388,7 +2388,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), @@ -2403,7 +2403,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; @@ -2472,7 +2472,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"); @@ -2490,7 +2490,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) { @@ -2513,7 +2513,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. @@ -2559,7 +2559,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()) { @@ -2599,7 +2599,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 @@ -2639,7 +2639,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. */ @@ -2667,7 +2667,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. */ @@ -2698,7 +2698,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. */ @@ -2733,7 +2733,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 @@ -2815,7 +2815,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) { @@ -2871,7 +2871,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) { @@ -2949,7 +2949,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) { @@ -3031,7 +3031,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, @@ -3075,7 +3075,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) { @@ -3112,7 +3112,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) { @@ -3168,7 +3168,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) { @@ -3235,7 +3235,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 @@ -3477,7 +3477,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) { @@ -3637,7 +3637,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) @@ -3708,7 +3708,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. */ @@ -4174,7 +4174,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; @@ -4472,7 +4472,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, @@ -4902,7 +4902,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), @@ -5112,7 +5112,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, @@ -5671,7 +5671,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 @@ -5725,7 +5725,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), @@ -5958,7 +5958,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) */ @@ -6039,7 +6039,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 @@ -6127,7 +6127,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) { @@ -6145,7 +6145,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: @@ -6406,7 +6406,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) { @@ -6571,7 +6571,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. */ @@ -6681,7 +6681,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) { @@ -6741,7 +6741,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"); @@ -6752,7 +6752,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) { @@ -6776,7 +6776,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, @@ -6889,7 +6889,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"); @@ -6933,7 +6933,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. */ @@ -6971,7 +6971,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"); @@ -6998,7 +6998,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) { @@ -7170,6 +7170,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 dff705ab2a..0ee31235f8 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 d7418304f7..697cacb131 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 1cb2622772..0d0489696c 100644 --- a/utility/ioz.c +++ b/utility/ioz.c @@ -162,7 +162,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