7 #include "gb/commands/toggle.h" 11 #include "gb/GB_server.h" 12 #include "gb/buffers.h" 13 #include "gb/files_shl.h" 15 #include "gb/shlmisc.h" 19 void tog(
const player_t Playernum,
const governor_t Governor,
char *op,
22 sprintf(buf,
"%s is now %s\n", name, *op ?
"on" :
"off");
23 notify(Playernum, Governor, buf);
27 void toggle(
const command_t &argv, GameObj &g) {
28 player_t Playernum = g.player;
29 governor_t Governor = g.governor;
33 Race = races[Playernum - 1];
35 if (argv.size() > 1) {
36 if (argv[1] ==
"inverse")
37 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.inverse
, 39 else if (argv[1] ==
"double_digits")
40 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.double_digits
, 42 else if (argv[1] ==
"geography")
43 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.geography
, 45 else if (argv[1] ==
"gag")
46 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.gag
, "gag");
47 else if (argv[1] ==
"autoload")
48 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.autoload
, 50 else if (argv[1] ==
"color")
51 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.color
, "color");
52 else if (argv[1] ==
"visible")
53 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.invisible
, 55 else if (Race->God && argv[1] ==
"monitor")
56 tog(Playernum
, Governor
, &Race->monitor
, "monitor");
57 else if (argv[1] ==
"compatibility")
58 tog(Playernum
, Governor
, &Race->governor[Governor].toggle.compat
, 61 sprintf(buf,
"No such option '%s'\n", argv[1].c_str());
62 notify(Playernum, Governor, buf);
67 sprintf(buf,
"gag is %s\n",
68 Race->governor[Governor].toggle.gag ?
"ON" :
"OFF");
69 notify(Playernum, Governor, buf);
70 sprintf(buf,
"inverse is %s\n",
71 Race->governor[Governor].toggle.inverse ?
"ON" :
"OFF");
72 notify(Playernum, Governor, buf);
73 sprintf(buf,
"double_digits is %s\n",
74 Race->governor[Governor].toggle.double_digits ?
"ON" :
"OFF");
75 notify(Playernum, Governor, buf);
76 sprintf(buf,
"geography is %s\n",
77 Race->governor[Governor].toggle.geography ?
"ON" :
"OFF");
78 notify(Playernum, Governor, buf);
79 sprintf(buf,
"autoload is %s\n",
80 Race->governor[Governor].toggle.autoload ?
"ON" :
"OFF");
81 notify(Playernum, Governor, buf);
82 sprintf(buf,
"color is %s\n",
83 Race->governor[Governor].toggle.color ?
"ON" :
"OFF");
84 notify(Playernum, Governor, buf);
85 sprintf(buf,
"compatibility is %s\n",
86 Race->governor[Governor].toggle.compat ?
"ON" :
"OFF");
87 notify(Playernum, Governor, buf);
90 Race->governor[Governor].toggle.invisible ?
"INVISIBLE" :
"VISIBLE");
91 notify(Playernum, Governor, buf);
92 sprintf(buf,
"highlight player %d\n",
93 Race->governor[Governor].toggle.highlight);
94 notify(Playernum, Governor, buf);
96 sprintf(buf,
"monitor is %s\n", Race->monitor ?
"ON" :
"OFF");
97 notify(Playernum, Governor, buf);
void tog(const player_t Playernum, const governor_t Governor, char *op, const char *name)
void toggle(const command_t &argv, GameObj &g)