diff -urd -X freeciv.clean/diff_ignore part_app/common/map.c work/common/map.c --- part_app/common/map.c Fri Feb 22 14:07:32 2002 +++ work/common/map.c Sat Feb 23 13:42:57 2002 @@ -196,7 +196,7 @@ map.tiles = NULL; map.num_continents = 0; map.num_start_positions = 0; - map.fixed_start_positions = 0; + map.fixed_start_positions = FALSE; map.have_specials = FALSE; map.have_rivers_overlay = FALSE; map.have_huts = FALSE; diff -urd -X freeciv.clean/diff_ignore part_app/common/map.h work/common/map.h --- part_app/common/map.h Sat Feb 23 11:20:32 2002 +++ work/common/map.h Sat Feb 23 13:55:35 2002 @@ -171,7 +171,7 @@ bool tinyisles; bool separatepoles; int num_start_positions; - int fixed_start_positions; + bool fixed_start_positions; bool have_specials; bool have_huts; bool have_rivers_overlay; /* only applies if !have_specials */ @@ -318,7 +318,7 @@ bool is_at_coast(int x, int y); bool is_hut_close(int x, int y); bool is_starter_close(int x, int y, int nr, int dist); -bool is_good_tile(int x, int y); +int is_good_tile(int x, int y); bool is_special_close(int x, int y); bool is_sea_usable(int x, int y); int get_tile_food_base(struct tile * ptile); diff -urd -X freeciv.clean/diff_ignore part_app/common/unit.h work/common/unit.h --- part_app/common/unit.h Fri Feb 22 16:37:39 2002 +++ work/common/unit.h Sat Feb 23 16:49:12 2002 @@ -153,7 +153,7 @@ #define unit_list_iterate_safe(unitlist, punit) \ { \ int _size = unit_list_size(&unitlist); \ - if (_size) { \ + if (_size > 0) { \ int *_ids = fc_malloc(sizeof(int) * _size); \ int _i = 0; \ unit_list_iterate(unitlist, punit) { \ Only in work/: out diff -urd -X freeciv.clean/diff_ignore part_app/server/autoattack.c work/server/autoattack.c --- part_app/server/autoattack.c Thu Feb 21 09:51:10 2002 +++ work/server/autoattack.c Sat Feb 23 13:27:18 2002 @@ -111,7 +111,7 @@ * perhaps there is a better algorithm in the ai-package -- fisch */ score = (unit_type(enemy)->defense_strength + (enemy->hp / 2) - + (get_transporter_capacity(enemy) ? 1 : 0)); + + (get_transporter_capacity(enemy) > 0 ? 1 : 0)); if(!best_enemy || score >= best_score) { best_score = score; @@ -212,7 +212,7 @@ city_list_iterate(pplayer->cities, pcity) { /* fasten things up -- fisch */ if ((pcity->city_options & CITYOPT_AUTOATTACK_BITS) != 0 - && !pcity->anarchy) { + && pcity->anarchy == 0) { auto_attack_city(pplayer, pcity); } } diff -urd -X freeciv.clean/diff_ignore part_app/server/barbarian.c work/server/barbarian.c --- part_app/server/barbarian.c Fri Feb 22 16:37:39 2002 +++ work/server/barbarian.c Sat Feb 23 13:28:01 2002 @@ -180,7 +180,7 @@ int i, xu, yu, me; bool alive = TRUE; /* explorer survived */ - if(!game.barbarianrate || (game.year < game.onsetbarbarian)) { + if(game.barbarianrate == 0 || (game.year < game.onsetbarbarian)) { unit_list_iterate(map_get_tile(x, y)->units, punit) { wipe_unit_safe(punit, &myiter); } unit_list_iterate_end; @@ -199,8 +199,8 @@ } adjc_iterate(x, y, x1, y1) { - land_cnt += is_free_land(x1, y1, barbarians); - sea_cnt += is_free_sea(x1, y1, barbarians); + land_cnt += is_free_land(x1, y1, barbarians) ? 1 : 0; + sea_cnt += is_free_sea(x1, y1, barbarians) ? 1 : 0; } adjc_iterate_end; if( land_cnt >= 3 ) { /* enough land, scatter guys around */ @@ -403,7 +403,7 @@ { int i, n; - if(!game.barbarianrate) + if(game.barbarianrate == 0) return; if(game.year < game.onsetbarbarian) diff -urd -X freeciv.clean/diff_ignore part_app/server/cityhand.c work/server/cityhand.c --- part_app/server/cityhand.c Tue Feb 19 12:51:00 2002 +++ work/server/cityhand.c Sat Feb 23 13:31:43 2002 @@ -81,15 +81,15 @@ if(pcity->size<5) return; - if(!pcity->ppl_elvis) + if(pcity->ppl_elvis == 0) return; pcity->ppl_elvis--; } else if(preq->specialist_from==SP_TAXMAN) { - if (!pcity->ppl_taxman) + if (pcity->ppl_taxman == 0) return; pcity->ppl_taxman--; } else if (preq->specialist_from==SP_SCIENTIST) { - if (!pcity->ppl_scientist) + if (pcity->ppl_scientist == 0) return; pcity->ppl_scientist--; } else { @@ -164,15 +164,15 @@ return; } - if (!city_specialists(pcity) + if (city_specialists(pcity) == 0 || get_worker_city(pcity, preq->worker_x, preq->worker_y) != C_TILE_EMPTY) return; server_set_worker_city(pcity, preq->worker_x, preq->worker_y); - if (pcity->ppl_elvis) + if (pcity->ppl_elvis > 0) pcity->ppl_elvis--; - else if (pcity->ppl_scientist) + else if (pcity->ppl_scientist > 0) pcity->ppl_scientist--; else pcity->ppl_taxman--; @@ -250,7 +250,7 @@ return; } - if (pcity->is_building_unit && pcity->anarchy) { + if (pcity->is_building_unit && pcity->anarchy != 0) { notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT, _("Game: Can't buy units when city is in disorder.")); return; @@ -264,7 +264,7 @@ total=improvement_value(pcity->currently_building); } cost=city_buy_cost(pcity); - if ((!cost) || (cost>pplayer->economic.gold)) + if (cost == 0 || cost > pplayer->economic.gold) return; /* @@ -334,7 +334,7 @@ **************************************************************************/ void handle_city_refresh(struct player *pplayer, struct packet_generic_integer *preq) { - if (preq->value) { + if (preq->value != 0) { struct city *pcity = find_city_by_id(preq->value); if (!pcity) diff -urd -X freeciv.clean/diff_ignore part_app/server/citytools.c work/server/citytools.c --- part_app/server/citytools.c Sat Feb 23 10:06:29 2002 +++ work/server/citytools.c Sat Feb 23 13:32:37 2002 @@ -242,7 +242,7 @@ continue; if (get_worker_city(pcity, x, y) == C_TILE_WORKER) { tmp = city_tile_value(pcity, x, y, 0, 0); - if (tmp < worst || !worst) worst = tmp; + if (tmp < worst || worst == 0) worst = tmp; } } city_map_iterate_end; return(worst); @@ -259,7 +259,7 @@ (get_worker_city(pcity, x, y) == C_TILE_WORKER) || can_place_worker_here(pcity, x, y)) { tmp = city_tile_value(pcity, x, y, 0, 0); - if (tmp < best || !best) best = tmp; + if (tmp < best || best == 0) best = tmp; } } city_map_iterate_end; return(best); @@ -686,7 +686,7 @@ struct city *oldtradecity; for (i = 0; i < NUM_TRADEROUTES; i++) { - if (cities[i]) { + if (cities[i] != 0) { oldtradecity = find_city_by_id(cities[i]); assert(oldtradecity != NULL); if (can_establish_trade_route(pcity, oldtradecity)) { @@ -1664,13 +1664,13 @@ int i, tb; for (i = 0; i < NUM_TRADEROUTES; i++) { - if (!pc1->trade[i]) { + if (pc1->trade[i] == 0) { pc1->trade[i]=pc2->id; break; } } for (i = 0; i < NUM_TRADEROUTES; i++) { - if (!pc2->trade[i]) { + if (pc2->trade[i] == 0) { pc2->trade[i]=pc1->id; break; } @@ -1774,7 +1774,7 @@ } /* Tell the player what's up. */ - if (event) + if (event != 0) notify_player_ex(pplayer, pcity->x, pcity->y, event, _("Game: %s is building %s%s."), pcity->name, name, source); diff -urd -X freeciv.clean/diff_ignore part_app/server/cityturn.c work/server/cityturn.c --- part_app/server/cityturn.c Thu Feb 21 09:49:40 2002 +++ work/server/cityturn.c Sat Feb 23 13:36:45 2002 @@ -205,13 +205,13 @@ } } } city_map_iterate_outwards_end; - if (bx || by) { + if (bx != 0 || by != 0) { server_set_worker_city(pcity, bx, by); (*workers)--; /* amazing what this did with no parens! -- Syela */ *foodneed -= city_get_food_tile(bx,by,pcity) - 2; *prodneed -= city_get_shields_tile(bx,by,pcity) - 1; } - } while(*workers && (bx || by)); + } while(*workers != 0 && (bx != 0 || by != 0)); *foodneed += 2 * (*workers - 1 - e); *prodneed += (*workers - 1 - e); if (*prodneed > 0) { @@ -295,13 +295,13 @@ worker_loop(pcity, &foodneed, &prodneed, &workers); - while (workers && (taxwanted ||sciwanted)) { - if (taxwanted) { + while (workers > 0 && (taxwanted > 0 || sciwanted > 0)) { + if (taxwanted > 0) { workers--; pcity->ppl_taxman++; taxwanted--; } - if (sciwanted && workers) { + if (sciwanted > 0 && workers > 0) { workers--; pcity->ppl_scientist++; sciwanted--; @@ -441,13 +441,13 @@ pcity->food_stock = city_granary_size(pcity->size); } - while (pop_loss > 0 && city_specialists(pcity)) { - if(pcity->ppl_taxman) { + while (pop_loss > 0 && city_specialists(pcity) > 0) { + if(pcity->ppl_taxman > 0) { pcity->ppl_taxman--; - } else if(pcity->ppl_scientist) { + } else if(pcity->ppl_scientist > 0) { pcity->ppl_scientist--; } else { - assert(pcity->ppl_elvis); + assert(pcity->ppl_elvis > 0); pcity->ppl_elvis--; } pop_loss--; @@ -488,7 +488,7 @@ } /* Granary can only hold so much */ new_food = (city_granary_size(pcity->size) * - (100 - game.aqueductloss/(1+has_granary))) / 100; + (100 - game.aqueductloss / (1 + (has_granary ? 1 : 0)))) / 100; pcity->food_stock = MIN(pcity->food_stock, new_food); return; } @@ -507,7 +507,7 @@ } /* Granary can only hold so much */ new_food = (city_granary_size(pcity->size) * - (100 - game.aqueductloss/(1+has_granary))) / 100; + (100 - game.aqueductloss / (1 + (has_granary ? 1 : 0)))) / 100; pcity->food_stock = MIN(pcity->food_stock, new_food); return; } @@ -882,7 +882,7 @@ while (pcity->shield_surplus < 0) { unit_list_iterate(pcity->units_supported, punit) { - if (utype_shield_cost(unit_type(punit), g)) { + if (utype_shield_cost(unit_type(punit), g) > 0) { notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_LOST, _("Game: %s can't upkeep %s, unit disbanded."), pcity->name, unit_type(punit)->name); @@ -1112,8 +1112,8 @@ static void check_pollution(struct city *pcity) { int k=100; - if (pcity->pollution && myrand(100)<=pcity->pollution) { - while (k) { + if (pcity->pollution != 0 && myrand(100) <= pcity->pollution) { + while (k > 0) { /* place pollution somewhere in city radius */ int cx = myrand(CITY_MAP_SIZE); int cy = myrand(CITY_MAP_SIZE); @@ -1185,7 +1185,7 @@ dist=32; if (city_got_building(pcity, B_COURTHOUSE)) dist/=2; - if (g->fixed_corruption_distance) + if (g->fixed_corruption_distance != 0) dist = MIN(g->fixed_corruption_distance, dist); pcity->incite_revolt_cost/=(dist + 3); pcity->incite_revolt_cost*=pcity->size; @@ -1246,7 +1246,7 @@ /* the AI often has widespread disorder when the Gardens or Oracle become obsolete. This is a quick hack to prevent this. 980805 -- Syela */ while (pplayer->ai.control && city_unhappy(pcity)) { - if (!ai_make_elvis(pcity)) break; + if (ai_make_elvis(pcity) == 0) break; } /* putting this lower in the routine would basically be cheating. -- Syela */ /* reporting of celebrations rewritten, copying the treatment of disorder below, @@ -1262,7 +1262,7 @@ pcity->name); } else { - if (pcity->rapture) + if (pcity->rapture != 0) notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_NORMAL, _("Game: We Love The %s Day canceled in %s."), get_ruler_title(pplayer->government, pplayer->is_male, @@ -1303,7 +1303,7 @@ pcity->name); } else { - if (pcity->anarchy) + if (pcity->anarchy != 0) notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_NORMAL, _("Game: Order restored in %s."), pcity->name); pcity->anarchy=0; diff -urd -X freeciv.clean/diff_ignore part_app/server/diplomats.c work/server/diplomats.c --- part_app/server/diplomats.c Tue Feb 19 12:51:00 2002 +++ work/server/diplomats.c Sat Feb 23 13:38:36 2002 @@ -565,7 +565,7 @@ freelog (LOG_DEBUG, "steal-tech: count of technologies: %d", count); /* Determine the target (-1 is future tech). */ - if (!count) { + if (count == 0) { /* * Either only future-tech or nothing to steal: * If nothing to steal, say so, deduct movement cost and return. @@ -911,7 +911,7 @@ * Won't pick something that doesn't exit. * If nothing to do, say so, deduct movement cost and return. */ - if (!count && (!(pcity->shield_stock))) { + if (count == 0 && pcity->shield_stock == 0) { notify_player_ex (pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT, _("Game: Your %s could not find anything to" " sabotage in %s."), @@ -921,7 +921,7 @@ freelog (LOG_DEBUG, "sabotage: random: nothing to do"); return; } - if (!count || myrand (2)) { + if (count == 0 || myrand (2) == 1) { target = -1; freelog (LOG_DEBUG, "sabotage: random: targeted production: %d", target); } else { @@ -1009,7 +1009,7 @@ */ capital = find_palace (city_owner (pcity)); if ((pcity == capital) || (improvement == B_CITY)) { - if (myrand (2)) { + if (myrand (2) == 1) { /* Caught! */ notify_player_ex (pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT, _("Game: Your %s was caught in the attempt" @@ -1346,7 +1346,7 @@ } else dist=32; - if (g->fixed_corruption_distance) + if (g->fixed_corruption_distance != 0) dist = MIN(g->fixed_corruption_distance, dist); cost=(cost/(dist+2))*(unit_type(punit)->build_cost/10); /* FIXME: This is a weird one - should be replaced */ diff -urd -X freeciv.clean/diff_ignore part_app/server/gamehand.c work/server/gamehand.c --- part_app/server/gamehand.c Thu Feb 21 15:36:49 2002 +++ work/server/gamehand.c Sat Feb 23 13:38:50 2002 @@ -234,7 +234,7 @@ ginfo.global_wonders[i] = game.global_wonders[i]; /* the following values are computed every time a packet_game_info packet is created */ - if (game.timeout) + if (game.timeout != 0) ginfo.seconds_to_turndone = game.turn_start + game.timeout - time(NULL); diff -urd -X freeciv.clean/diff_ignore part_app/server/gotohand.c work/server/gotohand.c --- part_app/server/gotohand.c Fri Feb 22 14:07:32 2002 +++ work/server/gotohand.c Sat Feb 23 14:16:14 2002 @@ -333,7 +333,7 @@ move_cost = igter ? MOVE_COST_ROAD : MIN(base_cost, unit_type(punit)->move_rate); } else if (igter) /* NOT c = 1 (Syela) [why not? - Thue] */ - move_cost = (ptile->move_cost[dir] ? SINGLE_MOVE : 0); + move_cost = (ptile->move_cost[dir] != 0 ? SINGLE_MOVE : 0); else if (punit) move_cost = MIN(ptile->move_cost[dir], unit_type(punit)->move_rate); /* else c = ptile->move_cost[k]; @@ -661,7 +661,7 @@ int base_cost = get_tile_type(pdesttile->terrain)->movement_cost * SINGLE_MOVE; move_cost = igter ? 1 : MIN(base_cost, unit_type(punit)->move_rate); } else if (igter) - move_cost = (psrctile->move_cost[dir] ? SINGLE_MOVE : 0); + move_cost = (psrctile->move_cost[dir] != 0 ? SINGLE_MOVE : 0); else move_cost = MIN(psrctile->move_cost[dir], unit_type(punit)->move_rate); @@ -846,7 +846,7 @@ if ((restriction == GOTO_MOVE_CARDINAL_ONLY) && !DIR_IS_CARDINAL(dir)) continue; - if (local_vector[x][y] & (1<x, punit->y, dest_x, dest_y, &dir) - && warmap.vector[punit->x][punit->y] & (1 << dir) + && TEST_BIT(warmap.vector[punit->x][punit->y], dir) && !(restriction == GOTO_MOVE_CARDINAL_ONLY && !DIR_IS_CARDINAL(dir))) { return dir; @@ -958,7 +958,7 @@ /* * Is it an allowed direction? is it marked on the warmap? */ - if (!(warmap.vector[punit->x][punit->y] & (1 << dir)) + if (!TEST_BIT(warmap.vector[punit->x][punit->y], dir) || ((restriction == GOTO_MOVE_CARDINAL_ONLY) && !DIR_IS_CARDINAL(dir))) { /* make sure we don't select it later */ @@ -1107,7 +1107,7 @@ } attack_of_enemy = get_attack_power(aunit); - if (!attack_of_enemy) { + if (attack_of_enemy == 0) { continue; } @@ -1145,7 +1145,7 @@ * Clip the fitness value. */ if (fitness[dir] < 1 && (!unit_owner(punit)->ai.control - || !punit->ai.passenger + || punit->ai.passenger == 0 || punit->moves_left >= 2 * SINGLE_MOVE)) { fitness[dir] = 1; } diff -urd -X freeciv.clean/diff_ignore part_app/server/handchat.c work/server/handchat.c --- part_app/server/handchat.c Tue Feb 19 12:51:00 2002 +++ work/server/handchat.c Sat Feb 23 13:44:25 2002 @@ -163,7 +163,7 @@ genmsg.x = -1; genmsg.y = -1; genmsg.event =-1; - for(cp=packet->message; *cp; ++cp) + for(cp=packet->message; *cp != '\0'; ++cp) if(!isprint(*cp & 0x7f)) { *cp='\0'; break;