server
server copied to clipboard
[CPP] Fix error on zone when naked
I affirm:
- [x] I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
- [x] I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
- [x] I have read and understood the Contributing Guide and the Code of Conduct.
- [x] I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.
What does this pull request do?
Adds a check to prevent reporting an error if a character is naked and has no equipment to load. Resolves https://github.com/LandSandBoat/server/issues/5702
Steps to test these changes
- Unequip everything
- Zone
- Error shouldn't appear
checking if you're naked here really is a no-op, this happens on CCharEntity construction when being put into the world, the intent of that error message appears to be checking for if the query failed, but apparently literally zero equipment will trip the false positive here
checking if you're naked here really is a no-op, this happens on CCharEntity construction when being put into the world, the intent of that error message appears to be checking for if the query failed, but apparently literally zero equipment will trip the false positive here
Do we need this error if db::preparedStmt
is already reporting errors if it runs into them? It will show if the query failed and give the query so having both errors seems a bit redundant to me.
I'm not sure what else we can check for if db::preparedStmt
fails gracefully and returns no results but also returns no results when a player is naked.
Will wait for some input on Zach but I think if that is the case then we just don't need to log the error at all.
What did the code look like before my refactor?
Gut feeling is that log message added with the nuking of XI_DEBUG_BREAK_IF
(and oops to editing Zach's comment instead of adding this)
What did the code look like before my refactor?
The if was previously if (ret != SQL_ERROR)
. The error was touched 3 years ago but was just cleanup.
In which case none of this is really needed to match what was there before. This:
auto rset = db::preparedStmt(Query, PChar->id);
if (rset && rset->rowsCount())
Can/should become:
auto rset = db::preparedStmt(Query, PChar->id);
if (rset)
ie. "The query didn't fail" rather than "The query didn't fail AND there are rows of results" etc.
In which case none of this is really needed to match what was there before. This:
auto rset = db::preparedStmt(Query, PChar->id); if (rset && rset->rowsCount())
Can/should become:
auto rset = db::preparedStmt(Query, PChar->id); if (rset)
ie. "The query didn't fail" rather than "The query didn't fail AND there are rows of results" etc.
Changed to if (rset)
.
Presumably you've tested it and it works?
Presumably you've tested it and it works?
Works perfectly, yes.