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

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

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


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src ai.cpp
Date: Sat, 29 Jan 2005 13:08:53 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/01/29 18:08:53

Modified files:
        src            : ai.cpp 

Log message:
        fixed graphical glitch where AI units would disappear for a frame 
before moving

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

Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.134 wesnoth/src/ai.cpp:1.135
--- wesnoth/src/ai.cpp:1.134    Sat Jan 22 16:43:09 2005
+++ wesnoth/src/ai.cpp  Sat Jan 29 18:08:51 2005
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.134 2005/01/22 16:43:09 j_daniel Exp $ */
+/* $Id: ai.cpp,v 1.135 2005/01/29 18:08:51 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -379,10 +379,9 @@
        paths 
current_paths(info_.map,info_.state,info_.gameinfo,info_.units,from,info_.teams,ignore_zocs,teleport);
        paths_wiper wiper(info_.disp);
 
-       unit current_unit = u_it->second;
-       info_.units.erase(u_it);
-
        const std::map<location,paths>::iterator p_it = 
possible_moves.find(from);
+
+       unit current_unit = u_it->second;
 
        if(p_it != possible_moves.end()) {
                paths& p = p_it->second;
@@ -424,16 +423,22 @@
 
                        steps.push_back(to); //add the destination to the steps
 
-                       if(show_move && 
unit_display::unit_visible_on_path(info_.disp,info_.map,steps,current_unit,info_.state.get_time_of_day(),info_.units,info_.teams))
 {
+                       if(show_move && 
unit_display::unit_visible_on_path(info_.disp,info_.map,steps,u_it->second,info_.state.get_time_of_day(),info_.units,info_.teams))
 {
 
                                if(!info_.disp.fogged(from.x,from.y)) {
                                        info_.disp.set_paths(&current_paths);
                                }
 
-                               
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
+                               
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
+                               info_.units.erase(u_it);
+                               u_it = info_.units.end();
                                
unit_display::move_unit(info_.disp,info_.map,steps,current_unit,info_.state.get_time_of_day(),info_.units,info_.teams);
                        }
                }
+       }
+
+       if(u_it != info_.units.end()) {
+               info_.units.erase(u_it);
        }
 
        current_unit.set_movement(0);




reply via email to

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