Skip to content

Commit

Permalink
* Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Dec 22, 2024
1 parent 8840971 commit f51cb99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
19 changes: 9 additions & 10 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3518,11 +3518,11 @@ void Player::death(const std::shared_ptr<Creature> &lastHitCreature) {
}
}

double magicLossPercent = deathLossPercent / 100.;
double magicLossPercent = deathLossPercent / 100.;
if (g_configManager().getBoolean(HALF_LOSS_MAGIC) && magicLossPercent > 0) {
magicLossPercent /= 2;
}

lostMana = static_cast<uint64_t>(sumMana * magicLossPercent);

while (lostMana > manaSpent && magLevel > 0) {
Expand Down Expand Up @@ -3565,11 +3565,11 @@ void Player::death(const std::shared_ptr<Creature> &lastHitCreature) {

sumSkillTries += skills[i].tries;

double skillLossPercent = deathLossPercent / 100.;
double skillLossPercent = deathLossPercent / 100.;
if (g_configManager().getBoolean(HALF_LOSS_SKILL) && skillLossPercent > 0) {
skillLossPercent /= 2;
}

auto lostSkillTries = static_cast<uint32_t>(sumSkillTries * skillLossPercent);
while (lostSkillTries > skills[i].tries) {
lostSkillTries -= skills[i].tries;
Expand Down Expand Up @@ -3819,7 +3819,7 @@ std::shared_ptr<Item> Player::getCorpse(const std::shared_ptr<Creature> &lastHit
descriptionStream << fmt::format("You recognize {}. {} was killed by ", getNameDescription(), subjectPronoun);

std::vector<std::string> killers;
for (const auto& [creatureId, damageInfo] : damageMap) {
for (const auto &[creatureId, damageInfo] : damageMap) {
auto damageDealer = g_game().getCreatureByID(creatureId);
if (damageDealer) {
killers.push_back(damageDealer->getNameDescription());
Expand Down Expand Up @@ -5131,7 +5131,7 @@ ItemsTierCountList Player::getDepotInboxItemsId() const {
}
}

return itemMap;;
return itemMap;
}

std::vector<std::shared_ptr<Item>> Player::getAllInventoryItems(bool ignoreEquiped /*= false*/, bool ignoreItemWithTier /* false*/) const {
Expand Down Expand Up @@ -5689,8 +5689,7 @@ void Player::onAttacked() {
addInFightTicks();
}

bool Player::checkLoginDelay(uint32_t playerId) const
{
bool Player::checkLoginDelay(uint32_t playerId) const {
return (OTSYS_TIME() <= (lastLoad + g_configManager().getNumber(LOGIN_PROTECTION)) && !hasBeenAttacked(playerId));
}

Expand Down Expand Up @@ -6365,7 +6364,7 @@ uint32_t Player::getAttackSpeed() const {
bool onFistAttackSpeed = g_configManager().getBoolean(TOGGLE_ATTACK_SPEED_ONFIST);
uint32_t MAX_ATTACK_SPEED = g_configManager().getNumber(MAX_SPEED_ATTACKONFIST);

const auto& mount = g_game().mounts->getMountByID(getCurrentMount());
const auto &mount = g_game().mounts->getMountByID(getCurrentMount());
if (isMounted() && mount) {
if (mount->attackSpeed > 0) {
if (mount->attackSpeed >= vocation->getAttackSpeed()) {
Expand Down Expand Up @@ -9892,7 +9891,7 @@ void Player::onCreatureAppear(const std::shared_ptr<Creature> &creature, bool is
sendBlessStatus();
}

if (g_configManager().getBoolean(ALWAYS_MOUNT_LOGIN) && getCurrentMount() != 0) {
if (g_configManager().getBoolean(ALWAYS_MOUNT_LOGIN) && getCurrentMount() != 0) {
toggleMount(true);
}

Expand Down
10 changes: 5 additions & 5 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3323,7 +3323,7 @@ ObjectCategory_t Game::getObjectCategory(const ItemType &it) {
uint64_t Game::getItemMarketPrice(const std::map<uint16_t, uint64_t> &itemMap, bool buyPrice) const {
uint64_t total = 0;

for (const auto& [itemId, itemCount] : itemMap) {
for (const auto &[itemId, itemCount] : itemMap) {
switch (itemId) {
case ITEM_GOLD_COIN:
total += itemCount;
Expand All @@ -3340,11 +3340,11 @@ uint64_t Game::getItemMarketPrice(const std::map<uint16_t, uint64_t> &itemMap, b
default: {
auto marketIt = itemsPriceMap.find(itemId);
if (marketIt != itemsPriceMap.end()) {
for (const auto& [tier, price] : marketIt->second) {
for (const auto &[tier, price] : marketIt->second) {
total += price * itemCount;
}
} else {
const ItemType& itemType = Item::items[itemId];
const ItemType &itemType = Item::items[itemId];
uint64_t price = buyPrice ? itemType.buyPrice : itemType.sellPrice;
total += price * itemCount;
}
Expand Down Expand Up @@ -10396,7 +10396,7 @@ void Game::updateForgeableMonsters() {
void Game::createFiendishMonsters() {
uint32_t created = 0;
uint32_t fiendishLimit = g_configManager().getNumber(FORGE_FIENDISH_CREATURES_LIMIT); // Fiendish Creatures limit

while (fiendishMonsters.size() < fiendishLimit) {
if (fiendishMonsters.size() >= fiendishLimit) {
g_logger().warn("[{}] - Returning in creation of Fiendish, size: {}, max is: {}.", __FUNCTION__, fiendishMonsters.size(), fiendishLimit);
Expand All @@ -10414,7 +10414,7 @@ void Game::createFiendishMonsters() {
void Game::createInfluencedMonsters() {
uint32_t created = 0;
uint32_t influencedLimit = g_configManager().getNumber(FORGE_INFLUENCED_CREATURES_LIMIT);

while (influencedMonsters.size() < influencedLimit) {
if (influencedMonsters.size() >= influencedLimit) {
g_logger().warn("[{}] - Returning in creation of Influenced, size: {}, max is: {}.", __FUNCTION__, influencedMonsters.size(), influencedLimit);
Expand Down

0 comments on commit f51cb99

Please sign in to comment.