Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/advisors/advtools.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Functions
advtools.h File Reference
`#include "fc_types.h"`

Go to the source code of this file.

## Macros

#define | MORT 24
#define | FC_EPSILON (0.001)
#define | ADV_WANTS_EQ(_w1, _w2) (fabs((_w1) - (_w2)) < FC_EPSILON * (fabs((float) (_w1)) + fabs((float) (_w2))))
#define | POWER_DIVIDER (POWER_FACTOR * 3)

## Functions

adv_want | amortize (adv_want benefit, int delay)

## Macro Definition Documentation

## ◆ ADV_WANTS_EQ

#define ADV_WANTS_EQ | ( |  | _w1,
|  |  | _w2
| ) |  | (fabs((_w1) - (_w2)) < FC_EPSILON * (fabs((float) (_w1)) + fabs((float) (_w2))))

Definition at line 23 of file advtools.h.

## ◆ FC_EPSILON

#define FC_EPSILON (0.001)

Definition at line 22 of file advtools.h.

## ◆ MORT

#define MORT 24

Definition at line 19 of file advtools.h.

## ◆ POWER_DIVIDER

#define POWER_DIVIDER (POWER_FACTOR * 3)

Definition at line 32 of file advtools.h.

## Function Documentation

## ◆ amortize()

adv_want amortize | ( | adv_want | benefit,
|  | int | delay
| ) |  |

Amortize means gradually paying off a cost or debt over time. In freeciv terms this means we calculate how much less worth something is to us depending on how long it will take to complete.

This is based on a global interest rate as defined by the MORT value.

Definition at line 29 of file advtools.c.

Referenced by adv_best_government(), consider_settler_action(), dai_gov_value(), dai_hunter_guess_best(), dai_hunter_missile_want(), dai_war_desire(), military_amortize(), settler_evaluate_improvements(), and settler_map_iterate().