Freeciv-3.3: /fast/freeciv/nightly/main/ai/default/daitech.c File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Data Structures | Functions
daitech.c File Reference
`#include <string.h>`
`#include "log.h"`
`#include "game.h"`
`#include "government.h"`
`#include "player.h"`
`#include "research.h"`
`#include "tech.h"`
`#include "plrhand.h"`
`#include "srv_log.h"`
`#include "techtools.h"`
`#include "advdata.h"`
`#include "daicity.h"`
`#include "daidata.h"`
`#include "daieffects.h"`
`#include "dailog.h"`
`#include "daiplayer.h"`
`#include "daiunit.h"`
`#include "daitech.h"`

Go to the source code of this file.

## Data Structures

struct | ai_tech_choice

## Functions

static void | dai_select_tech (struct ai_type *ait, struct player *pplayer, struct ai_tech_choice *choice, struct ai_tech_choice *goal)
static adv_want | dai_tech_base_want (struct ai_type *ait, struct player *pplayer, struct city *pcity, struct advance *padv)
static void | dai_tech_effect_values (struct ai_type *ait, struct player *pplayer)
void | dai_manage_tech (struct ai_type *ait, struct player *pplayer)
struct unit_type * | dai_wants_defender_against (struct ai_type *ait, struct player *pplayer, struct city *pcity, const struct unit_type *att, int want)
struct unit_type * | dai_wants_role_unit (struct ai_type *ait, struct player *pplayer, struct city *pcity, int role, int want)
void | dai_clear_tech_wants (struct ai_type *ait, struct player *pplayer)

## Function Documentation

## ◆ dai_clear_tech_wants()

void dai_clear_tech_wants | ( | struct ai_type * | ait,
|  | struct player * | pplayer
| ) |  |

Zero player tech wants

Definition at line 611 of file daitech.c.

Referenced by dai_do_last_activities().

## ◆ dai_manage_tech()

void dai_manage_tech | ( | struct ai_type * | ait,
|  | struct player * | pplayer
| ) |  |

Key AI research function. Disable if we are in a team with human team mates in a research pool.

Definition at line 335 of file daitech.c.

Referenced by dai_do_last_activities().

## ◆ dai_select_tech()

static void dai_select_tech | ( | struct ai_type * | ait,
|  | struct player * | pplayer,
|  | struct ai_tech_choice * | choice,
|  | struct ai_tech_choice * | goal
| ) |  |

static

Massage the numbers provided to us by ai.tech_want into unrecognizable pulp.

TODO: Write a transparent formula.

Notes:

1. research_goal_unknown_techs() returns 0 for known techs, 1 if tech is immediately available etc.
2. A tech is reachable means we can research it now; tech is available means it's on our tech tree (different nations can have different techs).
3. ai.tech_want is usually upped by each city, so it is divided by number of cities here.
4. A tech isn't a requirement of itself.

Definition at line 70 of file daitech.c.

Referenced by dai_manage_tech().

## ◆ dai_tech_base_want()

static adv_want dai_tech_base_want | ( | struct ai_type * | ait,
|  | struct player * | pplayer,
|  | struct city * | pcity,
|  | struct advance * | padv
| ) |  |

static

Calculates want for some techs by actually adding the tech and measuring the effect.

Definition at line 225 of file daitech.c.

Referenced by dai_tech_effect_values().

## ◆ dai_tech_effect_values()

static void dai_tech_effect_values | ( | struct ai_type * | ait,
|  | struct player * | pplayer
| ) |  |

static

Add effect values in to tech wants.

Definition at line 251 of file daitech.c.

Referenced by dai_manage_tech().

## ◆ dai_wants_defender_against()

struct unit_type * dai_wants_defender_against | ( | struct ai_type * | ait,
|  | struct player * | pplayer,
|  | struct city * | pcity,
|  | const struct unit_type * | att,
|  | int | want
| ) |  |

Returns the best defense multiplier unit we can build, or NULL if none. Assigns tech wants for techs to get better units, but only for the cheapest to research.

Definition at line 390 of file daitech.c.

Referenced by assess_danger().

## ◆ dai_wants_role_unit()

struct unit_type * dai_wants_role_unit | ( | struct ai_type * | ait,
|  | struct player * | pplayer,
|  | struct city * | pcity,
|  | int | role,
|  | int | want
| ) |  |

Returns the best unit we can build, or NULL if none. "Best" here means last in the unit list as defined in the ruleset. Assigns tech wants for techs to get better units with given role, but only for the cheapest to research "next" unit up the "chain".

Definition at line 521 of file daitech.c.

Referenced by dai_choose_help_wonder(), dai_choose_role_unit(), dai_choose_trade_route(), and domestic_advisor_choose_build().