← Back to team overview

widelands-dev team mailing list archive

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

 

Fixed the typo and answered the question.

Diff comments:

> === modified file 'src/editor/editorinteractive.cc'
> --- src/editor/editorinteractive.cc	2017-09-02 19:34:45 +0000
> +++ src/editor/editorinteractive.cc	2017-09-03 13:04:48 +0000
> @@ -322,6 +344,39 @@
>  			constexpr int kStartingPosHotspotY = 55;
>  			blit_overlay(player_image, Vector2i(player_image->width() / 2, kStartingPosHotspotY));
>  		}
> +
> +		// Draw selection markers on the field.
> +		if (selected_nodes.count(field.fcoords) > 0) {
> +			const Image* pic = get_sel_picture();
> +			blit_overlay(pic, Vector2i(pic->width() / 2, pic->height() / 2));
> +		}
> +
> +		// Draw selection markers on the triangles.
> +		if (field.all_neighbors_valid()) {
> +			const FieldsToDraw::Field& rn = fields_to_draw->at(field.rn_index);
> +			const FieldsToDraw::Field& brn = fields_to_draw->at(field.brn_index);
> +			const FieldsToDraw::Field& bln = fields_to_draw->at(field.bln_index);
> +			if (selected_triangles.count(
> +			       Widelands::TCoords<>(field.fcoords, Widelands::TriangleIndex::R))) {
> +				const Vector2f tripos(
> +				   (field.rendertarget_pixel.x + rn.rendertarget_pixel.x + brn.rendertarget_pixel.x) /
> +				      3.f,
> +				   (field.rendertarget_pixel.y + rn.rendertarget_pixel.y + brn.rendertarget_pixel.y) /
> +				      3.f);
> +				const Image* pic = get_sel_picture();
> +				blit(pic, tripos, Vector2i(pic->width() / 2, pic->height() / 2));
> +			}
> +			if (selected_triangles.count(

It isn't - we check once for the right triangle and once for the down triangle of each field, so that all triangles are handled.

> +			       Widelands::TCoords<>(field.fcoords, Widelands::TriangleIndex::D))) {
> +				const Vector2f tripos(
> +				   (field.rendertarget_pixel.x + bln.rendertarget_pixel.x + brn.rendertarget_pixel.x) /
> +				      3.f,
> +				   (field.rendertarget_pixel.y + bln.rendertarget_pixel.y + brn.rendertarget_pixel.y) /
> +				      3.f);
> +				const Image* pic = get_sel_picture();
> +				blit(pic, tripos, Vector2i(pic->width() / 2, pic->height() / 2));
> +			}
> +		}
>  	}
>  }
>  


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


References