From f16662f077fcc376299eaf89b010e1964e7b8648 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 27 Oct 2024 03:27:43 +0000 Subject: [PATCH] Code format - (Clang-format) --- src/creatures/players/player.cpp | 4 ++-- src/enums/player_cyclopedia.hpp | 2 +- src/game/game.cpp | 14 ++++++------ src/io/iomapserialize.cpp | 17 +------------- src/map/house/house.cpp | 24 ++++++++++---------- src/server/network/protocol/protocolgame.cpp | 12 +++++----- src/server/network/protocol/protocolgame.hpp | 2 +- 7 files changed, 30 insertions(+), 45 deletions(-) diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 4487523f395..d6ee3f5ad5f 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -8256,7 +8256,7 @@ BidErrorMessage Player::canBidHouse(uint32_t houseId) { } if (house->isGuildhall()) { - if (getGuildRank() && getGuildRank()->level != 3) { + if (getGuildRank() && getGuildRank()->level != 3) { return BidErrorMessage::Guildhall; } @@ -8266,4 +8266,4 @@ BidErrorMessage Player::canBidHouse(uint32_t houseId) { } return BidErrorMessage::NoError; -} \ No newline at end of file +} diff --git a/src/enums/player_cyclopedia.hpp b/src/enums/player_cyclopedia.hpp index fb2a97dac13..3f1aef3f0c1 100644 --- a/src/enums/player_cyclopedia.hpp +++ b/src/enums/player_cyclopedia.hpp @@ -80,4 +80,4 @@ enum class BidErrorMessage : uint8_t { NotEnoughMoney = 17, NotEnoughGuildMoney = 21, Internal = 24, -}; \ No newline at end of file +}; diff --git a/src/game/game.cpp b/src/game/game.cpp index 18281b3bc51..612aae6c297 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -10242,7 +10242,7 @@ bool Game::removeFiendishMonster(uint32_t id, bool create /* = true*/) { void Game::updateForgeableMonsters() { if (auto influencedLimit = g_configManager().getNumber(FORGE_INFLUENCED_CREATURES_LIMIT, __FUNCTION__); - forgeableMonsters.size() < influencedLimit * 2) { + forgeableMonsters.size() < influencedLimit * 2) { forgeableMonsters.clear(); for (const auto &[monsterId, monster] : monsters) { auto monsterTile = monster->getTile(); @@ -10748,10 +10748,10 @@ void Game::playerCyclopediaHousesByTown(uint32_t playerId, const std::string tow HouseMap houses; if (!townName.empty()) { - const auto& housesList = g_game().map.houses.getHouses(); - for (const auto& it : housesList) { - const auto& house = it.second; - const auto& town = g_game().map.towns.getTown(house->getTownId()); + const auto &housesList = g_game().map.houses.getHouses(); + for (const auto &it : housesList) { + const auto &house = it.second; + const auto &town = g_game().map.towns.getTown(house->getTownId()); if (!town) { return; } @@ -10802,7 +10802,7 @@ void Game::playerCyclopediaHouseBid(uint32_t playerId, uint32_t houseId, uint64_ ret = BidErrorMessage::NotEnoughMoney; auto retSuccess = BidSuccessMessage::BidSuccess; - if(house->getBidderName().empty()) { + if (house->getBidderName().empty()) { if (!processBankAuction(player, house, bidValue)) { player->sendHouseAuctionMessage(houseId, HouseAuctionType::Bid, enumToValue(ret)); return; @@ -10835,7 +10835,7 @@ void Game::playerCyclopediaHouseBid(uint32_t playerId, uint32_t houseId, uint64_ house->setBidder(player->getGUID()); } - const auto& town = g_game().map.towns.getTown(house->getTownId()); + const auto &town = g_game().map.towns.getTown(house->getTownId()); if (!town) { return; } diff --git a/src/io/iomapserialize.cpp b/src/io/iomapserialize.cpp index 41087ed202a..f45048482fd 100644 --- a/src/io/iomapserialize.cpp +++ b/src/io/iomapserialize.cpp @@ -363,22 +363,7 @@ bool IOMapSerialize::SaveHouseInfoGuard() { houseUpdate.upsert({ "owner", "paid", "warnings", "name", "town_id", "rent", "size", "beds", "bidder", "bidder_name", "highest_bid", "internal_bid", "bid_end_date", "state" }); for (const auto &[key, house] : g_game().map.houses.getHouses()) { - std::string values = fmt::format("{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}", - house->getId(), - house->getOwner(), - house->getPaidUntil(), - house->getPayRentWarnings(), - db.escapeString(house->getName()), - house->getTownId(), house->getRent(), - house->getSize(), - house->getBedCount(), - house->getBidder(), - db.escapeString(house->getBidderName()), - house->getHighestBid(), - house->getInternalBid(), - house->getBidEndDate(), - house->getState() - ); + std::string values = fmt::format("{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}", house->getId(), house->getOwner(), house->getPaidUntil(), house->getPayRentWarnings(), db.escapeString(house->getName()), house->getTownId(), house->getRent(), house->getSize(), house->getBedCount(), house->getBidder(), db.escapeString(house->getBidderName()), house->getHighestBid(), house->getInternalBid(), house->getBidEndDate(), house->getState()); if (!houseUpdate.addRow(values)) { return false; diff --git a/src/map/house/house.cpp b/src/map/house/house.cpp index c7530187df1..f9cfe5f995c 100644 --- a/src/map/house/house.cpp +++ b/src/map/house/house.cpp @@ -482,11 +482,11 @@ void House::resetTransferItem() { } void House::calculateBidEndDate(uint8_t daysToEnd) { - auto currentTimeMs = std::chrono::system_clock::now().time_since_epoch(); - - std::chrono::system_clock::time_point now = std::chrono::system_clock::time_point( - std::chrono::duration_cast(currentTimeMs) - ); + auto currentTimeMs = std::chrono::system_clock::now().time_since_epoch(); + + std::chrono::system_clock::time_point now = std::chrono::system_clock::time_point( + std::chrono::duration_cast(currentTimeMs) + ); // Truncate to whole days since epoch days daysSinceEpoch = std::chrono::duration_cast(now.time_since_epoch()); @@ -784,13 +784,13 @@ std::shared_ptr Houses::getHouseByBidderName(std::string bidderName) { } uint16_t Houses::getHouseCountByAccount(uint32_t accountId) { - uint16_t count = 0; - for (const auto& it : houseMap) { - if (it.second->getOwnerAccountId() == accountId) { - ++count; - } - } - return count; + uint16_t count = 0; + for (const auto &it : houseMap) { + if (it.second->getOwnerAccountId() == accountId) { + ++count; + } + } + return count; } bool Houses::loadHousesXML(const std::string &filename) { diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 6a0e8fe4cc1..2fa8a4b3a4b 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -9261,7 +9261,7 @@ void ProtocolGame::sendTakeScreenshot(Screenshot_t screenshotType) { writeToOutputBuffer(msg); } -void ProtocolGame::parseCyclopediaHouseAuction(NetworkMessage& msg) { +void ProtocolGame::parseCyclopediaHouseAuction(NetworkMessage &msg) { if (oldProtocol) { return; } @@ -9295,9 +9295,9 @@ void ProtocolGame::sendCyclopediaHouseList(HouseMap houses) { NetworkMessage msg; msg.addByte(0xC7); msg.add(houses.size()); - for (const auto& house : houses) { + for (const auto &house : houses) { const auto clientId = house.first; - const auto& houseData = house.second; + const auto &houseData = house.second; msg.add(clientId); msg.addByte(0x01); // 0x00 = Renovation; 0x01 = Available @@ -9375,11 +9375,11 @@ void ProtocolGame::sendHousesInfo() { msg.addByte(0x01); msg.add(houseClientId); - const auto& housesList = g_game().map.houses.getHouses(); + const auto &housesList = g_game().map.houses.getHouses(); msg.add(housesList.size()); - for (const auto& it : housesList) { + for (const auto &it : housesList) { msg.add(it.second->getClientId()); } writeToOutputBuffer(msg); -} \ No newline at end of file +} diff --git a/src/server/network/protocol/protocolgame.hpp b/src/server/network/protocol/protocolgame.hpp index d33708232ab..8a272c8ea8c 100644 --- a/src/server/network/protocol/protocolgame.hpp +++ b/src/server/network/protocol/protocolgame.hpp @@ -331,7 +331,7 @@ class ProtocolGame final : public Protocol { void sendCyclopediaCharacterTitles(); void sendHousesInfo(); - void parseCyclopediaHouseAuction(NetworkMessage& msg); + void parseCyclopediaHouseAuction(NetworkMessage &msg); void sendCyclopediaHouseList(HouseMap houses); void sendHouseAuctionMessage(uint32_t houseId, HouseAuctionType type, uint8_t index, bool bidSuccess);