-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
Make GSGoal.QuestionClient work correctly at least for clients with ID < 2**16 #7560
Conversation
As |
@PeterN AFAICT full client_id is 32 bits > 27 = 13 + 14 so it won't be a full fix either. And I can't think of an easy way to squeeze buttons in 13 bytes even though it's theoretically possible (coz 1-3 bits only). I can send 16 bits of client id though instead of 13 if you insist. |
8d05111
to
e52c8a1
Compare
86ff9d4
to
2ff28f5
Compare
2ff28f5
to
024ff92
Compare
OpenTTD/src/network/network_type.h Lines 17 to 25 in a0c78c7
OpenTTD/src/network/network_type.h Lines 40 to 48 in a0c78c7
OpenTTD/src/network/network_server.h Lines 21 to 22 in a0c78c7
As far as I can tell none of this would allow a ClientID to actually break the 8 bit limit, despite the ClientID type likely mapping to If you have a way to reproduce ClientIDs > 255 do share. |
OpenTTD/src/network/network_server.cpp Line 212 in a0c78c7
|
ClientIndex client = (ClientIndex)GB(p1, 16, 8); | ||
byte type = GB(p1, 24, 2); | ||
bool is_client = HasBit(p1, 31); | ||
ClientID client = (ClientID)GB(p1, 16, 16); |
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.
If ClientIndex
is the "proper" type here (as discussed previously), why the change to ClientID
? I'm not a fan of using arbitrary values for enum types, especially potentially well beyond their defined ranges, as certain aggressive gcc optimisations can truncate enum types or skip range checks...
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.
If I'm understanding the issue right, the problem is that ClientIndex
is a local value and only ClientID
is in fact synced across the network.
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.
We did put it in 1.9.2, so...
Partially fixes #7534.
It's a good temporary fix as client ids almost never get that big and properly fixing it is much more complicated.
Way to test:
testclientquestion.zip
client 3 won't get welcome message without this fix (in 1.9.1)