raduprv / Eternal-Lands

http://www.eternal-lands.com
Other
157 stars 57 forks source link

quick_use() question #130

Closed gvissers closed 3 years ago

gvissers commented 3 years ago

In hudquickbar.c, function quick_use(), a three byte message is created, of which only two bytes are sent (opcode and position of item to use). A look at items.c shows that "regular" use also sends only two bytes. Is there a use case for the third byte, or is it a simple oversight?

pjbroad commented 3 years ago

I have a copy the network protocol documentation from a long time ago. This says:

So perhaps its should be 3 bytes, but we get away with the inconsistency as the last byte will be zero. I cannot say why the quick_use() function sets the 3rd byte other than it was a mistake.

raduprv commented 3 years ago

It's part of an older protocol, but the server still uses it for a few things. Just leave that as it is.

gvissers commented 3 years ago

Hmm, interesting. Apparently this byte was added by yours truly back in 2005 (in f19b598), but even then, it was never sent. :confused: :flushed:

I haven't checked all intermediate commit, but I don't think this byte has ever been sent. Oh well, I'm willing to leave it as is. Perhaps add a comment, so the next person that stumbles upon it doesn't get too confused.

pjbroad commented 3 years ago

It was interesting reading about the the cool down feature (in c29eee81bdccaee4534e8e72e928610a23422976) and the forum thread too. So many people helping back then! I could not see why the extra byte would be related.

gvissers commented 3 years ago

Oh well, I'm willing to leave it as is

And I've changed my mind about that. Given that the server apparently hasn't needed this byte ever since it was introduced 16 years ago, and since regular use does not send it either, I have simply removed it. It can be reintroduced with a proper commit message if the server ever requires it.