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

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

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


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src playturn.cpp
Date: Tue, 21 Jun 2005 18:19:19 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/06/21 22:19:19

Modified files:
        src            : playturn.cpp 

Log message:
        check return value from recruit_unit()

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

Patches:
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.382 wesnoth/src/playturn.cpp:1.383
--- wesnoth/src/playturn.cpp:1.382      Sun Jun 19 13:04:37 2005
+++ wesnoth/src/playturn.cpp    Tue Jun 21 22:19:19 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.382 2005/06/19 13:04:37 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.383 2005/06/21 22:19:19 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -1510,13 +1510,18 @@
                        unit& un = recall_list[action.recall_pos];
 
                        
recorder.add_recall(action.recall_pos,action.recall_loc);
-                       
recruit_unit(map_,team_num_,units_,un,action.recall_loc,&gui_);
-                       statistics::recall_unit(un);
-                       team& current_team = teams_[team_num_-1];
-                       current_team.spend_gold(game_config::recall_cost);
-                       
recall_list.erase(recall_list.begin()+action.recall_pos);
+                       const std::string& msg = 
recruit_unit(map_,team_num_,units_,un,action.recall_loc,&gui_);
+                       if(msg.empty()) {
+                               statistics::recall_unit(un);
+                               team& current_team = teams_[team_num_-1];
+                               
current_team.spend_gold(game_config::recall_cost);
+                               
recall_list.erase(recall_list.begin()+action.recall_pos);
 
-                       gui_.draw_tile(action.recall_loc.x,action.recall_loc.y);
+                               
gui_.draw_tile(action.recall_loc.x,action.recall_loc.y);
+                       } else {
+                               recorder.undo();
+                               gui::show_dialog(gui_,NULL,"",msg,gui::OK_ONLY);
+                       }
                }
        } else {
                // Redo movement action




reply via email to

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