mail[Wesnoth-commits] r44447 - in /trunk/src: display.cpp display.hpp game_display.cpp game_display.hpp


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

Header


Content

Posted by alinktomine on July 20, 2010 - 21:46:
Author: alink
Date: Tue Jul 20 21:46:08 2010
New Revision: 44447

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44447&view=rev
Log:
More use of reference for ToD.
Helps to reduce a bit the overhead of local_light for common case.

Modified:
    trunk/src/display.cpp
    trunk/src/display.hpp
    trunk/src/game_display.cpp
    trunk/src/game_display.hpp

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=44447&r1=44446&r2=44447&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Tue Jul 20 21:46:08 2010
@@ -38,6 +38,7 @@
 #include "preferences.hpp"
 #include "sdl_utils.hpp"
 #include "text.hpp"
+#include "time_of_day.hpp"
 #include "tooltips.hpp"
 #include "arrow.hpp"
 
@@ -146,6 +147,12 @@
 {
 }
 
+const time_of_day& display::get_time_of_day(const map_location& /*loc*/) 
const
+{
+       static const time_of_day tod;
+       return tod;
+}
+
 void display::fill_images_list(const std::string& prefix, 
std::vector<std::string>& images)
 {
        // search prefix.png, prefix1.png, prefix2.png ...
@@ -691,7 +698,7 @@
        std::string color_mod;
        bool use_lightmap = false;
        if(game_config::local_light){
-               const time_of_day tod = get_time_of_day(loc);
+               const time_of_day& tod = get_time_of_day(loc);
 
                map_location adjs[6];
                get_adjacent_tiles(loc,adjs);
@@ -700,7 +707,7 @@
                //get all the light transitions
                std::ostringstream light_trans;
                for(int d=0; d<6; ++d){
-                       const time_of_day atod = get_time_of_day(adjs[d]);
+                       const time_of_day& atod = get_time_of_day(adjs[d]);
                        if(atod.red == tod.red && atod.green == tod.green && 
atod.blue == tod.blue)
                                continue;
 

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=44447&r1=44446&r2=44447&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Tue Jul 20 21:46:08 2010
@@ -35,6 +35,7 @@
 
 class config;
 class terrain_builder;
+struct time_of_day;
 class map_labels;
 class arrow;
 
@@ -45,7 +46,6 @@
 #include "map_location.hpp"
 #include "reports.hpp"
 #include "team.hpp"
-#include "time_of_day.hpp"
 #include "theme.hpp"
 #include "video.hpp"
 #include "widgets/button.hpp"

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=44447&r1=44446&r2=44447&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Tue Jul 20 21:46:08 2010
@@ -409,7 +409,7 @@
        //simulate_delay += 1;
 }
 
-const time_of_day game_display::get_time_of_day(const map_location& loc) 
const
+const time_of_day& game_display::get_time_of_day(const map_location& loc) 
const
 {
        return tod_manager_.get_time_of_day(loc);
 }

Modified: trunk/src/game_display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.hpp?rev=44447&r1=44446&r2=44447&view=diff
==============================================================================
--- trunk/src/game_display.hpp (original)
+++ trunk/src/game_display.hpp Tue Jul 20 21:46:08 2010
@@ -143,7 +143,7 @@
        /** Same as invalidate_unit() if moving the displayed unit. */
        void invalidate_unit_after_move(const map_location& src, const 
map_location& dst);
 
-       const time_of_day get_time_of_day(const map_location& loc) const;
+       const time_of_day& get_time_of_day(const map_location& loc) const;
 
 protected:
        /**




Related Messages


Powered by MHonArc, Updated Tue Jul 20 22:00:12 2010