14 #include "gb/mobiliz.h" 19 #include "gb/GB_server.h" 20 #include "gb/buffers.h" 21 #include "gb/files_shl.h" 23 #include "gb/shlmisc.h" 26 void mobilize(
const command_t &argv, GameObj &g) {
27 player_t Playernum = g.player;
28 governor_t Governor = g.governor;
31 if (g.level != ScopeLevel::LEVEL_PLAN) {
32 g.out <<
"scope must be a planet.\n";
36 g.out <<
"You are not authorized to do this here.\n";
39 if (!
enufAP(Playernum
, Governor
, Stars[g.snum]->AP[Playernum - 1]
, APcount
)) {
45 if (argv.size() < 2) {
46 sprintf(buf,
"Current mobilization: %d Quota: %d\n",
47 p.info[Playernum - 1].comread, p.info[Playernum - 1].mob_set);
48 notify(Playernum, Governor, buf);
51 int sum_mob = std::stoi(argv[1]);
53 if (sum_mob > 100 || sum_mob < 0) {
54 g.out <<
"Illegal value.\n";
57 p.info[Playernum - 1].mob_set = sum_mob;
62 void tax(
const command_t &argv, GameObj &g) {
63 player_t Playernum = g.player;
64 governor_t Governor = g.governor;
67 if (g.level != ScopeLevel::LEVEL_PLAN) {
68 g.out <<
"scope must be a planet.\n";
72 g.out <<
"You are not authorized to do that here.\n";
75 racetype *Race = races[Playernum - 1];
76 if (!Race->Gov_ship) {
77 g.out <<
"You have no government center active.\n";
81 g.out <<
"Sorry, but you can't do this when you are a guest.\n";
84 if (!
enufAP(Playernum
, Governor
, Stars[g.snum]->AP[Playernum - 1]
, APcount
)) {
90 if (argv.size() < 2) {
91 sprintf(buf,
"Current tax rate: %d%% Target: %d%%\n",
92 p.info[Playernum - 1].tax, p.info[Playernum - 1].newtax);
93 notify(Playernum, Governor, buf);
97 int sum_tax = std::stoi(argv[1]);
99 if (sum_tax > 100 || sum_tax < 0) {
100 g.out <<
"Illegal value.\n";
103 p.info[Playernum - 1].newtax = sum_tax;
110 int control(
int Playernum,
int Governor, startype *star) {
111 return (!Governor || star->governor[Playernum - 1] == Governor);
Planet getplanet(const starnum_t star, const planetnum_t pnum)
void tax(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)
void putplanet(const Planet &p, startype *star, const int pnum)
int control(int Playernum, int Governor, startype *star)
void mobilize(const command_t &argv, GameObj &g)