Author: cazfi Date: Sun May 14 22:07:51 2017 New Revision: 35578 URL: http://svn.gna.org/viewcvs/freeciv?rev=35578&view=rev Log: Rename settler_want as worker_want
See hrm Feature #660200 Modified: trunk/ai/default/aicity.c trunk/ai/default/aicity.h trunk/ai/default/daidomestic.c Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=35578&r1=35577&r2=35578&view=diff ============================================================================== --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Sun May 14 22:07:51 2017 @@ -744,7 +744,7 @@ return; } - city_data->settler_want = 0; /* Make sure old want does not stay if we don't want now */ + city_data->worker_want = 0; /* Make sure old want does not stay if we don't want now */ utype = dai_role_utype_for_terrain_class(pcity, UTYF_SETTLERS, TC_LAND); @@ -807,8 +807,8 @@ fc_assert(want >= 0); - city_data->settler_want = want; - city_data->settler_type = dai_role_utype_for_terrain_class(pcity, UTYF_SETTLERS, + city_data->worker_want = want; + city_data->worker_type = dai_role_utype_for_terrain_class(pcity, UTYF_SETTLERS, TC_LAND); } @@ -881,14 +881,14 @@ adv_free_choice(choice); TIMING_LOG(AIT_CITY_MILITARY, TIMER_STOP); if (dai_on_war_footing(ait, pplayer) && city_data->choice.want > 0) { - city_data->settler_want = 0; + city_data->worker_want = 0; city_data->founder_want = 0; city_data->founder_turn = game.info.turn; /* Do not consider zero we set here * valid value, if real want is needed. * Recalculate immediately in such situation. */ continue; /* Go, soldiers! */ } - /* Will record its findings in pcity->settler_want */ + /* Will record its findings in pcity->worker_want */ TIMING_LOG(AIT_CITY_TERRAIN, TIMER_START); contemplate_terrain_improvements(ait, pcity); TIMING_LOG(AIT_CITY_TERRAIN, TIMER_STOP); Modified: trunk/ai/default/aicity.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.h?rev=35578&r1=35577&r2=35578&view=diff ============================================================================== --- trunk/ai/default/aicity.h (original) +++ trunk/ai/default/aicity.h Sun May 14 22:07:51 2017 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,8 +64,8 @@ bool founder_boat; /* city founder will need a boat */ int founder_turn; /* only recalculate every Nth turn */ int founder_want; - int settler_want; - struct unit_type *settler_type; + int worker_want; + struct unit_type *worker_type; }; void dai_manage_cities(struct ai_type *ait, struct player *pplayer); Modified: trunk/ai/default/daidomestic.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35578&r1=35577&r2=35578&view=diff ============================================================================== --- trunk/ai/default/daidomestic.c (original) +++ trunk/ai/default/daidomestic.c Sun May 14 22:07:51 2017 @@ -459,44 +459,44 @@ { struct adv_data *adv = adv_data_get(pplayer, NULL); /* Unit type with certain role */ - struct unit_type *settler_type; + struct unit_type *worker_type; struct unit_type *founder_type; - adv_want settler_want, founder_want; + adv_want worker_want, founder_want; struct ai_city *city_data = def_ai_city_data(pcity, ait); struct adv_choice *choice = adv_new_choice(); /* Find out desire for workers (terrain improvers) */ - settler_type = city_data->settler_type; + worker_type = city_data->worker_type; /* The worker want is calculated in aicity.c called from * dai_manage_cities. The expand value is the % that the AI should * value expansion (basically to handicap easier difficulty levels) * and is set when the difficulty level is changed (difficulty.c). */ - settler_want = city_data->settler_want * pplayer->ai_common.expand / 100; + worker_want = city_data->worker_want * pplayer->ai_common.expand / 100; if (adv->wonder_city == pcity->id) { - if (!settler_type || settler_type->pop_cost > 0) { - settler_want /= 5; + if (!worker_type || worker_type->pop_cost > 0) { + worker_want /= 5; } else { - settler_want /= 2; - } - } - - if (settler_type - && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type, + worker_want /= 2; + } + } + + if (worker_type != NULL + && pcity->surplus[O_FOOD] > utype_upkeep_cost(worker_type, pplayer, O_FOOD)) { - if (settler_want > 0) { + if (worker_want > 0) { CITY_LOG(LOG_DEBUG, pcity, "desires terrain improvers with passion " ADV_WANT_PRINTF, - settler_want); + worker_want); dai_choose_role_unit(ait, pplayer, pcity, choice, CT_CIVILIAN, - UTYF_SETTLERS, settler_want, FALSE); + UTYF_SETTLERS, worker_want, FALSE); adv_choice_set_use(choice, "worker"); } /* Terrain improvers don't use boats (yet) */ - } else if (!settler_type && settler_want > 0) { - /* Can't build settlers. Lets stimulate science */ - dai_wants_role_unit(ait, pplayer, pcity, UTYF_SETTLERS, settler_want); + } else if (worker_type == NULL && worker_want > 0) { + /* Can't build workers. Lets stimulate science */ + dai_wants_role_unit(ait, pplayer, pcity, UTYF_SETTLERS, worker_want); } /* Find out desire for city founders */ _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits