5 #include "gb/commands/tech_status.h" 11 #include "gb/GB_server.h" 12 #include "gb/buffers.h" 13 #include "gb/files_shl.h" 14 #include "gb/getplace.h" 21 #include "gb/tweakables.h" 26 starnum_t snum,
int *t_invest,
double *t_gain,
32 if (
isset(star->explored, Playernum) &&
33 (!Governor || star->governor[Playernum - 1] == Governor)) {
34 for (planetnum_t i = 0; i < star->numplanets; i++) {
36 if (pl.info[Playernum - 1].explored &&
37 pl.info[Playernum - 1].numsectsowned) {
38 sprintf(str,
"%s/%s%s", star->name, star->pnames[i],
39 (pl.info[Playernum - 1].autorep ?
"*" :
""));
40 sprintf(buf,
"%16.16s %10ld%10d%8.3lf%8.3lf\n", str,
41 pl.info[Playernum - 1].popn, pl.info[Playernum - 1].tech_invest,
42 gain =
tech_prod((
int)pl.info[Playernum - 1].tech_invest
, 43 (
int)pl.info[Playernum - 1].popn
),
44 max_gain =
tech_prod((
int)pl.info[Playernum - 1].prod_res
, 45 (
int)pl.info[Playernum - 1].popn
));
46 notify(Playernum, Governor, buf);
47 *t_invest += pl.info[Playernum - 1].tech_invest;
49 *t_max_gain += max_gain;
57 const player_t Playernum = g.player;
58 const governor_t Governor = g.governor;
61 double total_gain = 0.0;
62 double total_max_gain = 0.0;
67 sprintf(buf,
" ========== Technology Report ==========\n\n");
68 notify(Playernum, Governor, buf);
70 sprintf(buf,
" Planet popn invest gain ^gain\n");
71 notify(Playernum, Governor, buf);
73 if (argv.size() == 1) {
74 for (starnum_t star = 0; star < Sdata.numstars; star++) {
77 &total_gain
, &total_max_gain
);
80 for (k = 1; k < argv.size(); k++) {
81 where = getplace(g, argv[k], 0);
82 if (where.err || where.level == ScopeLevel::LEVEL_UNIV ||
83 where.level == ScopeLevel::LEVEL_SHIP) {
84 sprintf(buf,
"Bad location `%s'.\n", argv[k].c_str());
85 notify(Playernum, Governor, buf);
88 starnum_t star = where.snum;
89 getstar(&Stars[star], star);
90 tech_report_star(Playernum, Governor, Stars[star], star, &total_invest,
91 &total_gain, &total_max_gain);
94 sprintf(buf,
" Total Popn: %7ld\n", Power[Playernum - 1].popn);
95 notify(Playernum, Governor, buf);
96 sprintf(buf,
"Tech: %31d%8.3lf%8.3lf\n", total_invest, total_gain,
98 notify(Playernum, Governor, buf);
Planet getplanet(const starnum_t star, const planetnum_t pnum)
void tech_status(const command_t &argv, GameObj &g)
double tech_prod(int investment, int popn)
void tech_report_star(int Playernum, int Governor, startype *star, starnum_t snum, int *t_invest, double *t_gain, double *t_max_gain)
void getsdata(struct stardata *S)
void getstar(startype **s, int star)