<commit_before>/* bzflag
 * Copyright (c) 1993 - 2004 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/* interface header */
#include "commands.h"

/* system implementation headers */
#include <fstream>
#include "../zlib/zconf.h"
#include "../zlib/zlib.h"

/* common implementation headers */
#include "global.h"
#include "StateDatabase.h"
#include "TextUtils.h"
#include "version.h"

/* local implementation headers */
#include "LocalPlayer.h"
#include "sound.h"
#include "ComposeDefaultKey.h"
#include "Roster.h"
#include "SilenceDefaultKey.h"
#include "ServerCommandKey.h"

/* FIXME -- from playing.cxx */
extern LocalPlayer* myTank;
extern bool fireButton;
#include "ServerLink.h"
extern ServerLink* serverLink;
void handleFlagDropped(Player* tank);
void setTarget();
extern bool gameOver;
extern float destructCountdown;
#include "HUDRenderer.h"
extern HUDRenderer* hud;
extern bool pausedByUnmap;
#include "ControlPanel.h"
extern ControlPanel* controlPanel;
extern int savedVolume;
bool shouldGrabMouse();
#include "MainWindow.h"
extern MainWindow* mainWindow;
extern float pauseCountdown;
#include "Address.h"
extern char messageMessage[PlayerIdPLen + MessageLen];
extern float clockAdjust;
extern bool roaming;
extern enum roamingView {
  roamViewFree = 0,
  roamViewTrack,
  roamViewFollow,
  roamViewFP,
  roamViewFlag,
  roamViewCount
} roamView;
extern int roamTrackTank, roamTrackWinner, roamTrackFlag;
extern float roamPos[3], roamDPos[3];
extern float roamTheta, roamDTheta;
extern float roamPhi, roamDPhi;
extern float roamZoom, roamDZoom;
extern bool roamButton;
#include "World.h"
extern World* world;
void setRoamingLabel(bool force);
extern bool admin;


const struct CommandListItem commandList[] = {
  { "fire",	&cmdFire,	"fire:  fire a shot" },
  { "jump",	&cmdJump,	"jump:  make player jump" },
  { "drop",	&cmdDrop,	"drop:  drop the current flag" },
  { "identify",	&cmdIdentify,	"identify:  identify/lock-on-to player in view" },
  { "restart",	&cmdRestart,	"restart:  restart playing" },
  { "destruct", &cmdDestruct,	"destruct:  self destruct" },
  { "pause",	&cmdPause,	"pause:  pause/resume" },
  { "send",	&cmdSend,	"send {all|team|nemesis|recipient}:  start composing a message" },
#ifdef SNAPPING
  { "screenshot", &cmdScreenshot, "screenshot:  take a screenshot" },
#endif
  { "time",	&cmdTime,	"time {forward|backward}:  adjust the current time" },
  { "roam",	&cmdRoam,	"roam {rotate|translate|zoom|cycle} <args>:  roam around" },
  { "silence",	&cmdSilence,	"silence:  silence/unsilence a player" },
  { "servercommand",	&cmdServerCommand,	"servercommand:  quick admin" },
  { "scrollpanel",	&cmdScrollPanel,	"scrollpanel {up|down}:  scroll message panel" },
  { "hunt",	&cmdHunt,	"hunt:  hunt a specific player" },
  { "iconify",  &cmdIconify,	"iconify: iconify & pause bzflag" },
  { "autopilot",&cmdAutoPilot,	"autopilot:  set/unset autopilot bot code" }
};


std::string cmdIconify(const std::string&, const CommandManager::ArgList& args)
{
  if (args.size() != 0)
    return "usage: iconify";
  mainWindow->iconify();
  return std::string();
}

std::string cmdJump(const std::string&, const CommandManager::ArgList& args)
{
  if (args.size() != 0)
    return "usage: jump";<commit_msg>Allowing iconify only if not playing<commit_after>/* bzflag
 * Copyright (c) 1993 - 2004 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/* interface header */
#include "commands.h"

/* system implementation headers */
#include <fstream>
#include "../zlib/zconf.h"
#include "../zlib/zlib.h"

/* common implementation headers */
#include "global.h"
#include "StateDatabase.h"
#include "TextUtils.h"
#include "version.h"

/* local implementation headers */
#include "LocalPlayer.h"
#include "sound.h"
#include "ComposeDefaultKey.h"
#include "Roster.h"
#include "SilenceDefaultKey.h"
#include "ServerCommandKey.h"

/* FIXME -- from playing.cxx */
extern LocalPlayer* myTank;
extern bool fireButton;
#include "ServerLink.h"
extern ServerLink* serverLink;
void handleFlagDropped(Player* tank);
void setTarget();
extern bool gameOver;
extern float destructCountdown;
#include "HUDRenderer.h"
extern HUDRenderer* hud;
extern bool pausedByUnmap;
#include "ControlPanel.h"
extern ControlPanel* controlPanel;
extern int savedVolume;
bool shouldGrabMouse();
#include "MainWindow.h"
extern MainWindow* mainWindow;
extern float pauseCountdown;
#include "Address.h"
extern char messageMessage[PlayerIdPLen + MessageLen];
extern float clockAdjust;
extern bool roaming;
extern enum roamingView {
  roamViewFree = 0,
  roamViewTrack,
  roamViewFollow,
  roamViewFP,
  roamViewFlag,
  roamViewCount
} roamView;
extern int roamTrackTank, roamTrackWinner, roamTrackFlag;
extern float roamPos[3], roamDPos[3];
extern float roamTheta, roamDTheta;
extern float roamPhi, roamDPhi;
extern float roamZoom, roamDZoom;
extern bool roamButton;
#include "World.h"
extern World* world;
void setRoamingLabel(bool force);
extern bool admin;


const struct CommandListItem commandList[] = {
  { "fire",	&cmdFire,	"fire:  fire a shot" },
  { "jump",	&cmdJump,	"jump:  make player jump" },
  { "drop",	&cmdDrop,	"drop:  drop the current flag" },
  { "identify",	&cmdIdentify,	"identify:  identify/lock-on-to player in view" },
  { "restart",	&cmdRestart,	"restart:  restart playing" },
  { "destruct", &cmdDestruct,	"destruct:  self destruct" },
  { "pause",	&cmdPause,	"pause:  pause/resume" },
  { "send",	&cmdSend,	"send {all|team|nemesis|recipient}:  start composing a message" },
#ifdef SNAPPING
  { "screenshot", &cmdScreenshot, "screenshot:  take a screenshot" },
#endif
  { "time",	&cmdTime,	"time {forward|backward}:  adjust the current time" },
  { "roam",	&cmdRoam,	"roam {rotate|translate|zoom|cycle} <args>:  roam around" },
  { "silence",	&cmdSilence,	"silence:  silence/unsilence a player" },
  { "servercommand",	&cmdServerCommand,	"servercommand:  quick admin" },
  { "scrollpanel",	&cmdScrollPanel,	"scrollpanel {up|down}:  scroll message panel" },
  { "hunt",	&cmdHunt,	"hunt:  hunt a specific player" },
  { "iconify",  &cmdIconify,	"iconify: iconify & pause bzflag" },
  { "autopilot",&cmdAutoPilot,	"autopilot:  set/unset autopilot bot code" }
};


std::string cmdIconify(const std::string&, const CommandManager::ArgList& args)
{
  if (args.size() != 0)
    return "usage: iconify";
  if (myTank == NULL || !myTank->isAlive() || myTank->isPaused())
    mainWindow->iconify();
  return std::string();
}

std::string cmdJump(const std::string&, const CommandManager::ArgList& args)
{
  if (args.size() != 0)
    return "usage: jump";
{'fraction_non_alphanumeric': 0.13486706157872985, 'fraction_numerical': 0.0035817605730816917, 'mean_word_length': 5.205128205128205, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2608113', 'n_tokens_mistral': 2547, 'n_tokens_neox': 2451, 'n_words': 713}