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

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

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


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src game_events.cpp
Date: Thu, 09 Jun 2005 17:20:13 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/06/09 21:20:13

Modified files:
        src            : game_events.cpp 

Log message:
        Partly fix bug #13334: assertion failure in Hasty Alliance. The 
move_unit_fake code now displays an error instead of calling the pathfinder 
with out-of-the-map coordinates. However the HttT campaign has yet to be fixed.

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

Patches:
Index: wesnoth/src/game_events.cpp
diff -u wesnoth/src/game_events.cpp:1.149 wesnoth/src/game_events.cpp:1.150
--- wesnoth/src/game_events.cpp:1.149   Sat Jun  4 19:16:05 2005
+++ wesnoth/src/game_events.cpp Thu Jun  9 21:20:13 2005
@@ -1,4 +1,4 @@
-/* $Id: game_events.cpp,v 1.149 2005/06/04 19:16:05 ott Exp $ */
+/* $Id: game_events.cpp,v 1.150 2005/06/09 21:20:13 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -43,6 +43,7 @@
 #define WRN_NG LOG_STREAM(warn, engine)
 #define ERR_NG LOG_STREAM(err, engine)
 #define LOG_DP LOG_STREAM(info, display)
+#define ERR_CF LOG_STREAM(err, config)
 
 namespace {
 
@@ -513,6 +514,10 @@
                                if(i==0){
                                        src.x = atoi(xvals[i].c_str())-1;
                                        src.y = atoi(yvals[i].c_str())-1;
+                                       if (!game_map->on_board(src)) {
+                                               ERR_CF << "invalid 
move_unit_fake source: " << src << '\n';
+                                               break;
+                                       }
                                        continue;
                                }
                                shortest_path_calculator calc(dummy_unit,
@@ -524,10 +529,15 @@
 
                                dst.x = atoi(xvals[i].c_str())-1;
                                dst.y = atoi(yvals[i].c_str())-1;
+                               if (!game_map->on_board(dst)) {
+                                       ERR_CF << "invalid move_unit_fake 
destination: " << dst << '\n';
+                                       break;
+                               }
 
-                               paths::route route = a_star_search(src, dst, 
10000, &calc, game_map->x(), game_map->y());
-                               unit_display::move_unit(*screen, *game_map, 
route.steps,
-                                               
dummy_unit,status_ptr->get_time_of_day(), *units, *teams);
+                               paths::route route = a_star_search(src, dst, 
10000, &calc,
+                                                                  
game_map->x(), game_map->y());
+                               unit_display::move_unit(*screen, *game_map, 
route.steps, dummy_unit,
+                                                       
status_ptr->get_time_of_day(), *units, *teams);
 
                                src = dst;
                        }




reply via email to

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