← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1825932-open-games into lp:widelands

 

Thanks allot. Regarding your test see the diff comment, please,

Diff comments:

> 
> === modified file 'src/ui_fsmenu/internet_lobby.cc'
> --- src/ui_fsmenu/internet_lobby.cc	2019-04-24 06:01:37 +0000
> +++ src/ui_fsmenu/internet_lobby.cc	2019-05-03 06:24:46 +0000
> @@ -218,26 +218,30 @@
>  	hostgame_.set_enabled(true);
>  	joingame_.set_enabled(false);
>  	std::string localservername = edit_servername_.text();
> +	std::string localbuildid = build_id();
>  
>  	if (games != nullptr) {  // If no communication error occurred, fill the list.
>  		for (const InternetGame& game : *games) {
>  			const Image* pic;
> -			if (game.connectable) {
> -				if (game.build_id == build_id())
> -					pic = g_gr->images().get("images/ui_basic/continue.png");
> -				else {
> +			if (game.connectable == INTERNET_GAME_SETUP && game.build_id == localbuildid) {
> +				// only clients with the same build number are displayed
> +				pic = g_gr->images().get("images/ui_basic/continue.png");
> +				opengames_list_.add(game.name, game, pic, false, game.build_id);
> +			} else if (game.connectable == INTERNET_GAME_SETUP && 
> +				game.build_id.compare(0,6,"build-") != 0 && localbuildid.compare(0,6,"build-") != 0) {
> +					// only development clients are allowed to see games openend by such
>  					pic = g_gr->images().get("images/ui_basic/different.png");
> -				}
> -			} else {
> -				pic = g_gr->images().get("images/ui_basic/stop.png");
> +					opengames_list_.add(game.name, game, pic, false, game.build_id);
>  			}
>  			// If one of the servers has the same name as the local name of the
>  			// clients server, we disable the 'hostgame' button to avoid having more
>  			// than one server with the same name.
>  			if (game.name == localservername) {
>  				hostgame_.set_enabled(false);
> +				InternetGaming::ref().format_and_add_chat("", "", true,
> +				(boost::format(_("A game named %s is already running. Please choose a different name."))
> +					% game.name).str());

The user would then receive this message in the chat window.

>  			}
> -			opengames_list_.add(game.name, game, pic, false, game.build_id);
>  		}
>  	}
>  }


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1825932-open-games/+merge/366860
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1825932-open-games into lp:widelands.


References