Freeciv-3.3
|
#include <math.h>
#include "log.h"
#include "game.h"
#include "traderoutes.h"
#include "path_finding.h"
#include "pf_tools.h"
#include "caravan.h"
Go to the source code of this file.
Data Structures | |
struct | cfbdw_data |
Typedefs | |
typedef bool(* | search_callback) (const struct civ_map *nmap, void *data, const struct city *pcity, int arrival_turn, int arrival_moves_left) |
Compute the net present value of an annuity given the discount rate. An annuity is an annual payment for a fixed term (number of turns).
Definition at line 446 of file caravan.c.
Referenced by get_discounted_reward().
void caravan_find_best_destination | ( | const struct civ_map * | nmap, |
const struct unit * | caravan, | ||
const struct caravan_parameter * | parameter, | ||
struct caravan_result * | result, | ||
bool | omniscient | ||
) |
Find the best destination city for the caravan. Store it in *destout (if destout is non-null); return the value of the trade route.
Definition at line 682 of file caravan.c.
Referenced by dai_manage_caravan().
|
static |
Find the best destination for the caravan, ignoring transit time.
Definition at line 595 of file caravan.c.
Referenced by caravan_find_best_destination().
|
static |
Using caravan_search, find the best destination.
Definition at line 649 of file caravan.c.
Referenced by caravan_find_best_destination().
void caravan_parameter_init_default | ( | struct caravan_parameter * | parameter | ) |
Create a valid parameter with default values.
Definition at line 36 of file caravan.c.
Referenced by caravan_parameter_init_from_unit().
void caravan_parameter_init_from_unit | ( | struct caravan_parameter * | parameter, |
const struct unit * | caravan | ||
) |
Create a valid parameter with default values based on the caravan.
Definition at line 53 of file caravan.c.
Referenced by dai_manage_caravan().
bool caravan_parameter_is_legal | ( | const struct caravan_parameter * | parameter | ) |
int caravan_result_compare | ( | const struct caravan_result * | a, |
const struct caravan_result * | b | ||
) |
Compare the two results for sorting.
Definition at line 183 of file caravan.c.
Referenced by caravan_find_best_destination_notransit(), and cfbdw_callback().
|
static |
Initialize the result to go from src to dest with the given amount of time. This is useful for calling get_discounted_reward() and the such.
Definition at line 157 of file caravan.c.
Referenced by caravan_find_best_destination_notransit(), caravan_find_best_destination_withtransit(), and cfbdw_callback().
void caravan_result_init_zero | ( | struct caravan_result * | result | ) |
Initialize the result to be worth zero and go from nowhere to nowhere.
Definition at line 144 of file caravan.c.
Referenced by get_discounted_reward().
|
static |
Definition at line 208 of file caravan.c.
Referenced by caravan_find_best_destination_withtransit().
|
static |
Definition at line 629 of file caravan.c.
Referenced by caravan_find_best_destination_withtransit().
|
static |
Are the two players allowed to trade by the parameter settings?
Definition at line 454 of file caravan.c.
Referenced by caravan_find_best_destination_notransit(), and get_discounted_reward().
|
static |
Human readable name of the foreign_trade_limit
Definition at line 96 of file caravan.c.
Referenced by caravan_parameter_log_real().
|
static |
Compute the discounted reward from the trade route that is indicated by the src, dest, and arrival_time fields of the result: Fills in the value and help_wonder fields. Assumes the owner of src is the owner of the caravan.
Definition at line 481 of file caravan.c.
Referenced by caravan_find_best_destination_notransit(), and cfbdw_callback().
|
static |
How much does the city benefit from the new trade route? How much does the former partner lose?
Definition at line 292 of file caravan.c.
Referenced by trade_benefit().
Compute the net present value of an perpetuity given the discount rate. A perpetuity is an annual payment for an infinite number of turns.
Definition at line 437 of file caravan.c.
Referenced by annuity(), and get_discounted_reward().
Discount a value by the given discount rate. The payment occurs as a lump sum in 'term' turns.
Definition at line 428 of file caravan.c.
Referenced by get_discounted_reward().
|
static |
Compute one_trade_benefit for both cities and do some other logic. This yields the total benefit in terms of trade per turn of establishing a route from src to dest.
Definition at line 347 of file caravan.c.
Referenced by get_discounted_reward().
|
static |
When the caravan arrives, compute the benefit from the immediate windfall, taking into account the parameter's objective.
Definition at line 258 of file caravan.c.
Referenced by get_discounted_reward().
|
static |
Check the benefit of helping build the wonder in dest. This is based on how much the caravan would help if it arrived after turns_delay turns during which the city managed the same production it currently gets (i.e. no other caravans, no population growth or terrain improvement, ...)
Definition at line 393 of file caravan.c.
Referenced by get_discounted_reward().