← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands

 


Diff comments:

> === modified file 'src/network/internet_gaming.cc'
> --- src/network/internet_gaming.cc	2019-05-01 20:17:37 +0000
> +++ src/network/internet_gaming.cc	2019-05-03 01:27:24 +0000
> @@ -527,8 +527,8 @@
>  			// Client received the new list of clients
>  			uint8_t number = boost::lexical_cast<int>(packet.string()) & 0xff;
>  			std::vector<InternetClient> old = clientlist_;
> -			// Push IRC users to a second list and add them to the back
> -			std::vector<InternetClient> irc;
> +			// Push admins/registred/IRC users to a temporary list and add them back later
> +			std::vector<InternetClient> irc, registered, superuser ;

These are unused now - remove.

>  			clientlist_.clear();
>  			log("InternetGaming: Received a client list update with %u items.\n", number);
>  			InternetClient inc;
> @@ -558,7 +553,10 @@
>  					format_and_add_chat(
>  					   "", "", true, (boost::format(_("%s joined the lobby")) % inc.name).str());
>  			}
> -			clientlist_.insert(clientlist_.end(), irc.begin(), irc.end());
> +
> +			std::sort(clientlist_.begin(), clientlist_.end(),

You should not need to sort this one, because you're already sorting the UI::Table. Use UI::Table::set_sort_column to pick your column.

> +						[]( const InternetClient &left, const InternetClient &right )
> +						{ return ( left.name < right.name ); } );
>  
>  			for (InternetClient& client : old) {
>  				if (client.name.size() && client.type != INTERNET_CLIENT_IRC) {


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827182-sort-client-list/+merge/366843
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands.


References