diff -urd -X freeciv.clean/diff_ignore part_app/client/agents/agents.c work/client/agents/agents.c --- part_app/client/agents/agents.c Tue Feb 19 17:00:41 2002 +++ work/client/agents/agents.c Sat Feb 23 12:30:20 2002 @@ -273,8 +273,8 @@ ***********************************************************************/ static bool is_outstanding_request(struct my_agent *agent) { - if (agent->first_outstanding_request_id && - aconnection.client.request_id_of_currently_handled_packet && + if (agent->first_outstanding_request_id != 0 && + aconnection.client.request_id_of_currently_handled_packet != 0 && agent->first_outstanding_request_id <= aconnection.client.request_id_of_currently_handled_packet && agent->last_outstanding_request_id >= diff -urd -X freeciv.clean/diff_ignore part_app/client/agents/cma_core.c work/client/agents/cma_core.c --- part_app/client/agents/cma_core.c Sat Feb 23 10:06:29 2002 +++ work/client/agents/cma_core.c Sat Feb 23 12:33:32 2002 @@ -533,7 +535,7 @@ if ((pcity->city_map[x][y] == C_TILE_WORKER) && !result->worker_positions_used[x][y]) { last_request_id = set_worker(pcity, x, y, FALSE); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } @@ -546,7 +548,7 @@ packet.specialist_to = SP_ELVIS; last_request_id = send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE_SPECIALIST); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } @@ -557,7 +559,7 @@ packet.specialist_to = SP_ELVIS; last_request_id = send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE_SPECIALIST); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } @@ -569,7 +571,7 @@ if (result->worker_positions_used[x][y] && pcity->city_map[x][y] != C_TILE_WORKER) { last_request_id = set_worker(pcity, x, y, TRUE); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } @@ -582,7 +584,7 @@ packet.specialist_to = SP_SCIENTIST; last_request_id = send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE_SPECIALIST); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } @@ -593,12 +595,12 @@ packet.specialist_to = SP_TAXMAN; last_request_id = send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE_SPECIALIST); - if (!first_request_id) { + if (first_request_id == 0) { first_request_id = last_request_id; } } - if (!last_request_id && ALWAYS_APPLY_AT_SERVER) { + if (last_request_id == 0 && ALWAYS_APPLY_AT_SERVER) { struct packet_generic_integer packet; packet.value = pcity->id; @@ -610,7 +612,7 @@ connection_do_unbuffer(&aconnection); - if (last_request_id) { + if (last_request_id != 0) { wait_for_requests("CMA", first_request_id, last_request_id); } @@ -643,7 +645,9 @@ my_city_map_iterate(pcity, x, y) { result->worker_positions_used[x][y] = (pcity->city_map[x][y] == C_TILE_WORKER); - worker += result->worker_positions_used[x][y]; + if (result->worker_positions_used[x][y]) { + worker++; + } } my_city_map_iterate_end; diff -urd -X freeciv.clean/diff_ignore part_app/client/agents/cma_fec.c work/client/agents/cma_fec.c --- part_app/client/agents/cma_fec.c Tue Feb 19 17:05:12 2002 +++ work/client/agents/cma_fec.c Sat Feb 23 12:33:51 2002 @@ -75,7 +75,7 @@ if (!preset_list_has_been_initialized) { preset_list_init(&preset_list); - preset_list_has_been_initialized = 1; + preset_list_has_been_initialized = TRUE; } memset(&self, 0, sizeof(self)); diff -urd -X freeciv.clean/diff_ignore part_app/client/civclient.c work/client/civclient.c --- part_app/client/civclient.c Thu Feb 21 09:20:28 2002 +++ work/client/civclient.c Sat Feb 23 11:44:09 2002 @@ -585,7 +585,7 @@ **************************************************************************/ static void client_remove_all_cli_conn(void) { - while (conn_list_size(&game.all_connections)) { + while (conn_list_size(&game.all_connections) > 0) { struct connection *pconn = conn_list_get(&game.all_connections, 0); client_remove_cli_conn(pconn); } diff -urd -X freeciv.clean/diff_ignore part_app/client/climisc.c work/client/climisc.c --- part_app/client/climisc.c Thu Feb 21 15:36:48 2002 +++ work/client/climisc.c Sat Feb 23 11:51:33 2002 @@ -380,12 +380,12 @@ ***************************************************************************/ char *get_vision_status(struct player *me, struct player *them) { - if (me->gives_shared_vision & (1<player_no)) { - if (them->gives_shared_vision & (1<player_no)) + if (gives_shared_vision(me, them)) { + if (gives_shared_vision(them, me)) return Q_("?vision:Both"); else return Q_("?vision:To Them"); - } else if (them->gives_shared_vision & (1<player_no)) + } else if (gives_shared_vision(them, me)) return Q_("?vision:To Us"); else return ""; @@ -538,7 +538,7 @@ /* Just any known tile will do; search near the middle first. */ iterate_outward(map.xsize / 2, map.ysize / 2, MAX(map.xsize / 2, map.ysize / 2), x, y) { - if (tile_get_known(x, y)) { + if (tile_get_known(x, y) != TILE_UNKNOWN) { center_tile_mapcanvas(x, y); goto OUT; } @@ -569,7 +569,7 @@ unit_list_iterate(ptile->units, punit) { mr = get_unit_type(punit->type)->move_rate; - au = mr ? mr / SINGLE_MOVE : 1; + au = (mr > 0) ? mr / SINGLE_MOVE : 1; activity_total[punit->activity] += punit->activity_count; if (punit->moves_left > 0) { /* current turn */ @@ -580,8 +580,8 @@ unit_list_iterate_end; for (i = 0; i < ACTIVITY_LAST; i++) { - if (is_build_or_clean_activity(i) && activity_units[i]) { - if (num_activities) + if (is_build_or_clean_activity(i) && activity_units[i] > 0) { + if (num_activities > 0) mystrlcat(buf, "/", buf_size); remains = map_activity_time(i, x, y) - activity_total[i]; if (remains > 0) { @@ -825,7 +825,7 @@ memset(mapping, 0, sizeof(mapping)); city_list_iterate(game.player_ptr->cities, pcity) { - mapping[cid_encode_from_city(pcity)] = 1; + mapping[cid_encode_from_city(pcity)] = TRUE; } city_list_iterate_end; @@ -920,7 +920,7 @@ assert(pcity != NULL); for (id = 0; id < game.num_impr_types; id++) { - if (pcity->improvements[id]) { + if (pcity->improvements[id] != 0) { dest_cids[cids_used] = cid_encode(FALSE, id); cids_used++; } @@ -1078,7 +1078,7 @@ "Year of arrival: 1234 AD"); } - if (pship->propulsion) { + if (pship->propulsion > 0) { my_snprintf(travel_buf, sizeof(travel_buf), _("Travel time: %5.1f years"), (float) (0.1 * ((int) (pship->travel_time * 10.0)))); diff -urd -X freeciv.clean/diff_ignore part_app/client/clinet.c work/client/clinet.c --- part_app/client/clinet.c Thu Feb 21 15:36:48 2002 +++ work/client/clinet.c Sat Feb 23 11:52:15 2002 @@ -249,7 +249,7 @@ fd_set readfs, writefs, exceptfs; int socket_fd = pc->sock; bool have_data_for_server = (pc->used && pc->send_buffer - && pc->send_buffer->ndata); + && pc->send_buffer->ndata > 0); int n; struct timeval tv; @@ -482,7 +482,7 @@ char *s; if ((s = strchr(server,':'))) { port = atoi(&s[1]); - if (!port) { + if (port == 0) { port = 80; } s[0] = '\0'; @@ -498,7 +498,7 @@ if (s[0] == '/') { s[0] = '\0'; ++s; - } else if (s[0]) { + } else if (s[0] != '\0') { mystrlcpy(errbuf, _("Invalid $http_proxy value, cannot find separating '/'"), n_errbuf); diff -urd -X freeciv.clean/diff_ignore part_app/client/control.c work/client/control.c --- part_app/client/control.c Thu Feb 21 15:36:48 2002 +++ work/client/control.c Sat Feb 23 12:21:21 2002 @@ -302,14 +302,14 @@ (always return first in stack). */ unit_list_iterate(ptile->units, punit) if (unit_owner(punit) == game.player_ptr) { - if (get_transporter_capacity(punit)) { + if (get_transporter_capacity(punit) > 0) { return punit; } else if (!panyowned) { panyowned = punit; } } else if (!ptptother && player_can_see_unit(game.player_ptr, punit)) { - if (get_transporter_capacity(punit)) { + if (get_transporter_capacity(punit) > 0) { ptptother = punit; } else if (!panyother) { panyother = punit; @@ -380,7 +380,7 @@ return; } - while (genlist_size(&arrival_queue)) { + while (genlist_size(&arrival_queue) > 0) { int id; p_id = genlist_get(&arrival_queue, 0); @@ -422,7 +422,7 @@ is_init_arrival_queue = TRUE; } - if (pdiplomat && victim_id) { + if (pdiplomat && victim_id != 0) { p_ids = fc_malloc(2*sizeof(int)); p_ids[0] = pdiplomat->id; p_ids[1] = victim_id; @@ -434,7 +434,7 @@ return; } - while (genlist_size(&arrival_queue)) { + while (genlist_size(&arrival_queue) > 0) { int diplomat_id, victim_id; struct city *pcity; struct unit *punit; @@ -516,7 +516,7 @@ { struct packet_unit_request req; - if(!get_transporter_capacity(punit)) { + if(get_transporter_capacity(punit) == 0) { append_output_window(_("Game: Only transporter units can be unloaded.")); return; } @@ -696,7 +696,7 @@ if ((game.rgame.pillage_select) && ((pspresent & (~(psworking | would))) != S_NO_SPECIAL)) { - popup_pillage_dialog(punit, pspresent & (~psworking)); + popup_pillage_dialog(punit, (pspresent & (~psworking)) != S_NO_SPECIAL); } else { request_new_unit_activity_targeted(punit, ACTIVITY_PILLAGE, what); } @@ -1217,7 +1217,7 @@ { struct unit *punit = player_find_unit_by_id(game.player_ptr, hover_unit); - if (!hover_unit || hover_state != HOVER_GOTO) + if (hover_unit == 0 || hover_state != HOVER_GOTO) return; if (punit) { diff -urd -X freeciv.clean/diff_ignore part_app/client/goto.c work/client/goto.c --- part_app/client/goto.c Thu Feb 21 15:36:49 2002 +++ work/client/goto.c Sat Feb 23 11:56:13 2002 @@ -352,7 +352,7 @@ move_cost += MOVE_COST_ROAD; /* Rather arbitrary deterrent */ } } else if (igter) { - move_cost = (psrctile->move_cost[dir] ? MOVE_COST_ROAD : 0); + move_cost = ((psrctile->move_cost[dir] != 0) ? MOVE_COST_ROAD : 0); } else { move_cost = MIN(psrctile->move_cost[dir], unit_type(punit)->move_rate); @@ -581,7 +581,7 @@ { assert(is_active); - if (goto_array_index) { + if (goto_array_index != 0) { *x = goto_array[goto_array_index-1].x; *y = goto_array[goto_array_index-1].y; } else { @@ -750,7 +750,7 @@ } adjc_dir_iterate(x, y, new_x, new_y, dir) { - if (goto_map.vector[x][y] & (1<topic, tb = hb->topic; *ta && *tb; ta++, tb++) { + for (ta = ha->topic, tb = hb->topic; *ta != '\0' && *tb != '\0'; ta++, tb++) { if (*ta != ' ') { if (*tb == ' ') return -1; break; @@ -265,7 +265,7 @@ } } else if(current_type==HELP_TERRAIN) { for(i=T_FIRST; itopic = mystrdup(name); @@ -703,12 +703,12 @@ sprintf(buf+strlen(buf), _("turn in a city, or on a Carrier")); if (unit_type_flag(i, F_MISSILE) && num_role_units(F_MISSILE_CARRIER)>0 && - get_unit_type(get_role_unit(F_MISSILE_CARRIER,0))->transport_capacity) { + get_unit_type(get_role_unit(F_MISSILE_CARRIER,0))->transport_capacity > 0) { sprintf(buf+strlen(buf), _(" or Submarine")); } sprintf(buf+strlen(buf), _(", or will run out of fuel and be lost.\n")); } - if (strlen(buf)) { + if (strlen(buf) > 0) { sprintf(buf+strlen(buf), "\n"); } if (utype->helptext) { @@ -854,25 +854,29 @@ static char buf[128]; struct unit_type *utype = get_unit_type(i); - if (utype->shield_cost || utype->food_cost - || utype->gold_cost || utype->happy_cost) { + if (utype->shield_cost > 0 || utype->food_cost > 0 + || utype->gold_cost > 0 || utype->happy_cost > 0) { int any = 0; buf[0] = '\0'; - if (utype->shield_cost) { + if (utype->shield_cost > 0) { sprintf(buf+strlen(buf), _("%s%d shield"), - (any++ ? ", " : ""), utype->shield_cost); + (any > 0 ? ", " : ""), utype->shield_cost); + any++; } - if (utype->food_cost) { + if (utype->food_cost > 0) { sprintf(buf+strlen(buf), _("%s%d food"), - (any++ ? ", " : ""), utype->food_cost); + (any > 0 ? ", " : ""), utype->food_cost); + any++; } - if (utype->happy_cost) { + if (utype->happy_cost > 0) { sprintf(buf+strlen(buf), _("%s%d unhappy"), - (any++ ? ", " : ""), utype->happy_cost); + (any > 0 ? ", " : ""), utype->happy_cost); + any++; } - if (utype->gold_cost) { + if (utype->gold_cost > 0) { sprintf(buf+strlen(buf), _("%s%d gold"), - (any++ ? ", " : ""), utype->gold_cost); + (any > 0 ? ", " : ""), utype->gold_cost); + any++; } } else { /* strcpy(buf, _("None")); */ diff -urd -X freeciv.clean/diff_ignore part_app/client/mapview_common.c work/client/mapview_common.c --- part_app/client/mapview_common.c Tue Feb 19 16:52:50 2002 +++ work/client/mapview_common.c Sat Feb 23 12:09:58 2002 @@ -57,7 +57,7 @@ normalize_map_pos(&x2, &y2); assert(is_tiles_adjacent(x1, y1, x2, y2)); - if (!map_get_tile(x2, y2)->known) { + if (map_get_tile(x2, y2)->known == TILE_UNKNOWN) { return COLOR_STD_BLACK; } diff -urd -X freeciv.clean/diff_ignore part_app/client/packhand.c work/client/packhand.c --- part_app/client/packhand.c Thu Feb 21 15:36:49 2002 +++ work/client/packhand.c Sat Feb 23 12:16:11 2002 @@ -67,7 +67,7 @@ #include "packhand.h" -static void handle_city_packet_common(struct city *pcity, int is_new, +static void handle_city_packet_common(struct city *pcity, bool is_new, bool popup, bool investigate); #define TEST_ATTRIBUTES 0 @@ -492,7 +492,7 @@ /************************************************************************** ... **************************************************************************/ -static void handle_city_packet_common(struct city *pcity, int is_new, +static void handle_city_packet_common(struct city *pcity, bool is_new, bool popup, bool investigate) { int i; @@ -774,11 +774,11 @@ } else if (packet->event >= 0) { where = messages_where[packet->event]; } - if (where & MW_OUTPUT) + if (BOOL_VAL(where & MW_OUTPUT)) append_output_window(packet->message); - if (where & MW_MESSAGES) + if (BOOL_VAL(where & MW_MESSAGES)) add_notify_window(packet); - if ((where & MW_POPUP) && + if (BOOL_VAL(where & MW_POPUP) && (!game.player_ptr->ai.control || ai_popup_windows)) popup_notify_goto_dialog(_("Popup Request"), packet->message, packet->x, packet->y); @@ -1144,8 +1144,8 @@ boot_help = (get_client_state() == CLIENT_GAME_RUNNING_STATE && game.spacerace != pinfo->spacerace); game.spacerace=pinfo->spacerace; - if (game.timeout) { - if (pinfo->seconds_to_turndone) + if (game.timeout != 0) { + if (pinfo->seconds_to_turndone != 0) seconds_to_turndone = pinfo->seconds_to_turndone; } else seconds_to_turndone = 0; @@ -1279,7 +1279,7 @@ freelog(LOG_DEBUG, "conn_info \"%s\" \"%s\" \"%s\"", pinfo->name, pinfo->addr, pinfo->capability); - if (pinfo->used==0) { + if (!pinfo->used) { /* Forget the connection */ if (!pconn) { freelog(LOG_VERBOSE, "Server removed unknown connection %d", pinfo->id); diff -urd -X freeciv.clean/diff_ignore part_app/common/packets.c work/common/packets.c --- part_app/common/packets.c Sat Feb 23 11:20:32 2002 +++ work/common/packets.c Sat Feb 23 12:23:14 2002 @@ -3748,7 +3748,7 @@ cptr=put_uint8(cptr, packet->leader_count); for( i=0; ileader_count; i++ ) { cptr=put_string(cptr, packet->leader_name[i]); - cptr=put_uint8(cptr, packet->leader_sex[i]); + cptr=put_bool8(cptr, packet->leader_sex[i]); } cptr=put_uint8(cptr, packet->city_style); if (has_capability("init_techs", pc->capability)) { @@ -3782,7 +3782,7 @@ iget_uint8(&iter, &packet->leader_count); for( i=0; ileader_count; i++ ) { iget_string(&iter, packet->leader_name[i], sizeof(packet->leader_name[i])); - iget_uint8(&iter, &packet->leader_sex[i]); + iget_bool8(&iter, &packet->leader_sex[i]); } iget_uint8(&iter, &packet->city_style); if (has_capability("init_techs", pc->capability)) { diff -urd -X freeciv.clean/diff_ignore part_app/common/packets.h work/common/packets.h --- part_app/common/packets.h Sat Feb 23 11:20:32 2002 +++ work/common/packets.h Sat Feb 23 12:17:02 2002 @@ -767,7 +767,7 @@ int leader_count; char leader_name[MAX_NUM_LEADERS][MAX_LEN_NAME]; - int leader_sex[MAX_NUM_LEADERS]; + bool leader_sex[MAX_NUM_LEADERS]; int city_style; int init_techs[MAX_NUM_TECH_LIST]; }; diff -urd -X freeciv.clean/diff_ignore part_app/common/player.c work/common/player.c --- part_app/common/player.c Sat Feb 23 11:20:32 2002 +++ work/common/player.c Sat Feb 23 11:47:46 2002 @@ -582,3 +582,11 @@ { return pplayer->ai.barbarian_type != NOT_A_BARBARIAN; } + +/************************************************************************** + Return TRUE iff the player me gives shared vision to player them. +**************************************************************************/ +bool gives_shared_vision(struct player *me, struct player *them) +{ + return TEST_BIT(me->gives_shared_vision, them->player_no); +} diff -urd -X freeciv.clean/diff_ignore part_app/common/player.h work/common/player.h --- part_app/common/player.h Thu Feb 21 09:39:48 2002 +++ work/common/player.h Sat Feb 23 11:46:10 2002 @@ -243,6 +243,8 @@ bool is_barbarian(const struct player *pplayer); +bool gives_shared_vision(struct player *me, struct player *them); + #define players_iterate(PI_player) \ { \ struct player *PI_player; \