7 #include "gb/commands/capital.h" 12 #include "gb/GB_server.h" 13 #include "gb/buffers.h" 14 #include "gb/files_shl.h" 16 #include "gb/getplace.h" 19 #include "gb/shlmisc.h" 22 void capital(
const command_t &argv, GameObj &g) {
23 player_t Playernum = g.player;
24 governor_t Governor = g.governor;
28 Race = races[Playernum - 1];
30 g.out <<
"Only the leader may designate the capital.\n";
36 shipno = Race->Gov_ship;
38 auto shiptmp = string_to_shipnum(argv[1]);
40 g.out <<
"Specify a valid ship number.\n";
46 auto s = getship(shipno);
48 g.out <<
"Change the capital to be what ship?\n";
52 if (argv.size() == 2) {
53 shipnum_t snum = s->storbits;
54 if (testship(Playernum, Governor, *s)) {
55 g.out <<
"You can't do that!\n";
59 g.out <<
"Try landing this ship first!\n";
62 if (!
enufAP(Playernum
, Governor
, Stars[snum]->AP[Playernum - 1]
, APcount
)) {
65 if (s->type != ShipType::OTYPE_GOV) {
66 sprintf(buf,
"That ship is not a %s.\n", Shipnames[ShipType::OTYPE_GOV]);
67 notify(Playernum, Governor, buf);
71 Race->Gov_ship = shipno;
75 sprintf(buf,
"Efficiency of governmental center: %.0f%%.\n",
76 ((
double)s->popn / (
double)max_crew(*s)) * (100 - (
double)s->damage));
77 notify(Playernum, Governor, buf);
void capital(const command_t &argv, GameObj &g)
void deductAPs(const player_t Playernum, const governor_t Governor, unsigned int n, starnum_t snum, int sdata)
int enufAP(int Playernum, int Governor, unsigned short AP, int x)