Skip to content

Commit

Permalink
enums: fixed conversion warning (#4025)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSpeichert committed Mar 22, 2022
1 parent 2f26b7d commit 357bae1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ struct Reflect {

Reflect& operator+=(const Reflect& other) {
percent += other.percent;
chance = std::min(100, chance + other.chance);
chance = std::min<uint16_t>(100, chance + other.chance);
return *this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool Groups::load()

for (auto groupNode : doc.child("groups").children()) {
Group group;
group.id = pugi::cast<uint32_t>(groupNode.attribute("id").value());
group.id = pugi::cast<uint16_t>(groupNode.attribute("id").value());
group.name = groupNode.attribute("name").as_string();
group.access = groupNode.attribute("access").as_bool();
group.maxDepotItems = pugi::cast<uint32_t>(groupNode.attribute("maxdepotitems").value());
Expand Down
6 changes: 3 additions & 3 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ class Player final : public Creature, public Cylinder
varSpecialSkills[skill] += modifier;
}

void setSpecialMagicLevelSkill(CombatType_t type, int32_t modifier) {
void setSpecialMagicLevelSkill(CombatType_t type, int16_t modifier) {
specialMagicLevelSkill[combatTypeToIndex(type)] += modifier;
}

Expand Down Expand Up @@ -595,10 +595,10 @@ class Player final : public Creature, public Cylinder
}

uint16_t getSpecialSkill(uint8_t skill) const {
return std::max<int32_t>(0, varSpecialSkills[skill]);
return std::max<uint16_t>(0, varSpecialSkills[skill]);
}
uint16_t getSkillLevel(uint8_t skill) const {
return std::max<int32_t>(0, skills[skill].level + varSkills[skill]);
return std::max<uint16_t>(0, skills[skill].level + varSkills[skill]);
}
uint16_t getSpecialMagicLevelSkill(CombatType_t type) const {
return std::max<int32_t>(0, specialMagicLevelSkill[combatTypeToIndex(type)]);
Expand Down
2 changes: 1 addition & 1 deletion src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct Position
return std::abs(Position::getOffsetY(p1, p2));
}
static int16_t getDistanceZ(const Position& p1, const Position& p2) {
return std::abs(Position::getOffsetZ(p1, p2));
return static_cast<int16_t>(std::abs(Position::getOffsetZ(p1, p2)));
}

uint16_t x = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class TileItemVector : private ItemVector
}
return *getBeginDownItem();
}
void addDownItemCount(int32_t increment) {
void addDownItemCount(uint16_t increment) {
downItemCount += increment;
}

Expand Down

0 comments on commit 357bae1

Please sign in to comment.