mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- removed the 'caller' parameter from the CCMD dispatcher.
This can never be anything but players[consoleplayer].mo, so there is no need to pass it through the interface.
This commit is contained in:
parent
603ad755ab
commit
d63a6baa5d
5 changed files with 34 additions and 34 deletions
|
@ -354,14 +354,13 @@ CCMD (hxvisit)
|
|||
|
||||
CCMD (changemap)
|
||||
{
|
||||
if (who == NULL || !usergame)
|
||||
if (!players[consoleplayer].mo || !usergame)
|
||||
{
|
||||
Printf ("Use the map command when not in a game.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
AActor* user = (AActor*)who;
|
||||
if (!players[user->player - players].settings_controller && netgame)
|
||||
if (!players[consoleplayer].settings_controller && netgame)
|
||||
{
|
||||
Printf ("Only setting controllers can change the map.\n");
|
||||
return;
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
if (Text.IsNotEmpty() && Command != nullptr)
|
||||
{
|
||||
FCommandLine args(Text);
|
||||
Command->Run(args, players[consoleplayer].mo, 0);
|
||||
Command->Run(args, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void C_DoCommand (const char *cmd, int keynum)
|
|||
)
|
||||
{
|
||||
FCommandLine args (beg);
|
||||
com->Run (args, players[consoleplayer].mo, keynum);
|
||||
com->Run (args, keynum);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -525,12 +525,12 @@ FConsoleCommand::~FConsoleCommand ()
|
|||
delete[] m_Name;
|
||||
}
|
||||
|
||||
void FConsoleCommand::Run (FCommandLine &argv, void *who, int key)
|
||||
void FConsoleCommand::Run(FCommandLine &argv, int key)
|
||||
{
|
||||
m_RunFunc (argv, who, key);
|
||||
m_RunFunc (argv, key);
|
||||
}
|
||||
|
||||
void FUnsafeConsoleCommand::Run (FCommandLine &args, void *instigator, int key)
|
||||
void FUnsafeConsoleCommand::Run(FCommandLine &args, int key)
|
||||
{
|
||||
if (UnsafeExecutionContext)
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ void FUnsafeConsoleCommand::Run (FCommandLine &args, void *instigator, int key)
|
|||
return;
|
||||
}
|
||||
|
||||
FConsoleCommand::Run (args, instigator, key);
|
||||
FConsoleCommand::Run (args, key);
|
||||
}
|
||||
|
||||
FConsoleAlias::FConsoleAlias (const char *name, const char *command, bool noSave)
|
||||
|
@ -948,7 +948,7 @@ bool FConsoleAlias::IsAlias ()
|
|||
return true;
|
||||
}
|
||||
|
||||
void FConsoleAlias::Run (FCommandLine &args, void *who, int key)
|
||||
void FConsoleAlias::Run (FCommandLine &args, int key)
|
||||
{
|
||||
if (bRunning)
|
||||
{
|
||||
|
@ -1011,10 +1011,10 @@ void FConsoleAlias::SafeDelete ()
|
|||
}
|
||||
}
|
||||
|
||||
void FUnsafeConsoleAlias::Run (FCommandLine &args, void *instigator, int key)
|
||||
void FUnsafeConsoleAlias::Run (FCommandLine &args, int key)
|
||||
{
|
||||
UnsafeExecutionScope scope;
|
||||
FConsoleAlias::Run(args, instigator, key);
|
||||
FConsoleAlias::Run(args, key);
|
||||
}
|
||||
|
||||
void FExecList::AddCommand(const char *cmd, const char *file)
|
||||
|
|
|
@ -86,7 +86,7 @@ void C_ClearAliases ();
|
|||
FString BuildString (int argc, FString *argv);
|
||||
|
||||
class AActor;
|
||||
typedef void (*CCmdRun) (FCommandLine &argv, void *instigator, int key);
|
||||
typedef void (*CCmdRun) (FCommandLine &argv, int key);
|
||||
|
||||
class FConsoleCommand
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
virtual bool IsAlias ();
|
||||
void PrintCommand();
|
||||
|
||||
virtual void Run (FCommandLine &args, void *instigator, int key);
|
||||
virtual void Run (FCommandLine &args, int key);
|
||||
static FConsoleCommand* FindByName (const char* name);
|
||||
|
||||
FConsoleCommand *m_Next, **m_Prev;
|
||||
|
@ -113,9 +113,9 @@ protected:
|
|||
};
|
||||
|
||||
#define CCMD(n) \
|
||||
void Cmd_##n (FCommandLine &, void *, int key); \
|
||||
void Cmd_##n (FCommandLine &, int key); \
|
||||
FConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \
|
||||
void Cmd_##n (FCommandLine &argv, void *who, int key)
|
||||
void Cmd_##n (FCommandLine &argv, int key)
|
||||
|
||||
class FUnsafeConsoleCommand : public FConsoleCommand
|
||||
{
|
||||
|
@ -125,13 +125,13 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void Run (FCommandLine &args, void *instigator, int key) override;
|
||||
virtual void Run (FCommandLine &args, int key) override;
|
||||
};
|
||||
|
||||
#define UNSAFE_CCMD(n) \
|
||||
static void Cmd_##n (FCommandLine &, void *, int key); \
|
||||
static void Cmd_##n (FCommandLine &, int key); \
|
||||
static FUnsafeConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \
|
||||
void Cmd_##n (FCommandLine &argv, void *who, int key)
|
||||
void Cmd_##n (FCommandLine &argv, int key)
|
||||
|
||||
const int KEY_DBLCLICKED = 0x8000;
|
||||
|
||||
|
@ -140,7 +140,7 @@ class FConsoleAlias : public FConsoleCommand
|
|||
public:
|
||||
FConsoleAlias (const char *name, const char *command, bool noSave);
|
||||
~FConsoleAlias ();
|
||||
void Run (FCommandLine &args, void *instigator, int key);
|
||||
void Run (FCommandLine &args, int key);
|
||||
bool IsAlias ();
|
||||
void PrintAlias ();
|
||||
void Archive (FConfigFile *f);
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void Run (FCommandLine &args, void *instigator, int key) override;
|
||||
virtual void Run (FCommandLine &args, int key) override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ CCMD (countdecals)
|
|||
|
||||
CCMD (spray)
|
||||
{
|
||||
if (who == NULL || argv.argc() < 2)
|
||||
if (players[consoleplayer].mo == NULL || argv.argc() < 2)
|
||||
{
|
||||
Printf ("Usage: spray <decal>\n");
|
||||
return;
|
||||
|
|
|
@ -423,11 +423,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, DisplayNameTag, DisplayNameTag)
|
|||
|
||||
CCMD (invnext)
|
||||
{
|
||||
if (who != NULL)
|
||||
if (players[consoleplayer].mo != nullptr)
|
||||
{
|
||||
IFVM(PlayerPawn, InvNext)
|
||||
{
|
||||
VMValue param = who;
|
||||
VMValue param = players[consoleplayer].mo;
|
||||
VMCall(func, ¶m, 1, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
@ -435,11 +435,11 @@ CCMD (invnext)
|
|||
|
||||
CCMD(invprev)
|
||||
{
|
||||
if (who != NULL)
|
||||
if (players[consoleplayer].mo != nullptr)
|
||||
{
|
||||
IFVM(PlayerPawn, InvPrev)
|
||||
{
|
||||
VMValue param = who;
|
||||
VMValue param = players[consoleplayer].mo;
|
||||
VMCall(func, ¶m, 1, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
@ -470,9 +470,9 @@ CCMD(invquery)
|
|||
|
||||
CCMD (use)
|
||||
{
|
||||
if (argv.argc() > 1 && who != NULL)
|
||||
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
||||
{
|
||||
SendItemUse = ((AActor*)who)->FindInventory(argv[1]);
|
||||
SendItemUse = players[consoleplayer].mo->FindInventory(argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -493,19 +493,19 @@ CCMD (weapdrop)
|
|||
|
||||
CCMD (drop)
|
||||
{
|
||||
if (argv.argc() > 1 && who != NULL)
|
||||
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
||||
{
|
||||
SendItemDrop = ((AActor*)who)->FindInventory(argv[1]);
|
||||
SendItemDrop = players[consoleplayer].mo->FindInventory(argv[1]);
|
||||
SendItemDropAmount = argv.argc() > 2 ? atoi(argv[2]) : -1;
|
||||
}
|
||||
}
|
||||
|
||||
CCMD (useflechette)
|
||||
{
|
||||
if (who == nullptr) return;
|
||||
IFVIRTUALPTRNAME(((AActor*)who), NAME_PlayerPawn, GetFlechetteItem)
|
||||
if (players[consoleplayer].mo == nullptr) return;
|
||||
IFVIRTUALPTRNAME(players[consoleplayer].mo, NAME_PlayerPawn, GetFlechetteItem)
|
||||
{
|
||||
VMValue params[] = { who };
|
||||
VMValue params[] = { players[consoleplayer].mo };
|
||||
AActor *cls;
|
||||
VMReturn ret((void**)&cls);
|
||||
VMCall(func, params, 1, &ret, 1);
|
||||
|
@ -516,7 +516,8 @@ CCMD (useflechette)
|
|||
|
||||
CCMD (select)
|
||||
{
|
||||
auto user = ((AActor*)who);
|
||||
if (!players[consoleplayer].mo) return;
|
||||
auto user = players[consoleplayer].mo;
|
||||
if (argv.argc() > 1)
|
||||
{
|
||||
auto item = user->FindInventory(argv[1]);
|
||||
|
|
Loading…
Reference in a new issue