Skip to content

Commit

Permalink
enums: fixed conversion warning (otland#4025)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSpeichert authored and EPuncker committed May 22, 2023
1 parent 74644db commit 238c438
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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
4 changes: 2 additions & 2 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,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 getBaseSkill(uint8_t skill) const {
return skills[skill].level;
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 238c438

Please sign in to comment.