8 #include "gb/commands/toxicity.h" 10 #include "gb/GB_server.h" 11 #include "gb/files_shl.h" 12 #include "gb/shlmisc.h" 15 void toxicity(
const command_t &argv, GameObj &g) {
18 if (argv.size() != 2) {
19 g.out <<
"Provide exactly one value between 0 and 100.\n";
23 int thresh = std::stoi(argv[1]);
25 if (thresh > 100 || thresh < 0) {
26 g.out <<
"Illegal value.\n";
30 if (g.level != ScopeLevel::LEVEL_PLAN) {
31 g.out <<
"scope must be a planet.\n";
34 if (!
enufAP(g.player
, g.governor
, Stars[g.snum]->AP[g.player - 1]
, APcount
)) {
39 p.info[g.player - 1].tox_thresh = thresh;
43 g.out <<
" New threshold is: " << p.info[g.player - 1].tox_thresh
Planet getplanet(const starnum_t star, const planetnum_t pnum)
void toxicity(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)