include/budg.h File Reference

#include "types.h"
#include "item.h"

Include dependency graph for budg.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SCT_EFFIC   (SCT_TYPE_MAX + 1)

Functions

bpbp_alloc (void)
void bp_set_from_sect (struct bp *, struct sctstr *)
int bp_get_item (struct bp *, struct sctstr *, i_type)
void bp_put_item (struct bp *, struct sctstr *, i_type, int)
void bp_put_items (struct bp *, struct sctstr *, short *)
int bp_get_avail (struct bp *, struct sctstr *)
void bp_put_avail (struct bp *, struct sctstr *, int)
int get_materials (struct sctstr *, struct bp *, int *, int)

Variables

long money [MAXNOC]
long pops [MAXNOC]
long sea_money [MAXNOC]
long lnd_money [MAXNOC]
long air_money [MAXNOC]
long tpops [MAXNOC]
float levels [MAXNOC][4]


Define Documentation

#define SCT_EFFIC   (SCT_TYPE_MAX + 1)

Definition at line 40 of file budg.h.

Referenced by budg(), and produce_sect().


Function Documentation

struct bp* bp_alloc ( void   )  [read]

Definition at line 143 of file bp.c.

References WORLD_SZ.

Referenced by calc_all(), and update_main().

00144 {
00145     return calloc(WORLD_SZ(), sizeof(struct bp));
00146 }

int bp_get_avail ( struct bp ,
struct sctstr  
)

Definition at line 118 of file bp.c.

References bp::bp_avail, bp_ref(), and sp.

Referenced by landrepair(), planerepair(), and shiprepair().

00119 {
00120     return bp_ref(bp, sp)->bp_avail;
00121 }

Here is the call graph for this function:

int bp_get_item ( struct bp ,
struct sctstr ,
i_type   
)

Definition at line 82 of file bp.c.

References bp::bp_item, bp_ref(), bud_key, CANT_HAPPEN, and sp.

Referenced by get_materials().

00083 {
00084     enum bp_item_idx idx = bud_key[comm];
00085 
00086     if (CANT_HAPPEN(idx < 0))
00087         return sp->sct_item[comm];
00088     return bp_ref(bp, sp)->bp_item[idx];
00089 }

Here is the call graph for this function:

void bp_put_avail ( struct bp ,
struct sctstr ,
int   
)

Definition at line 125 of file bp.c.

References bp::bp_avail, bp_ref(), and sp.

Referenced by bp_set_from_sect(), landrepair(), planerepair(), produce_sect(), and shiprepair().

00126 {
00127     bp_ref(bp, sp)->bp_avail = amount;
00128 }

Here is the call graph for this function:

void bp_put_item ( struct bp ,
struct sctstr ,
i_type  ,
int   
)

Definition at line 93 of file bp.c.

References bp::bp_item, bp_ref(), bud_key, and sp.

Referenced by get_materials().

00094 {
00095     enum bp_item_idx idx = bud_key[comm];
00096 
00097     if (idx >= 0)
00098         bp_ref(bp, sp)->bp_item[idx] = amount;
00099 }

Here is the call graph for this function:

void bp_put_items ( struct bp ,
struct sctstr ,
short *   
)

Definition at line 103 of file bp.c.

References bp::bp_item, bp_ref(), bud_key, I_MAX, I_NONE, and sp.

Referenced by bp_set_from_sect(), and produce_sect().

00104 {
00105     enum bp_item_idx idx;
00106     struct bp *p = bp_ref(bp, sp);
00107     i_type i;
00108 
00109     for (i = I_NONE + 1; i <= I_MAX; i++) {
00110         idx = bud_key[i];
00111         if (idx >= 0)
00112             p->bp_item[idx] = vec[i];
00113     }
00114 }

Here is the call graph for this function:

void bp_set_from_sect ( struct bp ,
struct sctstr  
)

Definition at line 132 of file bp.c.

References bp_put_avail(), bp_put_items(), and sp.

Referenced by calc_all(), and prepare_sects().

00133 {
00134     bp_put_items(bp, sp, sp->sct_item);
00135     bp_put_avail(bp, sp, sp->sct_avail);
00136 }

Here is the call graph for this function:

int get_materials ( struct sctstr ,
struct bp ,
int ,
int   
)

Definition at line 51 of file material.c.

References bp_get_item(), bp_put_item(), CANT_HAPPEN, I_MAX, I_NONE, roundavg(), and sp.

Referenced by landrepair(), planerepair(), and shiprepair().

00052 {
00053     int i, amt;
00054 
00055     for (i = I_NONE + 1; i <= I_MAX; i++) {
00056         if (mvec[i] == 0)
00057             continue;
00058         amt = bp_get_item(bp, sp, i);
00059         if (amt * 100 < mvec[i] * pct)
00060             pct = amt * 100 / mvec[i];
00061     }
00062 
00063     for (i = I_NONE + 1; i <= I_MAX; i++) {
00064         if (mvec[i] == 0)
00065             continue;
00066         amt = bp_get_item(bp, sp, i);
00067         amt -= roundavg(mvec[i] * pct / 100.0);
00068         if (CANT_HAPPEN(amt < 0))
00069             amt = 0;
00070         bp_put_item(bp, sp, i, amt);
00071         if (!player->simulation)
00072             sp->sct_item[i] = amt;
00073     }
00074 
00075     return pct;
00076 }

Here is the call graph for this function:


Variable Documentation

long air_money[MAXNOC]

Definition at line 51 of file main.c.

Referenced by calc_all(), prod_nat(), prod_plane(), and update_main().

float levels[MAXNOC][4]

Definition at line 72 of file nat.c.

Referenced by prepare_sects(), prod_nat(), produce(), and share_incr().

long lnd_money[MAXNOC]

Definition at line 50 of file main.c.

Referenced by calc_all(), prod_land(), prod_nat(), and update_main().

long money[MAXNOC]

Definition at line 47 of file main.c.

Referenced by prod_nat(), and update_main().

long pops[MAXNOC]

Definition at line 48 of file main.c.

Referenced by prepare_sects(), prod_nat(), upd_ship(), and update_main().

long sea_money[MAXNOC]

Definition at line 49 of file main.c.

Referenced by calc_all(), prod_nat(), prod_ship(), and update_main().

long tpops[MAXNOC]

Definition at line 52 of file main.c.

Referenced by calc_all(), produce(), and update_main().


Generated on Fri Mar 28 11:01:16 2008 for empserver by  doxygen 1.5.2