← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-768826 into lp:widelands

 

Review: Needs Fixing

draw_overlay needs to know if it's drawing for the editor or for a game/replay. I don't know how the control flow is here and what is accessible from the function; you might need to add a function parameter.

Some more comments in the diff.

Diff comments:

> === modified file 'src/wui/interactive_base.cc'
> --- src/wui/interactive_base.cc	2014-11-13 08:25:45 +0000
> +++ src/wui/interactive_base.cc	2014-11-21 21:28:04 +0000
> @@ -403,15 +403,18 @@
>  */
>  void InteractiveBase::draw_overlay(RenderTarget& dst) {
>  
> +	const Map & map = egbase().map();
> +
>  	// Blit node information when in debug mode.
>  	if (get_display_flag(dfDebug) || !dynamic_cast<const Game*>(&egbase())) {
>  		const std::string gametime(gametimestring(egbase().get_gametime()));
>  		const std::string gametime_text = as_uifont(gametime, UI_FONT_SIZE_SMALL);
> -		dst.blit(Point(5, 5), UI::g_fh1->render(gametime_text), CM_UseAlpha, UI::Align_TopLeft);

This has disappeared from the game screen as well.

> -		static boost::format node_format("(%i, %i)");
> +		static boost::format node_format("(%3i, %3i; %2i)");

I think (%3i, %3i, %2i) would look better.

> +		
> +		const int32_t height=map[m_sel.pos.node].get_height();
>  
>  		const std::string node_text = as_uifont
> -			((node_format % m_sel.pos.node.x % m_sel.pos.node.y).str(), UI_FONT_SIZE_SMALL);
> +			((node_format % m_sel.pos.node.x % m_sel.pos.node.y % height).str(), UI_FONT_SIZE_SMALL);

Don't show the third coordinate on the game screen; this should be an editor only function.

>  		dst.blit(
>  			Point(get_w() - 5, get_h() - 5),
>  			UI::g_fh1->render(node_text),
> 


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-768826/+merge/242544
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-768826.


References