Freeciv-3.3: /fast/freeciv/nightly/main/server/advisors/advtools.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
advtools.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <math.h>
19
20#include "advtools.h"
21
22/**********************************************************************/
29 adv_want amortize(adv_want benefit, int delay)
30{
31 double discount = 1.0 - 1.0 / ((double)MORT);
32
33 /* Note there's no rounding here. We could round but it would probably
34 * be better just to return (and take) a double for the benefit. */
35 return benefit * pow(discount, delay);
36}
amortize
adv_want amortize(adv_want benefit, int delay)
Definition advtools.c:29
advtools.h
MORT
#define MORT
Definition advtools.h:19
incite_cost
char * incite_cost
Definition comments.c:74
adv_want
float adv_want
Definition fc_types.h:1335