Project

General

Profile

Feature #819 » 0015-Unhardcode-wld.map-from-action_prob_unit_vs_tgt.patch

main, S3_2 - Marko Lindqvist, 09/01/2024 01:03 AM

View differences:

ai/default/daiparadrop.c
if (has_handicap(pplayer, H_FOG)) {
possible = action_prob_possible(
action_prob_unit_vs_tgt(paction, punit,
action_prob_unit_vs_tgt(nmap, paction, punit,
tile_city(ptile_dest), NULL,
ptile_dest, NULL));
} else {
client/control.c
}
if (action_prob_possible(
action_prob_unit_vs_tgt(paction, punit,
action_prob_unit_vs_tgt(&(wld.map), paction, punit,
tile_city(ptile), NULL,
ptile, NULL))) {
if (teleport_action == NULL) {
......
}
if (action_prob_possible(
action_prob_unit_vs_tgt(paction, punit,
action_prob_unit_vs_tgt(&(wld.map), paction, punit,
tile_city(ptile), NULL,
ptile, NULL))) {
if (paradrop_action == NULL) {
common/actions.c
@param extra_tgt the target for extra sub targeted actions
@return the action probability of performing the action
**************************************************************************/
struct act_prob action_prob_unit_vs_tgt(const struct action *paction,
struct act_prob action_prob_unit_vs_tgt(const struct civ_map *nmap,
const struct action *paction,
const struct unit *act_unit,
const struct city *tgt_city,
const struct unit *tgt_unit,
......
{
/* Assume impossible until told otherwise. */
struct act_prob prob = ACTPROB_IMPOSSIBLE;
const struct civ_map *nmap = &(wld.map);
fc_assert_ret_val(paction, ACTPROB_IMPOSSIBLE);
fc_assert_ret_val(act_unit, ACTPROB_IMPOSSIBLE);
common/actions.h
const struct unit *actor,
const action_id act_id);
struct act_prob action_prob_unit_vs_tgt(const struct action *paction,
struct act_prob action_prob_unit_vs_tgt(const struct civ_map *nmap,
const struct action *paction,
const struct unit *act_unit,
const struct city *tgt_city,
const struct unit *tgt_unit,
server/unithand.c
{
bool information_revealed;
bool was_punished;
const struct civ_map *nmap = &(wld.map);
struct action *stopped_action = action_by_number(stopped_action_id);
......
information_revealed = action_prob_possible(action_prob_unit_vs_tgt(
nmap,
stopped_action,
actor,
target_city, target_unit,
(1-1/2)