mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
[Cleanup] Use variable for c->GetTarget() instead of calling multiple times in bot_command.cpp (#3254)
# Notes - Calling multiple times is less performant than using a variable.
This commit is contained in:
parent
4a0725e278
commit
2a094e8792
@ -2526,9 +2526,17 @@ void bot_command_apply_poison(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
Bot *my_rogue_bot = nullptr;
|
||||
if (c->GetTarget() && c->GetTarget()->IsBot() && c->GetTarget()->CastToBot()->GetBotOwnerCharacterID() == c->CharacterID() && c->GetTarget()->CastToBot()->GetClass() == ROGUE) {
|
||||
my_rogue_bot = c->GetTarget()->CastToBot();
|
||||
auto t = c->GetTarget();
|
||||
|
||||
if (
|
||||
t &&
|
||||
t->IsBot() &&
|
||||
t->CastToBot()->GetBotOwnerCharacterID() == c->CharacterID() &&
|
||||
t->GetClass() == ROGUE
|
||||
) {
|
||||
my_rogue_bot = t->CastToBot();
|
||||
}
|
||||
|
||||
if (!my_rogue_bot) {
|
||||
|
||||
c->Message(Chat::White, "You must target a rogue bot that you own to use this command!");
|
||||
@ -6402,13 +6410,14 @@ void bot_subcommand_bot_report(Client *c, const Seperator *sep)
|
||||
|
||||
std::string ab_type_arg = sep->arg[1];
|
||||
if (ab_type_arg.empty()) {
|
||||
if (c->GetTarget()) {
|
||||
if (c->GetTarget()->IsClient() && c->GetTarget()->CastToClient() == c)
|
||||
auto t = c->GetTarget();
|
||||
if (t && t->IsClient()) {
|
||||
if (t->CastToClient() == c) {
|
||||
ab_type_arg = "ownergroup";
|
||||
else if (c->GetTarget()->IsClient() && c->GetTarget()->CastToClient() != c)
|
||||
} else {
|
||||
ab_type_arg = "targetgroup";
|
||||
}
|
||||
else {
|
||||
}
|
||||
} else {
|
||||
ab_type_arg = "spawned";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user