Skip to content

Commit

Permalink
Code format - (Clang-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 10, 2025
1 parent 09bf705 commit 0870b81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
32 changes: 11 additions & 21 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3339,7 +3339,7 @@ BlockType_t Player::blockHit(const std::shared_ptr<Creature> &attacker, const Co
BlockType_t blockType = Creature::blockHit(attacker, combatType, damage, checkDefense, checkArmor, field);

if (attacker) {
//sendCreatureSquare(attacker, SQ_COLOR_BLACK, SQUARE_FLASH);
// sendCreatureSquare(attacker, SQ_COLOR_BLACK, SQUARE_FLASH);
}

if (blockType != BLOCK_NONE) {
Expand Down Expand Up @@ -6525,35 +6525,31 @@ void Player::clearAttacked() {
attackedSet.clear();
}

bool Player::isAttackedBy(const std::shared_ptr<Player> &attacker) const
{
bool Player::isAttackedBy(const std::shared_ptr<Player> &attacker) const {
if (hasFlag(PlayerFlags_t::NotGainInFight) || !attacker) {
return false;
}

return attackedBySet.find(attacker->guid) != attackedBySet.end();
}

void Player::addAttackedBy(const std::shared_ptr<Player> &attacker)
{
void Player::addAttackedBy(const std::shared_ptr<Player> &attacker) {
if (hasFlag(PlayerFlags_t::NotGainInFight) || !attacker || attacker == getPlayer()) {
return;
}

attackedBySet.emplace(attacker->guid);
}

void Player::removeAttackedBy(const std::shared_ptr<Player> &attacker)
{
void Player::removeAttackedBy(const std::shared_ptr<Player> &attacker) {
if (!attacker || attacker == getPlayer()) {
return;
}

attackedBySet.erase(attacker->guid);
}

void Player::clearAttackedBy()
{
void Player::clearAttackedBy() {
for (auto it : attackedBySet) {
if (const auto &attacker = g_game().getPlayerByGUID(it)) {
attacker->removeAttacked(getPlayer());
Expand Down Expand Up @@ -10844,8 +10840,7 @@ uint16_t Player::getPlayerVocationEnum() const {
return Vocation_t::VOCATION_NONE;
}

SquareColor_t Player::getCreatureSquare(const std::shared_ptr<Creature> &creature) const
{
SquareColor_t Player::getCreatureSquare(const std::shared_ptr<Creature> &creature) const {
if (!creature) {
return SQ_COLOR_NONE;
}
Expand All @@ -10855,8 +10850,7 @@ SquareColor_t Player::getCreatureSquare(const std::shared_ptr<Creature> &creatur
return SQ_COLOR_YELLOW;
}
return SQ_COLOR_NONE;
}
else if (creature->isSummon()) {
} else if (creature->isSummon()) {
return getCreatureSquare(creature->getMaster());
}

Expand All @@ -10867,12 +10861,10 @@ SquareColor_t Player::getCreatureSquare(const std::shared_ptr<Creature> &creatur

if (isAggressiveCreature(otherPlayer)) {
return SQ_COLOR_YELLOW;
}
else if (otherPlayer->isInPvpSituation()) {
} else if (otherPlayer->isInPvpSituation()) {
if (isAggressiveCreature(otherPlayer, true)) {
return SQ_COLOR_ORANGE;
}
else {
} else {
return SQ_COLOR_BROWN;
}
}
Expand Down Expand Up @@ -10934,8 +10926,7 @@ bool Player::isInPvpSituation() const {
return false;
}

bool Player::isAggressiveCreature(const std::shared_ptr<Creature> &creature, bool guildAndParty /*= false*/, uint32_t time /*= 0*/) const
{
bool Player::isAggressiveCreature(const std::shared_ptr<Creature> &creature, bool guildAndParty /*= false*/, uint32_t time /*= 0*/) const {
if (!creature) {
return false;
}
Expand All @@ -10951,8 +10942,7 @@ bool Player::isAggressiveCreature(const std::shared_ptr<Creature> &creature, boo

if (player == getPlayer()) {
return true;
}
else if (isPartner(player)) {
} else if (isPartner(player)) {
return false;
}

Expand Down
4 changes: 1 addition & 3 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8410,8 +8410,7 @@ void Game::updatePlayerHelpers(const std::shared_ptr<Player> &player) {
}
}

void Game::updateCreatureSquare(const std::shared_ptr<Creature> &creature)
{
void Game::updateCreatureSquare(const std::shared_ptr<Creature> &creature) {
if (!g_configManager().getBoolean(TOGGLE_EXPERT_PVP)) {
return;
}
Expand Down Expand Up @@ -10963,4 +10962,3 @@ void Game::updatePlayersOnline() const {
g_logger().error("[Game::updatePlayersOnline] Failed to update players online.");
}
}

0 comments on commit 0870b81

Please sign in to comment.