Skip to content

Commit

Permalink
fix: gha warnings (#3244)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Jan 12, 2025
1 parent a4bc455 commit cb1e3d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9064,12 +9064,13 @@ void Game::playerCreateMarketOffer(uint32_t playerId, uint8_t type, uint16_t ite
}

uint64_t totalPrice = price * amount;
uint64_t totalFee = totalPrice * 0.02;
uint64_t maxFee = std::min<uint64_t>(1000000, totalFee);
uint64_t fee = std::max<uint64_t>(20, totalFee);
uint64_t totalFee = totalPrice * 0.02; // 2% fee
uint64_t maxFee = std::min<uint64_t>(1000000, totalFee); // Max fee is 1kk
uint64_t fee = std::clamp(totalFee, uint64_t(20), maxFee); // Limit between 20 and maxFee

if (type == MARKETACTION_SELL) {
if (fee > (player->getBankBalance() + player->getMoney())) {
uint64_t totalPriceWithFee = totalPrice + fee;
if (totalPriceWithFee > (player->getMoney() + player->getBankBalance())) {
offerStatus << "Fee is greater than player money";
return;
}
Expand Down
18 changes: 9 additions & 9 deletions src/map/spectators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ bool Spectators::checkCache(const SpectatorsCache::FloorData &specData, bool onl
for (const auto &creature : *list) {
const auto &specPos = creature->getPosition();
if ((centerPos.x - specPos.x >= minRangeX
&& centerPos.y - specPos.y >= minRangeY
&& centerPos.x - specPos.x <= maxRangeX
&& centerPos.y - specPos.y <= maxRangeY
&& (multifloor || specPos.z == centerPos.z)
&& ((onlyPlayers && creature->getPlayer())
|| (onlyMonsters && creature->getMonster())
|| (onlyNpcs && creature->getNpc()))
|| (!onlyPlayers && !onlyMonsters && !onlyNpcs))) {
&& centerPos.y - specPos.y >= minRangeY
&& centerPos.x - specPos.x <= maxRangeX
&& centerPos.y - specPos.y <= maxRangeY
&& (multifloor || specPos.z == centerPos.z)
&& ((onlyPlayers && creature->getPlayer())
|| (onlyMonsters && creature->getMonster())
|| (onlyNpcs && creature->getNpc())))
|| (!onlyPlayers && !onlyMonsters && !onlyNpcs)) {
spectators.emplace_back(creature);
}
}
Expand Down Expand Up @@ -257,7 +257,7 @@ Spectators Spectators::excludePlayerMaster() const {
specs.creatures.reserve(creatures.size());

for (const auto &c : creatures) {
if ((c->getMonster() != nullptr && !c->getMaster() || !c->getMaster()->getPlayer())) {
if ((c->getMonster() != nullptr && !c->getMaster()) || (!c->getMaster() || !c->getMaster()->getPlayer())) {
specs.insert(c);
}
}
Expand Down

0 comments on commit cb1e3d5

Please sign in to comment.