? diff ? barbarian_type1.diff ? diff2 ? client/gui-gtk/stZo2QSL ? common/bool.h Index: ai/aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.166 diff -u -r1.166 aiunit.c --- ai/aiunit.c 2002/02/11 13:55:44 1.166 +++ ai/aiunit.c 2002/02/11 19:36:18 @@ -235,7 +235,7 @@ if (!player_find_unit_by_id(pplayer, id)) return 0; /* died */ - if (punit->moves_left) { + if (punit->moves_left > 0) { if (punit->x == best_x && punit->y == best_y) { return ai_manage_explorer(punit); } else { @@ -253,7 +253,7 @@ /* BEGIN PART TWO: Move into unexplored territory */ /* move the unit as long as moving will unveil unknown territory */ - while (punit->moves_left) { + while (punit->moves_left > 0) { int most_unknown = 0; int unknown; @@ -292,7 +292,7 @@ } } - if (!punit->moves_left) return 1; + if (punit->moves_left == 0) return 1; /* BEGIN PART THREE: Go towards unexplored territory */ /* no adjacent squares help us to explore - really slow part follows */ @@ -332,7 +332,7 @@ punit->goto_dest_y = best_y; handle_unit_activity_request(punit, ACTIVITY_GOTO); do_unit_goto(punit, GOTO_MOVE_ANY, 0); - if (punit->moves_left) { + if (punit->moves_left > 0) { if (punit->x != best_x || punit->y != best_y) { handle_unit_activity_request(punit, ACTIVITY_IDLE); return 1; /* Something wrong; what to do but return? */ @@ -917,7 +917,7 @@ } } } - if (goto_is_sane(punit, dest_x, dest_y, TRUE) && punit->moves_left && + if (goto_is_sane(punit, dest_x, dest_y, TRUE) && punit->moves_left > 0 && (!ferryboat || (real_map_distance(punit->x, punit->y, dest_x, dest_y) < 3 && (!punit->ai.bodyguard || unit_list_find(&(map_get_tile(punit->x, @@ -942,7 +942,7 @@ freelog(LOG_DEBUG, "Bodyguard at (%d, %d) is adjacent to (%d, %d)", i, j, punit->x, punit->y); - if (aunit->moves_left) return(0); + if (aunit->moves_left > 0) return(0); else return handle_unit_move_request(punit, i, j, FALSE, FALSE); } } unit_list_iterate_end; @@ -1515,7 +1515,7 @@ /* you can still have some moves left here, but barbarians should not sit helplessly, but advance towards nearest known enemy city */ punit = find_unit_by_id(id); /* unit might die while exploring */ - if( punit && punit->moves_left && is_barbarian(pplayer) ) { + if( punit && punit->moves_left > 0 && is_barbarian(pplayer) ) { struct city *pc; int fx, fy; freelog(LOG_DEBUG,"Barbarians looking for target"); @@ -1539,7 +1539,7 @@ /* if what we want to kill is adjacent, and findvictim didn't want it, WAIT! */ if ((went = ai_military_gothere(pplayer, punit, dest_x, dest_y))) { if (went > 0) { - flag = punit->moves_left; + flag = punit->moves_left > 0; } else { punit = NULL; } @@ -1551,7 +1551,7 @@ punit->x, punit->y, dest_x, dest_y); handle_unit_move_request(punit, dest_x, dest_y, FALSE, FALSE); punit = find_unit_by_id(id); - if (punit) flag = punit->moves_left; else flag = 0; + if (punit) flag = punit->moves_left > 0; else flag = 0; } if (punit) if (stay_and_defend_city(punit)) return; @@ -1575,7 +1575,7 @@ if ((pcity = wonder_on_continent(pplayer, map_get_continent(punit->x, punit->y))) && build_points_left(pcity) > (pcity->shield_surplus*2)) { if (!same_pos(pcity->x, pcity->y, punit->x, punit->y)) { - if (!punit->moves_left) return; + if (punit->moves_left == 0) return; auto_settler_do_goto(pplayer,punit, pcity->x, pcity->y); handle_unit_activity_request(punit, ACTIVITY_IDLE); } else { @@ -1608,7 +1608,7 @@ pcity=player_find_city_by_id(pplayer, best_city); if (pcity) { if (!same_pos(pcity->x, pcity->y, punit->x, punit->y)) { - if (!punit->moves_left) return; + if (punit->moves_left == 0) return; auto_settler_do_goto(pplayer,punit, pcity->x, pcity->y); } else { req.unit_id = punit->id; @@ -1661,7 +1661,7 @@ if (p) { 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 && n) + if (punit->moves_left > 0 && n) do_unit_goto(punit, GOTO_MOVE_ANY, 0); else if (!n && !map_get_city(punit->x, punit->y)) { /* rest in a city, for unhap */ x = punit->goto_dest_x; y = punit->goto_dest_y; @@ -1695,7 +1695,7 @@ if (unit_type(punit)->attack_strength > unit_type(punit)->transport_capacity) { - if (punit->moves_left) ai_manage_military(pplayer, punit); + if (punit->moves_left > 0) ai_manage_military(pplayer, punit); return; } /* AI used to build frigates to attack and then use them as ferries -- Syela */ @@ -1726,7 +1726,7 @@ /* do cool stuff here */ - if (!punit->moves_left) return; + if (punit->moves_left == 0) return; pcity = find_city_by_id(punit->homecity); if (pcity) { if (!ai_handicap(pplayer, H_TARGETS) || @@ -1808,7 +1808,7 @@ punit->activity != ACTIVITY_GOTO) handle_unit_activity_request(punit, ACTIVITY_IDLE); - if (punit->moves_left) { + if (punit->moves_left > 0) { if (unit_list_find(&(map_get_tile(punit->x, punit->y)->units), punit->ai.ferryboat)) handle_unit_activity_request(punit, ACTIVITY_SENTRY); @@ -1875,7 +1875,7 @@ return; } else if (unit_flag(punit, F_SETTLERS) ||unit_flag(punit, F_CITIES)) { - if (!punit->moves_left) return; /* can't do anything with no moves */ + if (punit->moves_left == 0) return; /* can't do anything with no moves */ ai_manage_settler(pplayer, punit); return; } else if (unit_flag(punit, F_CARAVAN)) { @@ -1888,11 +1888,11 @@ ai_manage_ferryboat(pplayer, punit); return; } else if (is_military_unit(punit)) { - if (!punit->moves_left) return; /* can't do anything with no moves */ + if (punit->moves_left == 0) return; /* can't do anything with no moves */ ai_manage_military(pplayer,punit); return; } else { - if (!punit->moves_left) return; /* can't do anything with no moves */ + if (punit->moves_left == 0) return; /* can't do anything with no moves */ ai_manage_explorer(punit); /* what else could this be? -- Syela */ return; } Index: client/climisc.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v retrieving revision 1.78 diff -u -r1.78 climisc.c --- client/climisc.c 2002/02/11 10:37:39 1.78 +++ client/climisc.c 2002/02/11 19:36:19 @@ -570,7 +570,7 @@ mr = get_unit_type(punit->type)->move_rate; au = mr ? mr / SINGLE_MOVE : 1; activity_total[punit->activity] += punit->activity_count; - if (punit->moves_left) { + if (punit->moves_left > 0) { /* current turn */ activity_total[punit->activity] += au; } Index: client/control.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/control.c,v retrieving revision 1.67 diff -u -r1.67 control.c --- client/control.c 2002/02/11 10:37:40 1.67 +++ client/control.c 2002/02/11 19:36:20 @@ -242,7 +242,7 @@ unit_list_iterate(game.player_ptr->units, punit) { if(punit!=punit_focus) { if(punit->focus_status==FOCUS_AVAIL && punit->activity==ACTIVITY_IDLE && - punit->moves_left && !punit->ai.control) { + punit->moves_left > 0 && !punit->ai.control) { int d; d=sq_map_distance(punit->x, punit->y, x, y); if(dmoves_left)) + if(punit->moves_left == 0) do_unit_nuke(punit); else { set_hover_state(punit, HOVER_NUKE); Index: common/unit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v retrieving revision 1.143 diff -u -r1.143 unit.c --- common/unit.c 2002/02/11 13:55:50 1.143 +++ common/unit.c 2002/02/11 19:36:36 @@ -84,7 +84,7 @@ && !same_pos(pdiplomat->x, pdiplomat->y, destx, desty)) return FALSE; - if(!pdiplomat->moves_left) + if(pdiplomat->moves_left == 0) return FALSE; return TRUE; @@ -160,7 +160,7 @@ { struct city *city1; - if(!punit->moves_left) + if(punit->moves_left == 0) return FALSE; if(!(city1=map_get_city(punit->x, punit->y))) return FALSE; @@ -430,7 +430,7 @@ if (!pcity) { if (!is_build) return AB_NOT_BUILD_UNIT; - if (!punit->moves_left) + if (punit->moves_left == 0) return AB_NO_MOVES_BUILD; if (!city_can_be_built_here(punit->x, punit->y)) return AB_NOT_BUILD_LOC; @@ -441,7 +441,7 @@ if (!is_add) return AB_NOT_ADDABLE_UNIT; - if (!punit->moves_left) + if (punit->moves_left == 0) return AB_NO_MOVES_ADD; assert(unit_pop_value(punit->type) > 0); Index: server/gotohand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v retrieving revision 1.134 diff -u -r1.134 gotohand.c --- server/gotohand.c 2002/02/11 10:38:10 1.134 +++ server/gotohand.c 2002/02/11 19:36:43 @@ -1285,7 +1285,7 @@ } } - if(!punit->moves_left) { + if(punit->moves_left == 0) { send_unit_info(NULL, punit); return GR_OUT_OF_MOVEPOINTS; } @@ -1314,7 +1314,7 @@ do { /* move the unit along the path chosen by find_the_shortest_path() while we can */ int last_tile, is_real; - if (!punit->moves_left) { + if (punit->moves_left == 0) { return GR_OUT_OF_MOVEPOINTS; } @@ -1331,13 +1331,13 @@ assert(is_real); penemy = is_enemy_unit_tile(map_get_tile(x, y), unit_owner(punit)); - assert(punit->moves_left); + assert(punit->moves_left > 0); last_tile = same_pos(x, y, punit->goto_dest_x, punit->goto_dest_y); if (!handle_unit_move_request(punit, x, y, FALSE, !(last_tile && trigger_special_ability))) { freelog(LOG_DEBUG, "Couldn't handle it."); - if (punit->moves_left) { + if (punit->moves_left > 0) { punit->activity=ACTIVITY_IDLE; send_unit_info(NULL, punit); return GR_FAILED; Index: server/settlers.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v retrieving revision 1.120 diff -u -r1.120 settlers.c --- server/settlers.c 2002/02/11 13:55:53 1.120 +++ server/settlers.c 2002/02/11 19:36:54 @@ -1245,7 +1245,7 @@ } /* need to zero pass & ferryboat at some point. */ } if (goto_is_sane(punit, gx, gy, TRUE) - && punit->moves_left + && punit->moves_left > 0 && (!ferryboat || (is_tiles_adjacent(punit->x, punit->y, gx, gy) && could_unit_move_to_tile(punit, punit->x, punit->y, @@ -1346,7 +1346,7 @@ /* If we are at the destination then do the activity. */ if (punit->ai.control - && punit->moves_left + && punit->moves_left > 0 && punit->activity == ACTIVITY_IDLE) { if (same_pos(gx, gy, punit->x, punit->y)) { if (best_act == ACTIVITY_UNKNOWN) { @@ -1407,7 +1407,7 @@ pplayer->name, punit->x, punit->y); if(punit->activity == ACTIVITY_SENTRY) set_unit_activity(punit, ACTIVITY_IDLE); - if (punit->activity == ACTIVITY_GOTO && punit->moves_left) + if (punit->activity == ACTIVITY_GOTO && punit->moves_left > 0) set_unit_activity(punit, ACTIVITY_IDLE); if (punit->activity == ACTIVITY_IDLE) auto_settler_findwork(pplayer, punit); Index: server/unithand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v retrieving revision 1.212 diff -u -r1.212 unithand.c --- server/unithand.c 2002/02/11 10:38:16 1.212 +++ server/unithand.c 2002/02/11 19:36:56 @@ -279,7 +279,7 @@ if (!unit_flag(pdiplomat, F_DIPLOMAT)) return; - if(pdiplomat->moves_left) { + if(pdiplomat->moves_left > 0) { switch(packet->action_type) { case DIPLOMAT_BRIBE: if(pvictim && diplomat_can_do_action(pdiplomat, DIPLOMAT_BRIBE, Index: server/unittools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v retrieving revision 1.154 diff -u -r1.154 unittools.c --- server/unittools.c 2002/02/11 13:55:53 1.154 +++ server/unittools.c 2002/02/11 19:36:59 @@ -781,7 +781,7 @@ /* to allow a settler to begin a task with no moves left without it counting toward the time to finish */ - if (punit->moves_left) { + if (punit->moves_left > 0) { punit->activity_count += mr/SINGLE_MOVE; } else if (mr == 0) { punit->activity_count += 1; @@ -3132,7 +3132,7 @@ return GR_FOUGHT; } - if (!res && punit->moves_left) { + if (!res && punit->moves_left > 0) { freelog(LOG_DEBUG, "move idling\n"); handle_unit_activity_request(punit, ACTIVITY_IDLE); return GR_FAILED;