Skip to content

Commit

Permalink
* Fix gha warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Jan 12, 2025
1 parent cef8e10 commit 0bce574
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 @@ -9058,12 +9058,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 @@ -67,14 +67,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 @@ -265,7 +265,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 0bce574

Please sign in to comment.