Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: rework in pugi::cast and others fixes #734

Merged
merged 9 commits into from
Jan 4, 2023

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Jan 2, 2023

Description

Attention!!! From this pull request, pugi::cast will throw an exception when there is any overflow or data loss when converting, which means that it may crash if you write incorrect values in the "values" fields of the XML, so be careful.

Fixes #733

  • "Removed the "CustomFlag" as it was not necessary to use it, we already have the "PlayerFlag".
  • Fixed wrong size in some types in XML load.
  • Fixed the size of "PlayerFlags" in the groups class and changed it to uint8_t, as it is only used for the value 0 and 1 (boolean).
  • Fixed for the NPC not to walk or speak if there are no players nearby or if there are only players with the ignoredbynpcs flag.
  • Enums converted to enum class, making it easier to manage enums using magic_enum.
  • Added reload groups.
  • Rework of pugi::cast to the new std::from_chars of c++ 20, which more safely converts strings to integers and handles possible data loss better."

# (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@dudantas dudantas changed the title [Bug] fix pugi cast float conversion [Bug] fixes pugi::cast float conversion Jan 2, 2023
@dudantas dudantas mentioned this pull request Jan 3, 2023
1 task
@dudantas dudantas changed the title [Bug] fixes pugi::cast float conversion [Bug] rework in pugi::cast and others fixes Jan 3, 2023
Removed CustomFlag
Fixed some wrong conversion from xml to int types
Fixed size of "flags" in Group struct to bool
Fixed PlayerFlags_t to uint8_t, value is ever 0 or 1 (boolean) and converted enum to enum class
Fixed npc ignore god and not walking if not see player
Added reload to groups
Rework in pugi::cast, added new std::from_chars from c++20 to convert from string to integer safe
@dudantas dudantas force-pushed the fix-pugicast-conversion-to-float branch from 5cf7359 to b3521e4 Compare January 3, 2023 22:24
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@dudantas dudantas merged commit 588eccc into main Jan 4, 2023
@dudantas dudantas deleted the fix-pugicast-conversion-to-float branch January 4, 2023 17:25
@dudantas dudantas linked an issue Jan 5, 2023 that may be closed by this pull request
5 tasks
dudantas added a commit to dudantas/canary that referenced this pull request Feb 7, 2023
Attention!!! From this change, pugi::cast will throw an exception when there is any overflow or data loss when converting, which means that it may crash if you write incorrect values in the "values" fields of the XML, so be careful.

Fixes opentibiabr#733

• Removed the "CustomFlag" as it was not necessary to use it, we already have the "PlayerFlag".
• Fixed wrong size in some types in XML load.
• Fixed the size of "PlayerFlags" in the groups class and changed it to uint8_t, as it is only used for the value 0 and 1 (boolean).
• Fixed for the NPC not to walk or speak if there are no players nearby or if there are only players with the "ignoredbynpcs" flag.
• Enums converted to enum class, making it easier to manage enums using magic_enum.
• Added reload groups.
• Rework of pugi::cast to the new std::from_chars of c++ 20, which more safely converts strings to integers and handles possible data loss better.
jacksonie pushed a commit to jacksonie/canary that referenced this pull request Feb 17, 2023
Attention!!! From this change, pugi::cast will throw an exception when there is any overflow or data loss when converting, which means that it may crash if you write incorrect values in the "values" fields of the XML, so be careful.

Fixes opentibiabr#733

• Removed the "CustomFlag" as it was not necessary to use it, we already have the "PlayerFlag".
• Fixed wrong size in some types in XML load.
• Fixed the size of "PlayerFlags" in the groups class and changed it to uint8_t, as it is only used for the value 0 and 1 (boolean).
• Fixed for the NPC not to walk or speak if there are no players nearby or if there are only players with the "ignoredbynpcs" flag.
• Enums converted to enum class, making it easier to manage enums using magic_enum.
• Added reload groups.
• Rework of pugi::cast to the new std::from_chars of c++ 20, which more safely converts strings to integers and handles possible data loss better.
luan pushed a commit that referenced this pull request Jul 11, 2023
Attention!!! From this change, pugi::cast will throw an exception when there is any overflow or data loss when converting, which means that it may crash if you write incorrect values in the "values" fields of the XML, so be careful.

Fixes #733

• Removed the "CustomFlag" as it was not necessary to use it, we already have the "PlayerFlag".
• Fixed wrong size in some types in XML load.
• Fixed the size of "PlayerFlags" in the groups class and changed it to uint8_t, as it is only used for the value 0 and 1 (boolean).
• Fixed for the NPC not to walk or speak if there are no players nearby or if there are only players with the "ignoredbynpcs" flag.
• Enums converted to enum class, making it easier to manage enums using magic_enum.
• Added reload groups.
• Rework of pugi::cast to the new std::from_chars of c++ 20, which more safely converts strings to integers and handles possible data loss better.
@dudantas dudantas changed the title [Bug] rework in pugi::cast and others fixes improve: rework in pugi::cast and others fixes Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Player skills not increasing past 11 Bug in pugi::cast function
3 participants