Inventory issues
#8
I think its because the protocol is now using an unsigned char, whilst we're using a signed one, to represent the window ID.

Code:
m_WindowID = (++m_WindowIDCounter) % 127
(assume the counter has incremented to 127)

signed Counter = 127 (0111 1111)
signed ID = 0
protocol unsigned ID = 0
okay

Counter++

signed Counter = -128 (1000 0000)
signed ID = -1
protocol unsigned ID = 255
mismatch!

...

signed Counter = -125 (1000 0011)
signed ID = -125 (C modulo operation on a negative number is negative: -125 % 127 = -125)
protocol unsigned ID = 131
mismatch!

Suggested to ➀ use an unsigned counter and ➁ avoid all the modulos?
Reply
Thanks given by: Jammet


Messages In This Thread
Inventory issues - by Jammet - 04-17-2015, 03:47 AM
RE: Inventory issues - by fichdlmaa - 04-19-2015, 05:39 AM
RE: Inventory issues - by Jammet - 04-19-2015, 05:48 AM
RE: Inventory issues - by Jammet - 04-20-2015, 07:20 AM
RE: Inventory issues - by xoft - 04-20-2015, 07:34 AM
RE: Inventory issues - by Jammet - 04-20-2015, 04:30 PM
RE: Inventory issues - by Jammet - 04-21-2015, 01:04 AM
RE: Inventory issues - by tigerw - 04-21-2015, 03:48 AM
RE: Inventory issues - by worktycho - 04-21-2015, 07:30 AM
RE: Inventory issues - by xoft - 04-21-2015, 07:35 AM
RE: Inventory issues - by worktycho - 04-21-2015, 08:36 AM
RE: Inventory issues - by xoft - 04-21-2015, 04:02 PM
RE: Inventory issues - by Jammet - 04-22-2015, 01:54 AM
RE: Inventory issues - by xoft - 04-22-2015, 07:15 AM
RE: Inventory issues - by xoft - 04-22-2015, 07:21 AM
RE: Inventory issues - by xoft - 04-22-2015, 07:30 AM
RE: Inventory issues - by Jammet - 04-22-2015, 04:05 PM
RE: Inventory issues - by xoft - 04-25-2015, 09:50 PM
RE: Inventory issues - by fichdlmaa - 04-25-2015, 10:14 PM
RE: Inventory issues - by fichdlmaa - 04-25-2015, 10:56 PM



Users browsing this thread: 7 Guest(s)