Index: ai/advdomestic.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v retrieving revision 1.88 diff -u -r1.88 advdomestic.c --- ai/advdomestic.c 2002/09/04 00:06:37 1.88 +++ ai/advdomestic.c 2002/09/14 10:10:18 @@ -130,9 +130,11 @@ if (ai->threats.nuclear == 0) { return 0; } continent = map_get_continent(pcity->x, pcity->y); - vulnerable += ai->threats.continent[continent] - || is_water_adjacent_to_tile(pcity->x, pcity->y) - || city_got_building(pcity, B_PALACE); + if (ai->threats.continent[continent] + || is_water_adjacent_to_tile(pcity->x, pcity->y) + || city_got_building(pcity, B_PALACE)) { + vulnerable++; + } /* 15 is just a new magic number, which will be +15 if we are in a vulnerable spot, and +15 if someone we are not allied @@ -780,9 +782,11 @@ values[id] = bar; break; case B_WOMENS: - unit_list_iterate(pcity->units_supported, punit) - if (punit->unhappiness) values[id] += t * 2; - unit_list_iterate_end; + unit_list_iterate(pcity->units_supported, punit) { + if (punit->unhappiness != 0) { + values[id] += t * 2; + } + } unit_list_iterate_end; break; case B_APOLLO: if (game.spacerace) @@ -814,7 +818,7 @@ else pcity->ai.building_want[id] = -values[id]; - if (values[id]) + if (values[id] != 0) freelog(LOG_DEBUG, "ai_eval_buildings: %s wants %s with desire %d.", pcity->name, get_improvement_name(id), pcity->ai.building_want[id]); } impr_type_iterate_end; Index: ai/advmilitary.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v retrieving revision 1.113 diff -u -r1.113 advmilitary.c --- ai/advmilitary.c 2002/09/04 09:56:25 1.113 +++ ai/advmilitary.c 2002/09/14 10:10:19 @@ -355,7 +355,7 @@ /* Set default danger to protect valuable cities. Idea fom Ross. FIXME: use aidata code here to protect cities in danger locations */ - danger[0] = MAX(0, pcity->size + (palace * 4) - danger[0] - 3); + danger[0] = MAX(0, pcity->size + (palace ? 4 : 0) - danger[0] - 3); players_iterate(aplayer) { int boatspeed; @@ -419,9 +419,13 @@ } if (unit_flag(funit, F_HORSE)) { - if (pikemen) vulnerability /= 2; - else ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, - (vulnerability * move_rate / (dist*2))); + if (pikemen) { + vulnerability /= 2; + } else { + (void) ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, + (vulnerability * move_rate / + (dist * 2))); + } } if (unit_flag(funit, F_DIPLOMAT) && (dist <= 2 * move_rate)) { @@ -467,9 +471,13 @@ } if (unit_flag(punit, F_HORSE)) { - if (pikemen) vulnerability /= 2; - else ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, - (vulnerability * move_rate / (dist*2))); + if (pikemen) { + vulnerability /= 2; + } else { + (void) ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, + (vulnerability * move_rate / + (dist * 2))); + } } if (unit_flag(punit, F_DIPLOMAT) && (dist <= 2 * move_rate)) { @@ -1015,7 +1023,8 @@ tech progression beyond all description. Only when adding the override code did I realize the magnitude of my transgression. How despicable. -- Syela */ m = unit_vulnerability_virtual2(v, pdef->type, x, y, FALSE, - pdef->veteran, myunit->id, pdef->hp); + pdef->veteran, myunit->id != 0, + pdef->hp); if (d < m) { d = m; b = unit_type(pdef)->build_cost + 40; @@ -1054,7 +1063,8 @@ n = pdef->type; d = unit_vulnerability_virtual2(v, n, x, y, pdef->activity == ACTIVITY_FORTIFIED, - pdef->veteran, myunit->id, pdef->hp); + pdef->veteran, myunit->id != 0, + pdef->hp); vet = pdef->veteran; } /* end dealing with units */ Index: ai/aicity.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v retrieving revision 1.121 diff -u -r1.121 aicity.c --- ai/aicity.c 2002/09/11 17:04:38 1.121 +++ ai/aicity.c 2002/09/14 10:10:20 @@ -959,7 +959,7 @@ /* in rare cases the _safe might be needed? --dwp */ handle_unit_disband_safe(pplayer, &pack, &myiter); city_refresh(pcity); - ai_fix_unhappy(pcity); + (void) ai_fix_unhappy(pcity); } unit_list_iterate_end; Index: ai/aidata.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v retrieving revision 1.1 diff -u -r1.1 aidata.c --- ai/aidata.c 2002/08/25 11:36:50 1.1 +++ ai/aidata.c 2002/09/14 10:10:20 @@ -32,7 +32,7 @@ #include "aidata.h" -struct ai_data aidata[MAX_NUM_PLAYERS * MAX_NUM_BARBARIANS]; +static struct ai_data aidata[MAX_NUM_PLAYERS * MAX_NUM_BARBARIANS]; /************************************************************************** Make and cache lots of calculations needed for other functions, notably: Index: ai/aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.215 diff -u -r1.215 aiunit.c --- ai/aiunit.c 2002/09/12 19:40:07 1.215 +++ ai/aiunit.c 2002/09/14 10:10:22 @@ -570,7 +570,7 @@ /* Also try take care of deliberately homeless units */ punit->goto_dest_x = pcity->x; punit->goto_dest_y = pcity->y; - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); } } else { /* Sea travel */ @@ -1064,7 +1064,7 @@ { int x, y, id = punit->id; - while (punit && punit->moves_left + while (punit && punit->moves_left > 0 && ai_military_findvictim(punit, &x, &y) >= threshold) { ai_unit_attack(punit, x, y); punit = find_unit_by_id(id); @@ -1582,7 +1582,7 @@ punit->goto_dest_x=pcity->x; punit->goto_dest_y=pcity->y; set_unit_activity(punit, ACTIVITY_GOTO); - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); } } else { handle_unit_activity_request(punit, ACTIVITY_FORTIFYING); @@ -1998,11 +1998,11 @@ if (is_sailing_unit(punit) && find_nearest_friendly_port(punit)) { /* Sail somewhere */ - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); } else if (!is_barbarian(pplayer)) { /* Nothing else to do. Worst case, this function will send us back home */ - ai_manage_explorer(punit); + (void) ai_manage_explorer(punit); } else { /* You can still have some moves left here, but barbarians should not sit helplessly, but advance towards nearest known enemy city */ @@ -2093,7 +2093,7 @@ } else { req.unit_id = punit->id; req.city_id = pcity->id; - handle_unit_establish_trade(pplayer, &req); + (void) handle_unit_establish_trade(pplayer, &req); } } } @@ -2140,7 +2140,7 @@ freelog(LOG_DEBUG, "%s#%d@(%d,%d), p=%d, n=%d", unit_name(punit->type), punit->id, punit->x, punit->y, p, n); if (punit->moves_left > 0 && n != 0) - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); else if (n == 0 && !map_get_city(punit->x, punit->y)) { /* rest in a city, for unhap */ x = punit->goto_dest_x; y = punit->goto_dest_y; if (find_nearest_friendly_port(punit) @@ -2153,7 +2153,7 @@ freelog(LOG_DEBUG, "Ferryboat %d@(%d,%d) stalling.", punit->id, punit->x, punit->y); if(is_barbarian(pplayer)) /* just in case */ - ai_manage_explorer(punit); + (void) ai_manage_explorer(punit); } return; } @@ -2214,12 +2214,12 @@ punit->goto_dest_x = pcity->x; punit->goto_dest_y = pcity->y; set_unit_activity(punit, ACTIVITY_GOTO); - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); return; } } if (map_get_terrain(punit->x, punit->y) == T_OCEAN) /* thanks, Tony */ - ai_manage_explorer(punit); + (void) ai_manage_explorer(punit); return; } @@ -2272,7 +2272,7 @@ handle_unit_activity_request(punit, ACTIVITY_PILLAGE); return; /* when you pillage, you have moves left, avoid later fortify */ case AIUNIT_EXPLORE: - ai_manage_explorer(punit); + (void) ai_manage_explorer(punit); break; default: assert(FALSE); @@ -2374,11 +2374,9 @@ return; } else { if (punit->moves_left == 0) return; /* can't do anything with no moves */ - ai_manage_explorer(punit); /* what else could this be? -- Syela */ + (void) ai_manage_explorer(punit); /* what else could this be? -- Syela */ return; } - /* should never get here */ - assert(0); } /************************************************************************** @@ -2627,7 +2625,7 @@ pdiplomat->goto_dest_x=ctarget->x; pdiplomat->goto_dest_y=ctarget->y; set_unit_activity(pdiplomat, ACTIVITY_GOTO); - do_unit_goto(pdiplomat, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(pdiplomat, GOTO_MOVE_ANY, FALSE); } } } Index: common/shared.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.c,v retrieving revision 1.91 diff -u -r1.91 shared.c --- common/shared.c 2002/09/13 10:04:02 1.91 +++ common/shared.c 2002/09/14 10:10:23 @@ -259,7 +259,7 @@ } tokens[token] = fc_malloc(len + 1); - mystrlcpy(tokens[token], str, len + 1); /* adds the '\0' */ + (void) mystrlcpy(tokens[token], str, len + 1); /* adds the '\0' */ token++; @@ -1198,39 +1198,24 @@ } /*************************************************************************** - Return whether two vectors: vec1 and vec2 both of size l (in bytes) have - common bits. - (Don't call this function directly, use BV_CHECK_MASK macro instead) -***************************************************************************/ -bool _bv_check_mask(unsigned char* vec1, unsigned char* vec2, int l) -{ - while(l >= sizeof(int)) { - l-=sizeof(int); - if (*(int*)(vec1 + l) & *(int*)(vec2 + l)) return TRUE; - } - /* - * This function will always be called with l%sizeof(int) != 0 - * So there's no need to put here - * if (l == 0) return FALSE - */ - do { - l--; - if (vec1[l] & vec2[l]) return TRUE; - } while(l); + Return whether two vectors: vec1 and vec2 have common + bits. I.e. (vec1 & vec2) != 0. - return FALSE; -} - -/*************************************************************************** - Return whether two vectors: vec1 and vec2 both of size l * sizeof(int) - have common bits. - (Don't call this function directly, use BV_CHECK_MASK macro instead) + Don't call this function directly, use BV_CHECK_MASK macro + instead. Don't call this function with two different bitvectors. ***************************************************************************/ -bool _bv_check_mask_int(unsigned int* vec1, unsigned int* vec2, int l) +bool bv_check_mask(unsigned char *vec1, unsigned char *vec2, size_t size1, + size_t size2) { - do { - l--; - if (vec1[l] & vec2[l]) return TRUE; - } while(l); + size_t i; + assert(size1 == size2); + + for (i = 0; i < size1; i++) { + if ((vec1[0] & vec2[0]) != 0) { + return TRUE; + } + vec1++; + vec2++; + } return FALSE; } Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.101 diff -u -r1.101 shared.h --- common/shared.h 2002/08/21 22:40:07 1.101 +++ common/shared.h 2002/09/14 10:10:23 @@ -86,16 +86,10 @@ do { (bv).vec[_BV_BYTE_INDEX(bit)] &= ~_BV_BITMASK(bit); } while(FALSE) #define BV_CLR_ALL(bv) \ do { memset((bv).vec, 0, sizeof((bv).vec)); } while(FALSE) -bool _bv_check_mask(unsigned char* vec1, unsigned char* vec2, int l); -bool _bv_check_mask_int(unsigned int* vec1, unsigned int* vec2, int l); -#define BV_CHECK_MASK(vec1, vec2) \ - ( \ - sizeof((vec1).vec) % sizeof(int) ? \ - _bv_check_mask((vec1).vec, (vec2).vec, sizeof((vec1).vec)) \ - : \ - _bv_check_mask_int((int*)((vec1).vec), (int*)((vec2).vec), \ - sizeof((vec1).vec) / sizeof(int)) \ - ) +bool bv_check_mask(unsigned char *vec1, unsigned char *vec2, size_t size1, + size_t size2); +#define BV_CHECK_MASK(vec1, vec2) \ + bv_check_mask((vec1).vec, (vec2).vec, sizeof((vec1).vec),sizeof((vec2).vec)) #define BV_DEFINE(name, bits) \ typedef struct { unsigned char vec[_BV_BYTES(bits)]; } name; Index: common/unit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v retrieving revision 1.161 diff -u -r1.161 unit.c --- common/unit.c 2002/08/07 11:21:49 1.161 +++ common/unit.c 2002/09/14 10:10:24 @@ -79,7 +79,6 @@ freelog(LOG_FATAL, "Illegal move type %d", unit_type(punit)->move_type); assert(0); exit(EXIT_FAILURE); - move_rate = -1; } if (move_rate < SINGLE_MOVE && unit_type(punit)->move_rate > 0) { Index: server/autoattack.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/autoattack.c,v retrieving revision 1.38 diff -u -r1.38 autoattack.c --- server/autoattack.c 2002/09/11 17:04:42 1.38 +++ server/autoattack.c 2002/09/14 10:10:25 @@ -170,7 +170,7 @@ punit->goto_dest_y=enemy->y; send_unit_info(NULL, punit); - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); punit = find_unit_by_id(id); @@ -180,7 +180,7 @@ punit->goto_dest_y=pcity->y; send_unit_info(NULL, punit); - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); if (unit_list_find(&map_get_tile(pcity->x, pcity->y)->units, id)) { handle_unit_activity_request(punit, ACTIVITY_IDLE); @@ -232,7 +232,7 @@ && is_military_unit(punit) && punit->activity == ACTIVITY_GOTO && punit->moves_left == unit_type(punit)->move_rate) { - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); } } unit_list_iterate_end; Index: server/barbarian.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v retrieving revision 1.54 diff -u -r1.54 barbarian.c --- server/barbarian.c 2002/04/04 03:51:04 1.54 +++ server/barbarian.c 2002/09/14 10:10:25 @@ -239,12 +239,12 @@ } if (is_free_sea(xu, yu, barbarians)) { boat = find_a_unit_type(L_BARBARIAN_BOAT, -1); - create_unit( barbarians, xu, yu, boat, FALSE, 0, -1); + (void) create_unit(barbarians, xu, yu, boat, FALSE, 0, -1); xb = xu; yb = yu; break; } } - handle_unit_move_request(punit2, xu, yu, TRUE, FALSE); + (void) handle_unit_move_request(punit2, xu, yu, TRUE, FALSE); } unit_list_iterate_end; } Index: server/cityturn.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v retrieving revision 1.194 diff -u -r1.194 cityturn.c --- server/cityturn.c 2002/07/29 13:13:42 1.194 +++ server/cityturn.c 2002/09/14 10:10:26 @@ -986,7 +986,8 @@ second = pplayer->research.researching; found_new_tech(pplayer, pplayer->research.researching, TRUE, TRUE); - mystrlcpy(buffer,get_tech_name(pplayer, first),sizeof(buffer)); + (void) mystrlcpy(buffer, get_tech_name(pplayer, first), + sizeof(buffer)); notify_embassies(pplayer, NULL, _("Game: The %s have acquired %s and %s from %s."), Index: server/console.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/console.c,v retrieving revision 1.16 diff -u -r1.16 console.c --- server/console.c 2002/08/15 09:56:01 1.16 +++ server/console.c 2002/09/14 10:10:26 @@ -34,7 +34,7 @@ static bool console_prompt_is_showing = FALSE; static bool console_rfcstyle = FALSE; #ifdef HAVE_LIBREADLINE -static int readline_received_enter = 1; +static bool readline_received_enter = TRUE; #endif /************************************************************************ @@ -60,7 +60,7 @@ #ifdef HAVE_LIBREADLINE if (readline_received_enter) { - readline_received_enter = 0; + readline_received_enter = FALSE; } else { rl_forced_update_display(); } @@ -207,7 +207,7 @@ { console_prompt_is_showing = FALSE; #ifdef HAVE_LIBREADLINE - readline_received_enter = 1; + readline_received_enter = TRUE; #endif } @@ -218,6 +218,6 @@ { console_prompt_is_showing = TRUE; #ifdef HAVE_LIBREADLINE - readline_received_enter = 0; + readline_received_enter = FALSE; #endif } Index: server/gamehand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v retrieving revision 1.115 diff -u -r1.115 gamehand.c --- server/gamehand.c 2002/09/02 02:19:54 1.115 +++ server/gamehand.c 2002/09/14 10:10:26 @@ -114,7 +114,7 @@ do { dx = x + myrand(2 * game.dispersion + 1) - game.dispersion; dy = y + myrand(2 * game.dispersion + 1) - game.dispersion; - normalize_map_pos(&dx, &dy); + (void) normalize_map_pos(&dx, &dy); } while (!(is_real_tile(dx, dy) && map_get_continent(x, y) == map_get_continent(dx, dy) && map_get_terrain(dx, dy) != T_OCEAN Index: server/mapgen.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v retrieving revision 1.97 diff -u -r1.97 mapgen.c --- server/mapgen.c 2002/08/06 22:27:01 1.97 +++ server/mapgen.c 2002/09/14 10:10:28 @@ -2119,14 +2119,22 @@ **************************************************************************/ static void mapgenerator5(void) { - int x, y; - int xnowrap = 0; /* could come from topology */ - int ynowrap = 1; /* could come from topology */ - int xmax = map.xsize - xnowrap; - int ymax = map.ysize - ynowrap; - int xdiv = 6; /* how many blocks should the x and y directions be */ - int ydiv = 5; /* divided into initially */ - int minval; + const bool xnowrap = FALSE; /* could come from topology */ + const bool ynowrap = TRUE; /* could come from topology */ + + /* + * How many blocks should the x and y directions be divided into + * initially. + */ + const int xdiv = 6; + const int ydiv = 5; + + int xdiv2 = xdiv + (xnowrap ? 1 : 0); + int ydiv2 = ydiv + (ynowrap ? 1 : 0); + + int xmax = map.xsize - (xnowrap ? 1 : 0); + int ymax = map.ysize - (ynowrap ? 1 : 0); + int x, y, minval; /* just need something > log(max(xsize, ysize)) for the recursion */ int step = map.xsize + map.ysize; /* edges are avoided more strongly as this increases */ @@ -2142,8 +2150,8 @@ } whole_map_iterate_end; /* set initial points */ - for (x = 0; x < xdiv + xnowrap; x++) { - for (y = 0; y < ydiv + ynowrap; y++) { + for (x = 0; x < xdiv2; x++) { + for (y = 0; y < ydiv2; y++) { hmap(x * xmax / xdiv, y * ymax / ydiv) = myrand(2*step) - (2*step)/2; } } @@ -2151,7 +2159,7 @@ /* if we aren't wrapping stay away from edges to some extent, try even harder to avoid the edges naturally if separatepoles is true */ if (xnowrap) { - for (y = 0; y < ydiv + ynowrap; y++) { + for (y = 0; y < ydiv2; y++) { hmap(0, y * ymax / ydiv) -= avoidedge; hmap(xmax, y * ymax / ydiv) -= avoidedge; if (map.separatepoles) { @@ -2164,7 +2172,7 @@ } if (ynowrap) { - for (x = 0; x < xdiv + xnowrap; x++) { + for (x = 0; x < xdiv2; x++) { hmap(x * xmax / xdiv, 0) -= avoidedge; hmap(x * xmax / xdiv, ymax) -= avoidedge; if (map.separatepoles){ Index: server/meta.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/meta.c,v retrieving revision 1.52 diff -u -r1.52 meta.c --- server/meta.c 2002/05/17 03:13:08 1.52 +++ server/meta.c 2002/09/14 10:10:28 @@ -106,7 +106,7 @@ char *metaserver_port_separator = strchr(srvarg.metaserver_addr, ':'); if (metaserver_port_separator) { - sscanf(metaserver_port_separator + 1, "%hd", &srvarg.metaserver_port); + sscanf(metaserver_port_separator + 1, "%hu", &srvarg.metaserver_port); } } Index: server/ruleset.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v retrieving revision 1.118 diff -u -r1.118 ruleset.c --- server/ruleset.c 2002/09/02 02:19:54 1.118 +++ server/ruleset.c 2002/09/14 10:10:30 @@ -1907,7 +1907,7 @@ setting = 1; } - if (!mystrcasecmp(name, "river")) { + if (mystrcasecmp(name, "river") == 0) { city_names[j].river = setting; } else { /* "handled" tracks whether we find a match (for error handling) */ @@ -1922,7 +1922,7 @@ * However this is not a problem because we take care of rivers * separately. */ - if (!mystrcasecmp(name, tile_types[type].terrain_name)) { + if (mystrcasecmp(name, tile_types[type].terrain_name) == 0) { city_names[j].terrain[type] = setting; handled = TRUE; } @@ -1935,7 +1935,7 @@ } } name = next ? next + 1 : NULL; - } while (name && name[0]); + } while (name && name[0] != '\0'); } /* if (!next) */ } /* if (name) */ remove_leading_trailing_spaces(cities[j]); Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.90 diff -u -r1.90 savegame.c --- server/savegame.c 2002/08/25 11:21:02 1.90 +++ server/savegame.c 2002/09/14 10:10:31 @@ -1437,7 +1437,7 @@ j = -1; } else { assert(pcity->did_buy == TRUE || pcity->did_buy == FALSE); - j = pcity->did_buy; + j = pcity->did_buy ? 1 : 0; } secfile_insert_int(file, j, "player%d.c%d.did_buy", plrno, i); secfile_insert_int(file, pcity->turn_founded, Index: server/sernet.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v retrieving revision 1.94 diff -u -r1.94 sernet.c --- server/sernet.c 2002/08/06 22:27:03 1.94 +++ server/sernet.c 2002/09/14 10:10:32 @@ -132,9 +132,9 @@ static char *history_file = NULL; -static int readline_handled_input = 0; +static bool readline_handled_input = FALSE; -static int readline_initialized = 0; +static bool readline_initialized = FALSE; /***************************************************************************** ... @@ -149,13 +149,13 @@ return; } - if (*line) + if (line[0] != '\0') add_history(line); con_prompt_enter(); /* just got an 'Enter' hit */ handle_stdin_input((struct connection*)NULL, line); - readline_handled_input = 1; + readline_handled_input = TRUE; } #endif /* HAVE_LIBREADLINE */ @@ -340,7 +340,7 @@ rl_callback_handler_install("> ", handle_readline_input_callback); rl_attempted_completion_function = freeciv_completion; - readline_initialized = 1; + readline_initialized = TRUE; } } #endif /* HAVE_LIBREADLINE */ @@ -513,7 +513,7 @@ #ifdef HAVE_LIBREADLINE rl_callback_read_char(); if (readline_handled_input) { - readline_handled_input = 0; + readline_handled_input = FALSE; con_prompt_enter_clear(); } continue; Index: server/settlers.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v retrieving revision 1.143 diff -u -r1.143 settlers.c --- server/settlers.c 2002/09/12 19:40:07 1.143 +++ server/settlers.c 2002/09/14 10:10:33 @@ -40,9 +40,9 @@ signed int minimap[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; BV_DEFINE(nearness, MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS); -nearness territory[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; +static nearness territory[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; BV_DEFINE(enemy_mask, MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS); -enemy_mask enemies[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS]; +static enemy_mask enemies[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS]; static void auto_settlers_player(struct player *pplayer); static bool is_already_assigned(struct unit *myunit, struct player *pplayer, Index: server/stdinhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v retrieving revision 1.246 diff -u -r1.246 stdinhand.c --- server/stdinhand.c 2002/09/01 20:27:06 1.246 +++ server/stdinhand.c 2002/09/14 10:10:35 @@ -868,16 +868,16 @@ by a client while the game is running. Does not test whether the client has sufficient access or the option has been /fixed. *********************************************************************/ -static int sset_is_runtime_changeable_by_client(int idx) +static bool sset_is_runtime_changeable_by_client(int idx) { struct settings_s *op = &settings[idx]; switch(op->sclass) { case SSET_RULES_FLEXIBLE: case SSET_META: - return 1; + return TRUE; default: - return 0; + return FALSE; } } @@ -1073,11 +1073,11 @@ }, {"fix", ALLOW_CTRL, N_("fix "), - N_("Make server option unchangeable during game.") + N_("Make server option unchangeable during game."), NULL }, {"unfix", ALLOW_CTRL, N_("unfix "), - N_("Make server option changeable during game.") + N_("Make server option changeable during game."), NULL }, {"rulesetdir", ALLOW_CTRL, N_("rulesetdir "), @@ -1863,7 +1863,7 @@ static void read_command(struct connection *caller, char *arg) { /* warning: there is no recursion check! */ - read_init_script(caller, arg); + (void) read_init_script(caller, arg); } /************************************************************************** @@ -3704,7 +3704,7 @@ /* If this is a new word to complete, initialize now. This includes saving the length of TEXT for efficiency, and initializing the index variable to 0. */ - if (!state) { + if (state == 0) { list_index = 0; len = strlen (text); } @@ -3879,17 +3879,18 @@ **************************************************************************/ static int num_tokens(int start) { - int res = 0, alnum = 0; + int res = 0; + bool alnum = FALSE; char *chptr = rl_line_buffer; while (chptr - rl_line_buffer < start) { if (my_isalnum(*chptr)) { if (!alnum) { - alnum = 1; + alnum = TRUE; res++; } } else { - alnum = 0; + alnum = FALSE; } chptr++; } Index: server/unithand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v retrieving revision 1.233 diff -u -r1.233 unithand.c --- server/unithand.c 2002/09/11 17:04:43 1.233 +++ server/unithand.c 2002/09/14 10:10:37 @@ -86,7 +86,7 @@ assign_units_to_transporter(punit, TRUE); } - do_unit_goto(punit, GOTO_MOVE_ANY, TRUE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, TRUE); } /************************************************************************** @@ -104,7 +104,7 @@ pcity = map_get_city(req->x, req->y); if (punit && pcity) { - do_airline(punit, pcity); + (void) do_airline(punit, pcity); } } @@ -140,8 +140,9 @@ * starting tile. */ if (!can_unit_do_activity(punit, req->activity_type)) { - do_unit_goto(punit, get_activity_move_restriction(req->activity_type), - FALSE); + (void) do_unit_goto(punit, + get_activity_move_restriction(req->activity_type), + FALSE); } } @@ -321,7 +322,8 @@ case DIPLOMAT_MOVE: if(pcity && diplomat_can_do_action(pdiplomat, DIPLOMAT_MOVE, pcity->x, pcity->y)) { - handle_unit_move_request(pdiplomat, pcity->x, pcity->y, FALSE, TRUE); + (void) handle_unit_move_request(pdiplomat, pcity->x, pcity->y, + FALSE, TRUE); } break; case DIPLOMAT_STEAL: @@ -590,7 +592,7 @@ if (!same_pos(punit->x, punit->y, pinfo->x, pinfo->y)) { if (is_tiles_adjacent(punit->x, punit->y, pinfo->x, pinfo->y)) { punit->ai.control = FALSE; - handle_unit_move_request(punit, pinfo->x, pinfo->y, FALSE, FALSE); + (void) handle_unit_move_request(punit, pinfo->x, pinfo->y, FALSE, FALSE); } else { /* This can happen due to lag, so don't complain too loudly */ freelog(LOG_DEBUG, "tiles are not adjacent, unit pos %d,%d trying " @@ -621,7 +623,7 @@ || !is_tiles_adjacent(punit->x, punit->y, pmove->x, pmove->y)) { return; } - handle_unit_move_request(punit, pmove->x, pmove->y, FALSE, FALSE); + (void) handle_unit_move_request(punit, pmove->x, pmove->y, FALSE, FALSE); } /************************************************************************** @@ -1017,7 +1019,7 @@ /* The ai should assign the relevant units itself, but for now leave this */ bool take_from_land = punit->activity == ACTIVITY_IDLE; - move_unit(punit, dest_x, dest_y, TRUE, take_from_land, move_cost); + (void) move_unit(punit, dest_x, dest_y, TRUE, take_from_land, move_cost); return TRUE; } else { @@ -1317,7 +1319,7 @@ return; } - do_paradrop(punit, req->x, req->y); + (void) do_paradrop(punit, req->x, req->y); } @@ -1381,7 +1383,7 @@ } assign_units_to_transporter(punit, TRUE); - goto_route_execute(punit); + (void) goto_route_execute(punit); } /************************************************************************** Index: server/unittools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v retrieving revision 1.181 diff -u -r1.181 unittools.c --- server/unittools.c 2002/08/31 02:24:34 1.181 +++ server/unittools.c 2002/09/14 10:10:39 @@ -511,7 +511,7 @@ punit->goto_dest_x = x_itr; punit->goto_dest_y = y_itr; set_unit_activity(punit, ACTIVITY_GOTO); - do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE); notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, _("Game: Your %s has returned to refuel."), unit_name(punit->type)); @@ -1001,7 +1001,7 @@ punit->ai.passenger != 0 || !pplayer->ai.control)) { /* autosettlers otherwise waste time; idling them breaks assignment */ /* Stalling infantry on GOTO so I can see where they're GOing TO. -- Syela */ - do_unit_goto(punit, GOTO_MOVE_ANY, TRUE); + (void) do_unit_goto(punit, GOTO_MOVE_ANY, TRUE); } return; } @@ -1059,7 +1059,7 @@ _("Game: Moved your %s due to changing" " land to sea at (%d, %d)."), unit_name(punit2->type), punit2->x, punit2->y); - move_unit(punit2, x, y, TRUE, FALSE, 0); + (void) move_unit(punit2, x, y, TRUE, FALSE, 0); if (punit2->activity == ACTIVITY_SENTRY) handle_unit_activity_request(punit2, ACTIVITY_IDLE); goto START; @@ -1082,7 +1082,7 @@ _("Game: Embarked your %s due to changing" " land to sea at (%d, %d)."), unit_name(punit2->type), punit2->x, punit2->y); - move_unit(punit2, x, y, TRUE, FALSE, 0); + (void) move_unit(punit2, x, y, TRUE, FALSE, 0); if (punit2->activity == ACTIVITY_SENTRY) handle_unit_activity_request(punit2, ACTIVITY_IDLE); goto START; @@ -1122,7 +1122,7 @@ _("Game: Moved your %s due to changing" " sea to land at (%d, %d)."), unit_name(punit2->type), punit2->x, punit2->y); - move_unit(punit2, x, y, TRUE, TRUE, 0); + (void) move_unit(punit2, x, y, TRUE, TRUE, 0); if (punit2->activity == ACTIVITY_SENTRY) handle_unit_activity_request(punit2, ACTIVITY_IDLE); goto START; @@ -1144,7 +1144,7 @@ _("Game: Docked your %s due to changing" " sea to land at (%d, %d)."), unit_name(punit2->type), punit2->x, punit2->y); - move_unit(punit2, x, y, TRUE, TRUE, 0); + (void) move_unit(punit2, x, y, TRUE, TRUE, 0); if (punit2->activity == ACTIVITY_SENTRY) handle_unit_activity_request(punit2, ACTIVITY_IDLE); goto START; @@ -1478,7 +1478,7 @@ there are units from two nations on the tile */ if (ptile->city && !is_allied_city_tile(ptile, unit_owner(punit))) { if (pcity) - teleport_unit_to_city(punit, pcity, 0, verbose); + (void) teleport_unit_to_city(punit, pcity, 0, verbose); else disband_stack_conflict_unit(punit, verbose); continue; @@ -1497,9 +1497,9 @@ from when we resolve the stack inside a city. */ if (map_distance(x, y, pcity->x, pcity->y) < map_distance(x, y, ccity->x, ccity->y)) - teleport_unit_to_city(cunit, ccity, 0, verbose); + (void) teleport_unit_to_city(cunit, ccity, 0, verbose); else - teleport_unit_to_city(punit, pcity, 0, verbose); + (void) teleport_unit_to_city(punit, pcity, 0, verbose); } else { /* At least one of the unit owners doesn't have any cities; if the other owner has any cities we teleport his units to @@ -1510,12 +1510,12 @@ if (same_pos(x, y, pcity->x, pcity->y)) disband_stack_conflict_unit(cunit, verbose); else - teleport_unit_to_city(punit, pcity, 0, verbose); + (void) teleport_unit_to_city(punit, pcity, 0, verbose); } else if (ccity) { if (same_pos(x, y, ccity->x, ccity->y)) disband_stack_conflict_unit(punit, verbose); else - teleport_unit_to_city(cunit, ccity, 0, verbose); + (void) teleport_unit_to_city(cunit, ccity, 0, verbose); } else { /* Neither unit owners have cities; disband both units. */ @@ -1539,7 +1539,7 @@ struct city *wcity = find_closest_owned_city(unit_owner(wunit), x, y, FALSE, NULL); if (wcity) - teleport_unit_to_city(wunit, wcity, 0, verbose); + (void) teleport_unit_to_city(wunit, wcity, 0, verbose); else disband_stack_conflict_unit(wunit, verbose); goto START; @@ -2223,7 +2223,7 @@ _("Game: %s transported succesfully."), unit_name(punit->type)); - move_unit(punit, city2->x, city2->y, FALSE, FALSE, punit->moves_left); + (void) move_unit(punit, city2->x, city2->y, FALSE, FALSE, punit->moves_left); /* airlift fields have changed. */ send_city_info(city_owner(city1), city1); @@ -2788,7 +2788,7 @@ unit_list_iterate(map_get_tile(x, y)->units, ppatrol) { if (punit != ppatrol && ppatrol->activity == ACTIVITY_PATROL) { - maybe_cancel_patrol_due_to_enemy(ppatrol); + (void) maybe_cancel_patrol_due_to_enemy(ppatrol); } } unit_list_iterate_end; } square_iterate_end;