mail[Wesnoth-commits] r36824 - /branches/1.6/src/editor2/editor_palettes.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by soliton . de on July 12, 2009 - 00:48:
Author: soliton
Date: Sun Jul 12 00:24:36 2009
New Revision: 36824

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36824&view=rev
Log:
use tooltip colors for non-core terrains, display some text info about 
non-core terrains in their tooltips and improve behavior with missing terrain 
images

Modified:
    branches/1.6/src/editor2/editor_palettes.cpp

Modified: branches/1.6/src/editor2/editor_palettes.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/editor2/editor_palettes.cpp?rev=36824&r1=36823&r2=36824&view=diff
==============================================================================
--- branches/1.6/src/editor2/editor_palettes.cpp (original)
+++ branches/1.6/src/editor2/editor_palettes.cpp Sun Jul 12 00:24:36 2009
@@ -433,6 +433,7 @@
                dstrect.y = y;
                dstrect.w = size_specs_.terrain_size;
                dstrect.h = size_specs_.terrain_size;
+               std::stringstream tooltip_text;
 
                //Draw default base for overlay terrains
                if(base_terrain != t_translation::NONE_TERRAIN) {
@@ -440,8 +441,13 @@
                        surface base_image(image::get_image(base_filename));
 
                        if(base_image == NULL) {
+                               tooltip_text << "BASE IMAGE NOT FOUND\n";
                                ERR_ED << "image for terrain " << counter << 
": '" << base_filename << "' not found\n";
-                               return;
+                               base_image = 
image::get_image("misc/missing-image.png");
+                               if (base_image == NULL) {
+                                       ERR_ED << "Placeholder image not 
found\n";
+                                       return;
+                               }
                        }
 
                        if(static_cast<unsigned>(base_image->w) != 
size_specs_.terrain_size ||
@@ -457,8 +463,13 @@
                const std::string filename = "terrain/" + 
map().get_terrain_info(terrain).editor_image() + ".png";
                surface image(image::get_image(filename));
                if(image == NULL) {
+                       tooltip_text << "IMAGE NOT FOUND\n";
                        ERR_ED << "image for terrain " << counter << ": '" << 
filename << "' not found\n";
-                       return;
+                       image = image::get_image("misc/missing-image.png");
+                       if (image == NULL) {
+                               ERR_ED << "Placeholder image not found\n";
+                               return;
+                       }
                }
 
                if(static_cast<unsigned>(image->w) != 
size_specs_.terrain_size ||
@@ -486,17 +497,21 @@
                }
                draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, 
color, screen);
 
-               std::stringstream tooltip_text;
-               if (non_core_terrains_.find(terrain) == 
non_core_terrains_.end()) {
-                       //no special for now
-               } else {
-                       tooltip_text << "#";
+               bool is_core = non_core_terrains_.find(terrain) == 
non_core_terrains_.end();
+               SDL_Color tip_color = font::NORMAL_COLOUR;
+               if (!is_core) {
+                       SDL_Color red = {0xff, 0, 0, 0};
+                       tip_color = red;
                }
                tooltip_text << map().get_terrain_string(terrain);
                if (gui_.get_draw_terrain_codes()) {
                        tooltip_text << " - " << terrain;
                }
-               tooltips::add_tooltip(dstrect, tooltip_text.str());
+               if (!is_core) {
+                       tooltip_text << " " << _("(non-core)") << "\n";
+                       tooltip_text << _("Will not work in game without 
extra care.");
+               }
+               tooltips::add_tooltip(dstrect, tooltip_text.str(), tip_color);
                if (counter_from_zero % size_specs_.terrain_width == 
size_specs_.terrain_width - 1)
                        y += size_specs_.terrain_space;
        }




Related Messages


Powered by MHonArc, Updated Sun Jul 12 01:00:44 2009