Freeciv-3.3: /fast/freeciv/nightly/main/utility/distribute.c File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Functions
distribute.c File Reference
`#include "log.h"`
`#include "distribute.h"`

Go to the source code of this file.

## Functions

void | distribute (int number, unsigned groups, const unsigned *ratios, int *result)

## Function Documentation

## ◆ distribute()

void distribute | ( | int | number,
|  | unsigned | groups,
|  | const unsigned * | ratios,
|  | int * | result
| ) |  |

Distribute "number" elements into "groups" groups with ratios given by the elements in "ratios". The resulting division is put into the "result" array.

For instance this code is used to distribute trade among science, tax, and luxury. In this case "number" is the amount of trade, "groups" is 3, and ratios[3] = {sci_rate, tax_rate, lux_rate}.

The algorithm used to determine the distribution is Hamilton's Method.

Definition at line 34 of file distribute.c.

Referenced by add_tax_income(), and dai_manage_taxes().