Bug #2496 » 0001-resolve_city_emergency-Disband-an-idle-boat-too.patch
| ai/default/daicity.c | ||
|---|---|---|
|
#include "daidata.h"
|
||
|
#include "daidiplomacy.h"
|
||
|
#include "daidomestic.h"
|
||
|
#include "daiferry.h"
|
||
|
#include "daihand.h"
|
||
|
#include "daimilitary.h"
|
||
|
#include "daieffects.h"
|
||
| ... | ... | |
|
if (city_unhappy(pcity)
|
||
|
&& (utype_happy_cost(unit_type_get(punit), pplayer) > 0
|
||
|
&& (unit_being_aggressive(nmap, punit) || is_field_unit(punit)))
|
||
|
&& def_ai_unit_data(punit, ait)->passenger == 0) {
|
||
|
&& !dai_ferry_in_use(ait, punit)) {
|
||
|
UNIT_LOG(LOG_EMERGENCY, punit, "is causing unrest, disbanded");
|
||
|
/* TODO: If Help Wonder stops blocking Disband Unit there may be
|
||
|
* cases where Disband Unit should be selected. Example: Field unit
|
||
| ai/default/daiferry.c | ||
|---|---|---|
|
&& (ferry_type->fuel == 0 || utype_has_flag(ferry_type, UTYF_COAST)));
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Does the boat carry units, or has a passenger booked it? The passenger
|
||
|
field alone cannot tell: it is negative, never 0, for a boat nobody
|
||
|
has booked.
|
||
|
**************************************************************************/
|
||
|
bool dai_ferry_in_use(struct ai_type *ait, struct unit *pferry)
|
||
|
{
|
||
|
return get_transporter_occupancy(pferry) > 0
|
||
|
|| def_ai_unit_data(pferry, ait)->passenger > 0;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Check if unit is boss in ferry
|
||
|
**************************************************************************/
|
||
| ai/default/daiferry.h | ||
|---|---|---|
|
bool is_boat_free(struct ai_type *ait, struct unit *boat,
|
||
|
struct unit *punit, int cap);
|
||
|
bool is_boss_of_boat(struct ai_type *ait, struct unit *punit);
|
||
|
bool dai_ferry_in_use(struct ai_type *ait, struct unit *pferry);
|
||
|
/*
|
||
|
* Main boat managing function. Gets units on board to where they want to
|
||
- « Previous
- 1
- 2
- 3
- Next »