mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[Cleanup] Use variable for character instead of a loop (#3268)
# Notes - Store character in a variable instead of looping a list of 1 entry.
This commit is contained in:
parent
2742eca119
commit
82762c3f5a
@ -9226,12 +9226,17 @@ void Client::SetSecondaryWeaponOrnamentation(uint32 model_id)
|
|||||||
*/
|
*/
|
||||||
bool Client::GotoPlayer(std::string player_name)
|
bool Client::GotoPlayer(std::string player_name)
|
||||||
{
|
{
|
||||||
auto characters = CharacterDataRepository::GetWhere(
|
const auto& l = CharacterDataRepository::GetWhere(
|
||||||
database,
|
database,
|
||||||
fmt::format("name = '{}' AND last_login > (UNIX_TIMESTAMP() - 600) LIMIT 1", player_name)
|
fmt::format("name = '{}' AND last_login > (UNIX_TIMESTAMP() - 600) LIMIT 1", player_name)
|
||||||
);
|
);
|
||||||
|
|
||||||
for (auto &c: characters) {
|
if (l.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& c = l[0];
|
||||||
|
|
||||||
if (c.zone_instance > 0 && !database.CheckInstanceExists(c.zone_instance)) {
|
if (c.zone_instance > 0 && !database.CheckInstanceExists(c.zone_instance)) {
|
||||||
Message(Chat::Yellow, "Instance no longer exists...");
|
Message(Chat::Yellow, "Instance no longer exists...");
|
||||||
return false;
|
return false;
|
||||||
@ -9244,9 +9249,6 @@ bool Client::GotoPlayer(std::string player_name)
|
|||||||
MovePC(c.zone_id, c.zone_instance, c.x, c.y, c.z, c.heading);
|
MovePC(c.zone_id, c.zone_instance, c.x, c.y, c.z, c.heading);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::GotoPlayerGroup(const std::string& player_name)
|
bool Client::GotoPlayerGroup(const std::string& player_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user