Author: alink
Date: Sun Apr 12 14:38:20 2009
New Revision: 34778

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34778&view=rev
Log:
Optimization of the in_hex scanning.
Skip it when not aligned to the hex grid (because we will not use it anyways).
This mainly avoid to scan most of the frames of melee animations.

Modified:
    trunk/src/unit_frame.cpp

Modified: trunk/src/unit_frame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_frame.cpp?rev=34778&r1=34777&r2=34778&view=diff
==============================================================================
--- trunk/src/unit_frame.cpp (original)
+++ trunk/src/unit_frame.cpp Sun Apr 12 14:38:20 2009
@@ -465,22 +465,19 @@
        const frame_parameters current_data = 
merge_parameters(frame_time,animation_val,engine_val,primary);
        double tmp_offset = current_data.offset;
        int d2 = game_display::get_singleton()->hex_size() / 2;
-       bool image_fit_hex = false;
 
        image::locator image_loc;
        if(direction != map_location::NORTH && direction != 
map_location::SOUTH) {
                image_loc = current_data.image_diagonal;
-               image_fit_hex = image::is_in_hex(image_loc);
        }
        if(image_loc.is_void() || image_loc.get_filename() == "") { // invalid 
diag image, or not diagonal
                image_loc = current_data.image;
-               image_fit_hex = image::is_in_hex(image_loc);
        }
 
        // we always invalidate our own hex because we need to be called at 
redraw time even
        // if we don't draw anything in the hex itself
        bool result = false;
-       if(image_fit_hex && tmp_offset==0 && current_data.x == 0 && 
current_data.y == 0) {
+       if(tmp_offset==0 && current_data.x == 0 && current_data.y == 0 && 
image::is_in_hex(image_loc)) {
                if(force || need_update()) {
                        result |= disp->invalidate(src);
                }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to