Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
caravan.h File Reference
#include "log.h"
#include "shared.h"
#include "fc_types.h"

Go to the source code of this file.

Data Structures

struct  caravan_result
 
struct  caravan_parameter
 

Macros

#define caravan_parameter_log(parameter, loglevel)
 

Enumerations

enum  foreign_trade_limit { FTL_NATIONAL_ONLY , FTL_ALLIED , FTL_PEACEFUL , FTL_NONWAR }
 

Functions

void caravan_parameter_init_default (struct caravan_parameter *parameter)
 
void caravan_parameter_init_from_unit (struct caravan_parameter *parameter, const struct unit *caravan)
 
bool caravan_parameter_is_legal (const struct caravan_parameter *parameter)
 
void caravan_parameter_log_real (const struct caravan_parameter *parameter, enum log_level level, const char *file, const char *function, int line)
 
void caravan_result_init_zero (struct caravan_result *result)
 
int caravan_result_compare (const struct caravan_result *a, const struct caravan_result *b)
 
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)
 

Macro Definition Documentation

◆ caravan_parameter_log

#define caravan_parameter_log (   parameter,
  loglevel 
)
Value:
if (log_do_output_for_level(loglevel)) { \
caravan_parameter_log_real(parameter, loglevel, __FILE__, \
}
char * incite_cost
Definition comments.c:76
#define __FC_LINE__
Definition log.h:41
#define log_do_output_for_level(level)
Definition log.h:90

Definition at line 136 of file caravan.h.

Enumeration Type Documentation

◆ foreign_trade_limit

Enumerator
FTL_NATIONAL_ONLY 
FTL_ALLIED 
FTL_PEACEFUL 
FTL_NONWAR 

Definition at line 28 of file caravan.h.

Function Documentation

◆ caravan_find_best_destination()

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().

◆ caravan_parameter_init_default()

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().

◆ 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().

◆ caravan_parameter_is_legal()

bool caravan_parameter_is_legal ( const struct caravan_parameter parameter)

Check for legality.

Definition at line 72 of file caravan.c.

◆ caravan_parameter_log_real()

void caravan_parameter_log_real ( const struct caravan_parameter parameter,
enum log_level  level,
const char file,
const char function,
int  line 
)

For debugging, print out the parameter.

Definition at line 115 of file caravan.c.

◆ caravan_result_compare()

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().

◆ caravan_result_init_zero()

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().