Repository navigation
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.
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.
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.
michicc
left a comment
There was a problem hiding this comment.
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)