Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Oct 23, 2023
1 parent 0da016b commit 427866f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ std::vector<std::pair<Position, std::vector<uint32_t>>> Combat::pickChainTargets

std::vector<std::pair<Position, std::vector<uint32_t>>> resultMap;
std::vector<std::shared_ptr<Creature>> targets;
std::set<uint32_t> visited;
phmap::flat_hash_set<uint32_t> visited;

if (initialTarget && initialTarget != caster) {
targets.push_back(initialTarget);
Expand Down
8 changes: 4 additions & 4 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5928,18 +5928,18 @@ uint16_t Player::getHelpers() const {

helperSet.emplace(party->getLeader());

return helperSet.size();
return static_cast<uint16_t>(helperSet.size());
}

if (guild) {
return guild->getMemberCountOnline();
return static_cast<uint16_t>(guild->getMemberCountOnline());
}

if (party) {
return party->getMemberCount() + party->getInvitationCount() + 1;
return static_cast<uint16_t>(party->getMemberCount() + party->getInvitationCount() + 1);
}

return 0;
return 0u;
}

void Player::sendClosePrivate(uint16_t channelId) {
Expand Down
2 changes: 1 addition & 1 deletion src/items/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Tile : public Cylinder, public SharedObject {
void addZone(std::shared_ptr<Zone> zone);
void clearZones();

auto getZones() {
auto getZones() const {
return zones;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lua/creature/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool Events::loadFromXml() {
}

const std::string &className = eventNode.attribute("class").as_string();
auto res = classes.insert(className);
auto res = classes.emplace(className);
if (res.second) {
const std::string &lowercase = asLowerCaseString(className);
const std::string &scriptName = lowercase + ".lua";
Expand Down
6 changes: 1 addition & 5 deletions src/map/house/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@ bool House::getAccessList(uint32_t listId, std::string &list) const {
return door->getAccessList(list);
}

bool House::isInvited(std::shared_ptr<Player> player) {
return getHouseAccessLevel(player) != HOUSE_NOT_INVITED;
}

void House::addDoor(std::shared_ptr<Door> door) {
doorList.push_back(door);
door->setHouse(static_self_cast<House>());
Expand Down Expand Up @@ -414,7 +410,7 @@ std::shared_ptr<Door> House::getDoorByPosition(const Position &pos) {
return nullptr;
}

bool House::canEditAccessList(uint32_t listId, std::shared_ptr<Player> player) {
bool House::canEditAccessList(uint32_t listId, const std::shared_ptr<Player> &player) const {
switch (getHouseAccessLevel(player)) {
case HOUSE_OWNER:
return true;
Expand Down
6 changes: 4 additions & 2 deletions src/map/house/house.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ class House : public SharedObject {
void addTile(std::shared_ptr<HouseTile> tile);
void updateDoorDescription() const;

bool canEditAccessList(uint32_t listId, std::shared_ptr<Player> player);
bool canEditAccessList(uint32_t listId, const std::shared_ptr<Player> &player) const;
// listId special = values:
// GUEST_LIST = guest list
// SUBOWNER_LIST = subowner list
void setAccessList(uint32_t listId, const std::string &textlist);
bool getAccessList(uint32_t listId, std::string &list) const;

bool isInvited(std::shared_ptr<Player> player);
bool isInvited(const std::shared_ptr<Player> &player) const {
return getHouseAccessLevel(player) != HOUSE_NOT_INVITED;
}

AccessHouseLevel_t getHouseAccessLevel(std::shared_ptr<Player> player) const;
bool kickPlayer(std::shared_ptr<Player> player, std::shared_ptr<Player> target);
Expand Down

0 comments on commit 427866f

Please sign in to comment.