7 #include "gb/commands/examine.h" 13 #include "gb/GB_server.h" 14 #include "gb/buffers.h" 16 #include "gb/files_shl.h" 18 #include "gb/shlmisc.h" 21 void examine(
const command_t &argv, GameObj &g) {
22 const int APcount = 0;
26 if (argv.size() < 2) {
27 g.out <<
"Examine what?\n";
31 auto shipno = string_to_shipnum(argv[1]);
37 auto ship = getship(*shipno);
44 g.out <<
"that ship is dead.\n";
47 if (ship->whatorbits == ScopeLevel::LEVEL_UNIV ||
48 isclr(Stars[ship->storbits]->inhabited, g.player)) {
49 g.out <<
"That ship it not visible to you.\n";
53 if ((fd = fopen(
EXAM_FL,
"r")) ==
nullptr) {
59 for (
int t = 0; t <= ship->type; t++)
60 while (fgetc(fd) !=
'~')
66 while ((ch = fgetc(fd)) !=
'~') {
67 sprintf(temp,
"%c", ch);
70 notify(g.player, g.governor, buf);
73 if (!ship->examined) {
74 if (ship->whatorbits == ScopeLevel::LEVEL_UNIV)
77 deductAPs(g.player, g.governor, APcount, ship->storbits, 0);
83 if (has_switch(*ship)) {
84 g.out <<
"This device has an on/off switch that can be set with order.\n";
87 g.out <<
"This device has been irradiated;\n";
88 g.out <<
"Its crew is dying and it cannot move for the time being.\n";
void examine(const command_t &argv, GameObj &g)
void deductAPs(const player_t Playernum, const governor_t Governor, unsigned int n, starnum_t snum, int sdata)