widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02721
Re: [Merge] lp:~widelands-dev/widelands/bug-1174075 into lp:widelands
Question for one of the nits - see diff comment.
Diff comments:
> === modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
> --- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-09-10 14:08:25 +0000
> +++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2014-09-24 08:43:32 +0000
> @@ -21,6 +21,7 @@
>
> #include <memory>
>
> +#include <boost/format.hpp>
> #include <SDL_keysym.h>
>
> #include "base/i18n.h"
> @@ -66,6 +67,9 @@
>
> constexpr int kSmallPicHeight = 20;
> constexpr int kSmallPicWidth = 20;
> +
> + std::string tooltip;
> +
> for (size_t checkfor = 0; check[checkfor] >= 0; ++checkfor) {
> const TerrainDescription::Type ter_is = terrain_descr.get_is();
> if (ter_is != check[checkfor])
> @@ -80,34 +84,51 @@
> if (ter_is == TerrainDescription::GREEN) {
> surf->blit(pt, green->surface(), Rect(0, 0, green->width(), green->height()));
> pt.x += kSmallPicWidth + 1;
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = _("Green");
> } else {
> if (ter_is & TerrainDescription::WATER) {
> surf->blit(pt, water->surface(), Rect(0, 0, water->width(), water->height()));
> pt.x += kSmallPicWidth + 1;
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = _("Water");
> }
> - if (ter_is & TerrainDescription::MOUNTAIN) {
> + else if (ter_is & TerrainDescription::MOUNTAIN) {
Green excludes everting else in terraindescription.cc. I guess the if/else was done for efficiency, and I imitated that with water/mountain. If you think the code will be more stable if we remove the else for both of them, will do.
> surf->blit(pt, mountain->surface(), Rect(0, 0, mountain->width(), mountain->height()));
> pt.x += kSmallPicWidth + 1;
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = _("Mountains");
> }
> if (ter_is & TerrainDescription::ACID) {
> surf->blit(pt, dead->surface(), Rect(0, 0, dead->width(), dead->height()));
> pt.x += kSmallPicWidth + 1;
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = ((boost::format("%s %s")) % tooltip % _("Dead")).str();
> }
> if (ter_is & TerrainDescription::UNPASSABLE) {
> surf->blit(
> pt, unpassable->surface(), Rect(0, 0, unpassable->width(), unpassable->height()));
> pt.x += kSmallPicWidth + 1;
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = ((boost::format("%s %s")) % tooltip % _("Unpassable")).str();
> }
> - if (ter_is & TerrainDescription::DRY)
> + if (ter_is & TerrainDescription::DRY) {
> surf->blit(pt, dry->surface(), Rect(0, 0, dry->width(), dry->height()));
> + /** TRANSLATORS: This is a terrain type tooltip in the editor */
> + tooltip = ((boost::format("%s %s")) % tooltip % _("Treeless")).str();
> + }
> }
> +
> + /** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */
> + tooltip = ((boost::format("%1%: %2%")) % terrain_descr.descname() % tooltip).str();
> +
> // Make sure we delete this later on.
> offscreen_images->emplace_back(new_in_memory_image("dummy_hash", surf));
> break;
> }
>
> std::unique_ptr<const Image>& image = offscreen_images->back();
> - UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get());
> + UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get(), tooltip);
> cb->set_desired_size(image->width() + 1, image->height() + 1);
> return cb;
> }
>
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1174075/+merge/235763
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1174075.
References