7 #include "gb/commands/relation.h" 11 #include "gb/GB_server.h" 12 #include "gb/buffers.h" 14 #include "gb/shlmisc.h" 17 static auto allied(
const Race &r,
const player_t p) {
18 if (
isset(r.atwar, p))
return "WAR";
19 if (
isset(r.allied, p))
return "ALLIED";
23 void relation(
const command_t &argv, GameObj &g) {
24 const player_t Playernum = g.player;
25 const governor_t Governor = g.governor;
27 if (argv.size() == 1) {
30 if (!(q = get_player(argv[1]))) {
31 g.out <<
"No such player.\n";
36 auto Race = races[q - 1];
38 sprintf(buf,
"\n Racial Relations Report for %s\n\n",
40 notify(Playernum, Governor, buf);
41 g.out <<
" # know Race name Yours Theirs\n";
42 g.out <<
" - ---- --------- ----- ------\n";
43 for (
auto r : races) {
44 if (r->Playernum == Race->Playernum)
continue;
45 sprintf(buf,
"%2hhu %s (%3d%%) %20.20s : %10s %10s\n", r->Playernum,
46 ((Race->God || (Race->translate[r->Playernum - 1] > 30)) &&
47 r->Metamorph && (Playernum == q))
50 Race->translate[r->Playernum - 1], r->name,
51 allied(*Race, r->Playernum), allied(*r, q));
52 notify(Playernum, Governor, buf);
void relation(const command_t &argv, GameObj &g)
static auto allied(const Race &r, const player_t p)