wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src map_label.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src map_label.cpp
Date: Sun, 29 May 2005 23:55:35 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/05/30 03:55:34

Modified files:
        src            : map_label.cpp 

Log message:
        fixed problem with map labels displaying when it appears to the user 
they should be shrouded because the hex below the label is shrouded

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map_label.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text

Patches:
Index: wesnoth/src/map_label.cpp
diff -u wesnoth/src/map_label.cpp:1.15 wesnoth/src/map_label.cpp:1.16
--- wesnoth/src/map_label.cpp:1.15      Thu Nov 18 04:08:32 2004
+++ wesnoth/src/map_label.cpp   Mon May 30 03:55:34 2005
@@ -6,7 +6,17 @@
 #include "map_label.hpp"
 
 namespace {
-       const size_t max_label_size = 32;
+const size_t max_label_size = 32;
+
+//our definition of map labels being obscured is if the tile is obscured,
+//or the tile below is obscured. This is because in the case where the tile
+//itself is visible, but the tile below is obscured, the bottom half of the
+//tile will still be shrouded, and the label being drawn looks weird
+bool is_shrouded(const display& disp, const gamemap::location& loc)
+{
+       return disp.shrouded(loc.x,loc.y) || disp.shrouded(loc.x,loc.y+1);
+}
+
 }
 
 map_labels::map_labels(const display& disp, const gamemap& map) : disp_(disp), 
map_(map)
@@ -98,7 +108,7 @@
 
        labels_.insert(std::pair<gamemap::location,int>(loc,handle));
 
-       if(disp_.shrouded(loc.x,loc.y)) {
+       if(is_shrouded(disp_,loc)) {
                font::show_floating_label(handle,false);
        }
 }
@@ -133,6 +143,6 @@
 void map_labels::recalculate_shroud()
 {
        for(label_map::const_iterator i = labels_.begin(); i != labels_.end(); 
++i) {
-               
font::show_floating_label(i->second,!disp_.shrouded(i->first.x,i->first.y));
+               
font::show_floating_label(i->second,!is_shrouded(disp_,i->first));
        }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]