-
Notifications
You must be signed in to change notification settings - Fork 137
Debug: update SetAIName, ShowHint #754
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the maximum allowed lengths for AI names and hints in the debug module. The changes ensure that the maximum length for AI names is now 127 characters and for hints is 1023 characters, with corresponding documentation updates in the message definitions.
- Update debug_set_ai_name to use a max length of 127 characters.
- Update debug_show_hint to use a max length of 1023 characters.
- Revise the comments in common.h accordingly.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
libdebug.cpp | Adjusted string length checks for AI names and hints. |
common.h | Updated message IDs comments to reflect the updated debug functions. |
I think copilot said well. and single_mode.cpp should reference this constant. |
@@ -167,8 +167,8 @@ int32_t scriptlib::debug_set_ai_name(lua_State *L) { | |||
pduel->write_buffer8(MSG_AI_NAME); | |||
const char* pstr = lua_tostring(L, 1); | |||
int len = (int)std::strlen(pstr); | |||
if(len > 100) | |||
len = 100; | |||
if(len > 127) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The max length is 19 uft16 code units.
The length of utf8 bytes is unknown.
It should be <128 (the buffer size in single_mode.cpp)
Do you think we should keep the original value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirming
According to single_mode.cpp
SetAIName
max length: 127 char
ShowHint
max length: 1023 char
@mercury233
@Wind2009-Louse