Daenks/Meridian59_103 — pull request #225 by siwthaneye (2014-01-18 18:22:58+00:00)
Title:  Characters will now be listed before free character slots!

A small client update when picking a character on your account. Characters will now be listed before free character slots! Character names will be listed in alphabetical order with free character slots always appearing last.

This saves lots of time logging in and pressing down. This is specifically for accounts with a single character and a free character slot.

charpick.c now performs a bubble sort on character names rather than using LBS_SORT property on the charpick dialog listbox. delicious.

this replaces: https://github.com/Daenks/Meridian59_103/pull/223
Sorry I destroyed my brain for the git state and had to start again.

cyberjunk
For a)
Yes, they might be ordered by creationdate on the server - but I'm not saying you have to reorder the stored list.
You can reorder the entries which are sent to the client at the code that creates BP_CHARACTERS in KOD and send the entries to the client ordered as you want it - that makes it client independent.

For b)
Yes. Does not matter for 10 entries...
But you should at least mention such "limitations" in a code-comment and explain why you're still doing it.
Like "Using bubblesort here because it's simpler and there won't be more than 10 entries".

For c)
Honestly.. I don't really care how a free slot is visualized to the user exactly, so do it as you like...

PS: Consider raising the MINOR clientversion (#define MINOR_REV) in client.h if you do client-side changes.

siwthaneye
Thanks Clint

for a) Perhaps you could be helpful and direct me to the kod code where this is possible?

for b) Would you honestly rather I update the sorting algorithm? If you honestly have a problem with this and feel strongly about this being a "limitation" - I will update it just for you :)

for c) If you don't care why would you comment?

Thanks for the PS - this is helpful.

cyberjunk
a) It's in the C code of blakserv. See file "blakserv\game.c" function "GameTryGetUser(...)"
This is the codeblock which adds the entries.

AddByteToPacket(BP_CHARACTERS);
AddShortToPacket((short)CountUserByAccountID(s->account->account_id));
ForEachUserByAccountID(GameSendEachUserChoice,s->account->account_id);
AddStringToPacket(GetMotdLength(),GetMotd());
b) No, keep it BubbleSort if you prefer that. But at least add the mentioned comment why you do it and why there are no issues with it.

c) This basically boils down to the same idea of "Do it on the serverside". You might also just want to send the string you want to be shown for empty-character slots from the server. That's why I basically mentioned it.