From c8d238e5410510355c3d9bd0f362906cc9908bea Mon Sep 17 00:00:00 2001 From: Marko Lindqvist <cazfi74@gmail.com> Date: Fri, 22 Sep 2023 11:44:39 +0300 Subject: [PATCH 14/14] Rename AUT_AUTO_SETTLER as AUT_AUTO_WORKER See osdn #48695 Signed-off-by: Marko Lindqvist <cazfi74@gmail.com> --- ai/default/daisettler.c | 4 ++-- ai/default/daitools.c | 14 +++++++------- ai/default/daiunit.c | 6 +++--- ai/default/daiunit.h | 30 +++++++++++++++--------------- common/fc_types.h | 2 +- server/advisors/autoworkers.c | 6 +++--- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ai/default/daisettler.c b/ai/default/daisettler.c index 1ab4a6b9f9..d0c76b07e9 100644 --- a/ai/default/daisettler.c +++ b/ai/default/daisettler.c @@ -1154,7 +1154,7 @@ BUILD_CITY: /* We had a city result, just worse than best impr */ cityresult_destroy(result); } - adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile); + adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile); } else { UNIT_LOG(LOG_DEBUG, punit, "cannot find work"); fc_assert(result == NULL); @@ -1163,7 +1163,7 @@ BUILD_CITY: } } else { /* We are a worker or engineer */ - adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile); + adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile); } if (best_tile != NULL diff --git a/ai/default/daitools.c b/ai/default/daitools.c index 94f861be89..623cb195fd 100644 --- a/ai/default/daitools.c +++ b/ai/default/daitools.c @@ -78,8 +78,8 @@ const char *dai_unit_task_rule_name(const enum ai_unit_task task) switch (task) { case AIUNIT_NONE: return "None"; - case AIUNIT_AUTO_SETTLER: - return "Auto settler"; + case AIUNIT_AUTO_WORKER: + return "Auto worker"; case AIUNIT_BUILD_CITY: return "Build city"; case AIUNIT_DEFEND_HOME: @@ -564,7 +564,7 @@ void dai_fill_unit_param(struct ai_type *ait, struct pf_parameter *parameter, /* Default tile behaviour */ } else if (utype_may_act_at_all(unit_type_get(punit))) { switch (unit_data->task) { - case AIUNIT_AUTO_SETTLER: + case AIUNIT_AUTO_WORKER: case AIUNIT_BUILD_CITY: /* Strange, but not impossible */ parameter->get_TB = no_fights; @@ -619,8 +619,8 @@ void dai_unit_new_adv_task(struct ai_type *ait, struct unit *punit, { /* Keep ai_unit_task in sync with adv task */ switch (task) { - case AUT_AUTO_SETTLER: - dai_unit_new_task(ait, punit, AIUNIT_AUTO_SETTLER, ptile); + case AUT_AUTO_WORKER: + dai_unit_new_task(ait, punit, AIUNIT_AUTO_WORKER, ptile); break; case AUT_BUILD_CITY: dai_unit_new_task(ait, punit, AIUNIT_BUILD_CITY, ptile); @@ -734,8 +734,8 @@ void dai_unit_new_task(struct ai_type *ait, struct unit *punit, /* Map ai tasks to advisor tasks. For most ai tasks there is no advisor, so AUT_NONE is set. */ switch (unit_data->task) { - case AIUNIT_AUTO_SETTLER: - punit->server.adv->task = AUT_AUTO_SETTLER; + case AIUNIT_AUTO_WORKER: + punit->server.adv->task = AUT_AUTO_WORKER; break; case AIUNIT_BUILD_CITY: punit->server.adv->task = AUT_BUILD_CITY; diff --git a/ai/default/daiunit.c b/ai/default/daiunit.c index 1bd114fbee..fd4d21bbf0 100644 --- a/ai/default/daiunit.c +++ b/ai/default/daiunit.c @@ -2535,7 +2535,7 @@ void dai_manage_military(struct ai_type *ait, struct player *pplayer, dai_military_findjob(ait, pplayer, punit); switch (unit_data->task) { - case AIUNIT_AUTO_SETTLER: + case AIUNIT_AUTO_WORKER: case AIUNIT_BUILD_CITY: fc_assert(FALSE); /* This is not the place for this role */ break; @@ -2614,9 +2614,9 @@ static void dai_manage_settler(struct ai_type *ait, struct player *pplayer, unit_server_side_agent_set(pplayer, punit, SSA_AUTOWORKER); unit_data->done = TRUE; /* We will manage this unit later... ugh */ - /* If BUILD_CITY must remain BUILD_CITY, otherwise turn into autosettler */ + /* If BUILD_CITY must remain BUILD_CITY, otherwise turn into autoworker */ if (unit_data->task == AIUNIT_NONE) { - adv_unit_new_task(punit, AUT_AUTO_SETTLER, NULL); + adv_unit_new_task(punit, AUT_AUTO_WORKER, NULL); } } diff --git a/ai/default/daiunit.h b/ai/default/daiunit.h index 200d119d8f..6fe7db7248 100644 --- a/ai/default/daiunit.h +++ b/ai/default/daiunit.h @@ -24,17 +24,17 @@ struct pf_path; struct section_file; -enum ai_unit_task { AIUNIT_NONE, AIUNIT_AUTO_SETTLER, AIUNIT_BUILD_CITY, +enum ai_unit_task { AIUNIT_NONE, AIUNIT_AUTO_WORKER, AIUNIT_BUILD_CITY, AIUNIT_DEFEND_HOME, AIUNIT_ATTACK, AIUNIT_ESCORT, AIUNIT_EXPLORE, AIUNIT_RECOVER, AIUNIT_HUNTER, AIUNIT_TRADE, AIUNIT_WONDER }; struct unit_ai { /* The following are unit ids or special indicator values (<=0) */ - int ferryboat; /* the ferryboat assigned to us */ - int passenger; /* the unit assigned to this ferryboat */ - int bodyguard; /* the unit bodyguarding us */ - int charge; /* the unit this unit is bodyguarding */ + int ferryboat; /* The ferryboat assigned to us */ + int passenger; /* The unit assigned to this ferryboat */ + int bodyguard; /* The unit bodyguarding us */ + int charge; /* The unit this unit is bodyguarding */ struct tile *prev_struct, *cur_struct; struct tile **prev_pos, **cur_pos; @@ -72,8 +72,8 @@ struct unit_type_ai #define POTENTIALLY_HOSTILE_PLAYER(ait, pplayer, aplayer) \ (WAR(pplayer, aplayer) || NEVER_MET(pplayer, aplayer) \ || dai_diplomacy_get(ait, pplayer, aplayer)->countdown >= 0) -#define UNITTYPE_COSTS(ut) \ - (ut->pop_cost * 3 + ut->happy_cost \ +#define UNITTYPE_COSTS(ut) \ + (ut->pop_cost * 3 + ut->happy_cost \ + ut->upkeep[O_SHIELD] + ut->upkeep[O_FOOD] + ut->upkeep[O_GOLD]) /* Invasion types */ @@ -129,11 +129,11 @@ const struct impr_type *utype_needs_improvement(const struct unit_type *putype, const struct city *pcity); bool is_on_unit_upgrade_path(const struct unit_type *test, - const struct unit_type *base); + const struct unit_type *base); void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, - enum override_bool *result); + enum override_bool *result); void dai_units_ruleset_init(struct ai_type *ait); void dai_units_ruleset_close(struct ai_type *ait); @@ -142,14 +142,14 @@ void dai_unit_init(struct ai_type *ait, struct unit *punit); void dai_unit_turn_end(struct ai_type *ait, struct unit *punit); void dai_unit_close(struct ai_type *ait, struct unit *punit); -#define simple_ai_unit_type_iterate(_ut) \ -{ \ - struct unit_type *_ut; \ - int _ut##_index = 0; \ +#define simple_ai_unit_type_iterate(_ut) \ +{ \ + struct unit_type *_ut; \ + int _ut##_index = 0; \ while (NULL != (_ut = simple_ai_types[_ut##_index++])) { -#define simple_ai_unit_type_iterate_end \ - } \ +#define simple_ai_unit_type_iterate_end \ + } \ } void dai_unit_save(struct ai_type *ait, const char *aitstr, diff --git a/common/fc_types.h b/common/fc_types.h index d528433ac0..bafb4c2782 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -366,7 +366,7 @@ enum counter_target { CTGT_CITY }; #define SPECENUM_COUNT CBR_LAST #include "specenum_gen.h" -enum adv_unit_task { AUT_NONE, AUT_AUTO_SETTLER, AUT_BUILD_CITY }; +enum adv_unit_task { AUT_NONE, AUT_AUTO_WORKER, AUT_BUILD_CITY }; typedef signed short Continent_id; typedef int Terrain_type_id; diff --git a/server/advisors/autoworkers.c b/server/advisors/autoworkers.c index f45e2bad29..e527e5680b 100644 --- a/server/advisors/autoworkers.c +++ b/server/advisors/autoworkers.c @@ -966,7 +966,7 @@ void auto_worker_findwork(const struct civ_map *nmap, completion_time = pf_path_last_position(path)->turn; } - adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile); + adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile); best_target = best_task->tgt; @@ -994,7 +994,7 @@ void auto_worker_findwork(const struct civ_map *nmap, } TIMING_LOG(AIT_WORKERS, TIMER_STOP); - adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile); + adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile); auto_worker_setup_work(nmap, pplayer, punit, state, recursion, path, best_tile, best_act, &best_target, @@ -1020,7 +1020,7 @@ bool auto_worker_setup_work(const struct civ_map *nmap, int completion_time) { /* Run the "autoworker" program */ - if (punit->server.adv->task == AUT_AUTO_SETTLER) { + if (punit->server.adv->task == AUT_AUTO_WORKER) { struct pf_map *pfm = NULL; struct pf_parameter parameter; bool working = FALSE; -- 2.40.1